* [PATCH v2] mfd: stmpe: move platform data into mfd driver
@ 2016-05-25 12:22 Linus Walleij
2016-05-25 15:26 ` Patrice Chotard
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Linus Walleij @ 2016-05-25 12:22 UTC (permalink / raw)
To: Samuel Ortiz, Lee Jones, linux-kernel; +Cc: Linus Walleij, Patrice Chotard
The STMPE platform data is only populated from the device tree
in all existing users, so push the struct and make the OF case
the norm.
Cc: Patrice Chotard <patrice.chotard@st.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Drop check for (!np) NULL device node: as Lee notices, this
can no longer happen on a pure DT driver.
---
drivers/mfd/stmpe.c | 40 ++++++++++++++++++++++++++++------------
include/linux/mfd/stmpe.h | 22 +---------------------
2 files changed, 29 insertions(+), 33 deletions(-)
diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
index fb8f9e8b75df..94c7cc02fdab 100644
--- a/drivers/mfd/stmpe.c
+++ b/drivers/mfd/stmpe.c
@@ -23,6 +23,27 @@
#include <linux/regulator/consumer.h>
#include "stmpe.h"
+/**
+ * struct stmpe_platform_data - STMPE platform data
+ * @id: device id to distinguish between multiple STMPEs on the same board
+ * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
+ * @irq_trigger: IRQ trigger to use for the interrupt to the host
+ * @autosleep: bool to enable/disable stmpe autosleep
+ * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
+ * @irq_over_gpio: true if gpio is used to get irq
+ * @irq_gpio: gpio number over which irq will be requested (significant only if
+ * irq_over_gpio is true)
+ */
+struct stmpe_platform_data {
+ int id;
+ unsigned int blocks;
+ unsigned int irq_trigger;
+ bool autosleep;
+ bool irq_over_gpio;
+ int irq_gpio;
+ int autosleep_timeout;
+};
+
static int __stmpe_enable(struct stmpe *stmpe, unsigned int blocks)
{
return stmpe->variant->enable(stmpe, blocks, true);
@@ -1187,24 +1208,19 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata,
/* Called from client specific probe routines */
int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
{
- struct stmpe_platform_data *pdata = dev_get_platdata(ci->dev);
+ struct stmpe_platform_data *pdata;
struct device_node *np = ci->dev->of_node;
struct stmpe *stmpe;
int ret;
- if (!pdata) {
- if (!np)
- return -EINVAL;
-
- pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL);
- if (!pdata)
- return -ENOMEM;
+ pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL);
+ if (!pdata)
+ return -ENOMEM;
- stmpe_of_probe(pdata, np);
+ stmpe_of_probe(pdata, np);
- if (of_find_property(np, "interrupts", NULL) == NULL)
- ci->irq = -1;
- }
+ if (of_find_property(np, "interrupts", NULL) == NULL)
+ ci->irq = -1;
stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL);
if (!stmpe)
diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
index cb83883918a7..de748bc7525e 100644
--- a/include/linux/mfd/stmpe.h
+++ b/include/linux/mfd/stmpe.h
@@ -62,6 +62,7 @@ enum {
struct stmpe_variant_info;
struct stmpe_client_info;
+struct stmpe_platform_data;
/**
* struct stmpe - STMPE MFD structure
@@ -117,25 +118,4 @@ extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
#define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
-/**
- * struct stmpe_platform_data - STMPE platform data
- * @id: device id to distinguish between multiple STMPEs on the same board
- * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
- * @irq_trigger: IRQ trigger to use for the interrupt to the host
- * @autosleep: bool to enable/disable stmpe autosleep
- * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
- * @irq_over_gpio: true if gpio is used to get irq
- * @irq_gpio: gpio number over which irq will be requested (significant only if
- * irq_over_gpio is true)
- */
-struct stmpe_platform_data {
- int id;
- unsigned int blocks;
- unsigned int irq_trigger;
- bool autosleep;
- bool irq_over_gpio;
- int irq_gpio;
- int autosleep_timeout;
-};
-
#endif
--
2.4.11
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] mfd: stmpe: move platform data into mfd driver
2016-05-25 12:22 [PATCH v2] mfd: stmpe: move platform data into mfd driver Linus Walleij
@ 2016-05-25 15:26 ` Patrice Chotard
2016-06-20 9:21 ` Linus Walleij
2016-06-20 9:42 ` Lee Jones
2 siblings, 0 replies; 4+ messages in thread
From: Patrice Chotard @ 2016-05-25 15:26 UTC (permalink / raw)
To: Linus Walleij, Samuel Ortiz, Lee Jones, linux-kernel
On 05/25/2016 02:22 PM, Linus Walleij wrote:
> The STMPE platform data is only populated from the device tree
> in all existing users, so push the struct and make the OF case
> the norm.
>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Drop check for (!np) NULL device node: as Lee notices, this
> can no longer happen on a pure DT driver.
> ---
> drivers/mfd/stmpe.c | 40 ++++++++++++++++++++++++++++------------
> include/linux/mfd/stmpe.h | 22 +---------------------
> 2 files changed, 29 insertions(+), 33 deletions(-)
>
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index fb8f9e8b75df..94c7cc02fdab 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -23,6 +23,27 @@
> #include <linux/regulator/consumer.h>
> #include "stmpe.h"
>
> +/**
> + * struct stmpe_platform_data - STMPE platform data
> + * @id: device id to distinguish between multiple STMPEs on the same board
> + * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
> + * @irq_trigger: IRQ trigger to use for the interrupt to the host
> + * @autosleep: bool to enable/disable stmpe autosleep
> + * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
> + * @irq_over_gpio: true if gpio is used to get irq
> + * @irq_gpio: gpio number over which irq will be requested (significant only if
> + * irq_over_gpio is true)
> + */
> +struct stmpe_platform_data {
> + int id;
> + unsigned int blocks;
> + unsigned int irq_trigger;
> + bool autosleep;
> + bool irq_over_gpio;
> + int irq_gpio;
> + int autosleep_timeout;
> +};
> +
> static int __stmpe_enable(struct stmpe *stmpe, unsigned int blocks)
> {
> return stmpe->variant->enable(stmpe, blocks, true);
> @@ -1187,24 +1208,19 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata,
> /* Called from client specific probe routines */
> int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
> {
> - struct stmpe_platform_data *pdata = dev_get_platdata(ci->dev);
> + struct stmpe_platform_data *pdata;
> struct device_node *np = ci->dev->of_node;
> struct stmpe *stmpe;
> int ret;
>
> - if (!pdata) {
> - if (!np)
> - return -EINVAL;
> -
> - pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL);
> - if (!pdata)
> - return -ENOMEM;
> + pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + return -ENOMEM;
>
> - stmpe_of_probe(pdata, np);
> + stmpe_of_probe(pdata, np);
>
> - if (of_find_property(np, "interrupts", NULL) == NULL)
> - ci->irq = -1;
> - }
> + if (of_find_property(np, "interrupts", NULL) == NULL)
> + ci->irq = -1;
>
> stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL);
> if (!stmpe)
> diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
> index cb83883918a7..de748bc7525e 100644
> --- a/include/linux/mfd/stmpe.h
> +++ b/include/linux/mfd/stmpe.h
> @@ -62,6 +62,7 @@ enum {
>
> struct stmpe_variant_info;
> struct stmpe_client_info;
> +struct stmpe_platform_data;
>
> /**
> * struct stmpe - STMPE MFD structure
> @@ -117,25 +118,4 @@ extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
>
> #define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
>
> -/**
> - * struct stmpe_platform_data - STMPE platform data
> - * @id: device id to distinguish between multiple STMPEs on the same board
> - * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
> - * @irq_trigger: IRQ trigger to use for the interrupt to the host
> - * @autosleep: bool to enable/disable stmpe autosleep
> - * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
> - * @irq_over_gpio: true if gpio is used to get irq
> - * @irq_gpio: gpio number over which irq will be requested (significant only if
> - * irq_over_gpio is true)
> - */
> -struct stmpe_platform_data {
> - int id;
> - unsigned int blocks;
> - unsigned int irq_trigger;
> - bool autosleep;
> - bool irq_over_gpio;
> - int irq_gpio;
> - int autosleep_timeout;
> -};
> -
> #endif
Acked-by: Patrice Chotard <patrice.chotard@st.com>
Thanks
Patrice
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v2] mfd: stmpe: move platform data into mfd driver
2016-05-25 12:22 [PATCH v2] mfd: stmpe: move platform data into mfd driver Linus Walleij
2016-05-25 15:26 ` Patrice Chotard
@ 2016-06-20 9:21 ` Linus Walleij
2016-06-20 9:42 ` Lee Jones
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2016-06-20 9:21 UTC (permalink / raw)
To: Lee Jones, linux-kernel@vger.kernel.org; +Cc: Linus Walleij, Patrice Chotard
On Wed, May 25, 2016 at 2:22 PM, Linus Walleij <linus.walleij@linaro.org> wrote:
> The STMPE platform data is only populated from the device tree
> in all existing users, so push the struct and make the OF case
> the norm.
>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Drop check for (!np) NULL device node: as Lee notices, this
> can no longer happen on a pure DT driver.
Lee are you taking this? Looks like it was missed.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] mfd: stmpe: move platform data into mfd driver
2016-05-25 12:22 [PATCH v2] mfd: stmpe: move platform data into mfd driver Linus Walleij
2016-05-25 15:26 ` Patrice Chotard
2016-06-20 9:21 ` Linus Walleij
@ 2016-06-20 9:42 ` Lee Jones
2 siblings, 0 replies; 4+ messages in thread
From: Lee Jones @ 2016-06-20 9:42 UTC (permalink / raw)
To: Linus Walleij; +Cc: Samuel Ortiz, linux-kernel, Patrice Chotard
On Wed, 25 May 2016, Linus Walleij wrote:
> The STMPE platform data is only populated from the device tree
> in all existing users, so push the struct and make the OF case
> the norm.
>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Drop check for (!np) NULL device node: as Lee notices, this
> can no longer happen on a pure DT driver.
> ---
> drivers/mfd/stmpe.c | 40 ++++++++++++++++++++++++++++------------
> include/linux/mfd/stmpe.h | 22 +---------------------
> 2 files changed, 29 insertions(+), 33 deletions(-)
Applied, thanks.
> diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c
> index fb8f9e8b75df..94c7cc02fdab 100644
> --- a/drivers/mfd/stmpe.c
> +++ b/drivers/mfd/stmpe.c
> @@ -23,6 +23,27 @@
> #include <linux/regulator/consumer.h>
> #include "stmpe.h"
>
> +/**
> + * struct stmpe_platform_data - STMPE platform data
> + * @id: device id to distinguish between multiple STMPEs on the same board
> + * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
> + * @irq_trigger: IRQ trigger to use for the interrupt to the host
> + * @autosleep: bool to enable/disable stmpe autosleep
> + * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
> + * @irq_over_gpio: true if gpio is used to get irq
> + * @irq_gpio: gpio number over which irq will be requested (significant only if
> + * irq_over_gpio is true)
> + */
> +struct stmpe_platform_data {
> + int id;
> + unsigned int blocks;
> + unsigned int irq_trigger;
> + bool autosleep;
> + bool irq_over_gpio;
> + int irq_gpio;
> + int autosleep_timeout;
> +};
> +
> static int __stmpe_enable(struct stmpe *stmpe, unsigned int blocks)
> {
> return stmpe->variant->enable(stmpe, blocks, true);
> @@ -1187,24 +1208,19 @@ static void stmpe_of_probe(struct stmpe_platform_data *pdata,
> /* Called from client specific probe routines */
> int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
> {
> - struct stmpe_platform_data *pdata = dev_get_platdata(ci->dev);
> + struct stmpe_platform_data *pdata;
> struct device_node *np = ci->dev->of_node;
> struct stmpe *stmpe;
> int ret;
>
> - if (!pdata) {
> - if (!np)
> - return -EINVAL;
> -
> - pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL);
> - if (!pdata)
> - return -ENOMEM;
> + pdata = devm_kzalloc(ci->dev, sizeof(*pdata), GFP_KERNEL);
> + if (!pdata)
> + return -ENOMEM;
>
> - stmpe_of_probe(pdata, np);
> + stmpe_of_probe(pdata, np);
>
> - if (of_find_property(np, "interrupts", NULL) == NULL)
> - ci->irq = -1;
> - }
> + if (of_find_property(np, "interrupts", NULL) == NULL)
> + ci->irq = -1;
>
> stmpe = devm_kzalloc(ci->dev, sizeof(struct stmpe), GFP_KERNEL);
> if (!stmpe)
> diff --git a/include/linux/mfd/stmpe.h b/include/linux/mfd/stmpe.h
> index cb83883918a7..de748bc7525e 100644
> --- a/include/linux/mfd/stmpe.h
> +++ b/include/linux/mfd/stmpe.h
> @@ -62,6 +62,7 @@ enum {
>
> struct stmpe_variant_info;
> struct stmpe_client_info;
> +struct stmpe_platform_data;
>
> /**
> * struct stmpe - STMPE MFD structure
> @@ -117,25 +118,4 @@ extern int stmpe_disable(struct stmpe *stmpe, unsigned int blocks);
>
> #define STMPE_GPIO_NOREQ_811_TOUCH (0xf0)
>
> -/**
> - * struct stmpe_platform_data - STMPE platform data
> - * @id: device id to distinguish between multiple STMPEs on the same board
> - * @blocks: bitmask of blocks to enable (use STMPE_BLOCK_*)
> - * @irq_trigger: IRQ trigger to use for the interrupt to the host
> - * @autosleep: bool to enable/disable stmpe autosleep
> - * @autosleep_timeout: inactivity timeout in milliseconds for autosleep
> - * @irq_over_gpio: true if gpio is used to get irq
> - * @irq_gpio: gpio number over which irq will be requested (significant only if
> - * irq_over_gpio is true)
> - */
> -struct stmpe_platform_data {
> - int id;
> - unsigned int blocks;
> - unsigned int irq_trigger;
> - bool autosleep;
> - bool irq_over_gpio;
> - int irq_gpio;
> - int autosleep_timeout;
> -};
> -
> #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] 4+ messages in thread
end of thread, other threads:[~2016-06-20 9:41 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-25 12:22 [PATCH v2] mfd: stmpe: move platform data into mfd driver Linus Walleij
2016-05-25 15:26 ` Patrice Chotard
2016-06-20 9:21 ` Linus Walleij
2016-06-20 9:42 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox