Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1330284 > unrolled thread

[PATCH] mfd: Provide MACRO to declare commonly defined MFD cell attributes

Started byLee Jones <lee.jones@linaro.org>
First post2016-02-09 15:30 +0100
Last post2016-02-15 11:00 +0100
Articles 10 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] mfd: Provide MACRO to declare commonly defined MFD cell attributes Lee Jones <lee.jones@linaro.org> - 2016-02-09 15:30 +0100
    Re: [PATCH] mfd: Provide MACRO to declare commonly defined MFD cell  attributes Laxman Dewangan <ldewangan@nvidia.com> - 2016-02-09 16:40 +0100
    Re: [PATCH] mfd: Provide MACRO to declare commonly defined MFD cell  attributes Laxman Dewangan <ldewangan@nvidia.com> - 2016-02-10 14:00 +0100
    [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell  attributes Lee Jones <lee.jones@linaro.org> - 2016-02-10 16:40 +0100
      Re: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD  cell attributes Laxman Dewangan <ldewangan@nvidia.com> - 2016-02-10 19:10 +0100
        Re: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD  cell attributes Lee Jones <lee.jones@linaro.org> - 2016-02-11 10:20 +0100
          Re: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD  cell attributes Laxman Dewangan <ldewangan@nvidia.com> - 2016-02-11 10:20 +0100
            Re: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD  cell attributes Lee Jones <lee.jones@linaro.org> - 2016-02-11 10:50 +0100
    [PATCH v2] mfd: ab8500: Provide a small example using new MFD cell  MACROs Lee Jones <lee.jones@linaro.org> - 2016-02-10 16:40 +0100
      Re: [PATCH v2] mfd: ab8500: Provide a small example using new MFD  cell MACROs Linus Walleij <linus.walleij@linaro.org> - 2016-02-15 11:00 +0100

#1330284 — [PATCH] mfd: Provide MACRO to declare commonly defined MFD cell attributes

FromLee Jones <lee.jones@linaro.org>
Date2016-02-09 15:30 +0100
Subject[PATCH] mfd: Provide MACRO to declare commonly defined MFD cell attributes
Message-ID<r0hsK-5dn-13@gated-at.bofh.it>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 include/linux/mfd/core.h | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 27dac3f..dacdc49 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -16,6 +16,38 @@
 
 #include <linux/platform_device.h>
 
+#define MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, _match)		\
+	{								\
+		.name = (_name),					\
+		.num_resources = ARRAY_SIZE((_res)),			\
+		.resources = (_res),					\
+		.platform_data = (_pdata),				\
+		.pdata_size = ARRAY_SIZE((_pdata)),			\
+		.of_compatible = (_compat),				\
+		.acpi_match = (_match),					\
+		.id = _id,						\
+	}
+
+#define OF_MFD_CELL(_name, _res, _pdata, _id, _compat)			\
+	{								\
+		MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, NULL)	\
+	}
+
+#define ACPI_MFD_CELL(_name, _res, _pdata, _id, _match)			\
+	{								\
+		MFD_CELL_ALL(_name, _res, _pdata, _id, NULL, _match)	\
+	}
+
+#define MFD_CELL_BASIC(_name, _res, _pdata, _id)			\
+	{								\
+		MFD_CELL_ALL(_name, _res, _pdata, _id, NULL, NULL)	\
+	}
+
+#define MFD_CELL_NAME(_name)						\
+	{								\
+		MFD_CELL_ALL(_name, NULL, NULL, 0, NULL, NULL)		\
+	}
+
 struct irq_domain;
 
 /* Matches ACPI PNP id, either _HID or _CID, or ACPI _ADR */
-- 
1.9.1

[toc] | [next] | [standalone]


#1330359 — Re: [PATCH] mfd: Provide MACRO to declare commonly defined MFD cell attributes

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-02-09 16:40 +0100
SubjectRe: [PATCH] mfd: Provide MACRO to declare commonly defined MFD cell attributes
Message-ID<r0iyu-5W6-17@gated-at.bofh.it>
In reply to#1330284
On Tuesday 09 February 2016 07:57 PM, Lee Jones wrote:
> +
> +#define MFD_CELL_NAME(_name)						\
> +	{								\
> +		MFD_CELL_ALL(_name, NULL, NULL, 0, NULL, NULL)		\
> +	}
> +
>   struct irq_domain;

It is failed in compilation as we can not use ARRAY_SIZE(NULL)

static struct mfd_cell max77620_children[] = {
         MFD_CELL_NAME("max77620-pinctrl"),
};

  CC      drivers/mfd/max77620.o
drivers/mfd/max77620.c:57:2: warning: braces around scalar initializer
   MFD_CELL_NAME("max77620-pinctrl"),

include/linux/compiler-gcc.h:64:63: warning: taking address of 
expression of type 'void'
  #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
                                                                ^
include/linux/bug.h:33:55: note: in definition of macro 'BUILD_BUG_ON_ZERO'
  #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
                                                        ^
include/linux/compiler-gcc.h:64:46: note: in expansion of macro 
'__same_type'
  #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))

[toc] | [prev] | [next] | [standalone]


#1331130 — Re: [PATCH] mfd: Provide MACRO to declare commonly defined MFD cell attributes

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-02-10 14:00 +0100
SubjectRe: [PATCH] mfd: Provide MACRO to declare commonly defined MFD cell attributes
Message-ID<r0Cxd-2iO-5@gated-at.bofh.it>
In reply to#1330284
On Tuesday 09 February 2016 07:57 PM, Lee Jones wrote:
> Cc: Laxman Dewangan <ldewangan@nvidia.com>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>
> ---
>   include/linux/mfd/core.h | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
>
> diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
> index 27dac3f..dacdc49 100644
> --- a/include/linux/mfd/core.h
> +++ b/include/linux/mfd/core.h
> @@ -16,6 +16,38 @@
>   
>   #include <linux/platform_device.h>
>   
> +#define MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, _match)		\
> +	{								\
> +		.name = (_name),					\
> +		.num_resources = ARRAY_SIZE((_res)),			\
> +		.resources = (_res),					\
> +		.platform_data = (_pdata),				\
> +		.pdata_size = ARRAY_SIZE((_pdata)),			\
> +		.of_compatible = (_compat),				\
> +		.acpi_match = (_match),					\
> +		.id = _id,						\
> +	}
>

Should we add the _res_size and _pdata_size also in argument and use 
them instead of ARRA_SIZE and lets client set the size with help of 
ARRAY_SIZE based on type of data?

[toc] | [prev] | [next] | [standalone]


#1331276 — [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes

FromLee Jones <lee.jones@linaro.org>
Date2016-02-10 16:40 +0100
Subject[PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes
Message-ID<r0F22-3Zd-7@gated-at.bofh.it>
In reply to#1330284
mfd: Provide MACRO to declare commonly defined MFD cell attributes
    
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>

---
 include/linux/mfd/core.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index bc6f7e0..1a5a87f 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -16,6 +16,32 @@
 
 #include <linux/platform_device.h>
 
+#define MFD_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
+
+#define MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, _match)		\
+	{								\
+		.name = (_name),					\
+		.resources = (_res),					\
+		.num_resources = MFD_ARRAY_SIZE((_res)),		\
+		.platform_data = (_pdata),				\
+		.pdata_size = MFD_ARRAY_SIZE((_pdata)), 		\
+		.of_compatible = (_compat),				\
+		.acpi_match = (_match),					\
+		.id = _id,						\
+	}
+
+#define OF_MFD_CELL(_name, _res, _pdata, _id, _compat)			\
+		MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, NULL)	\
+
+#define ACPI_MFD_CELL(_name, _res, _pdata, _id, _match)			\
+		MFD_CELL_ALL(_name, _res, _pdata, _id, NULL, _match)	\
+
+#define MFD_CELL_BASIC(_name, _res, _pdata, _id)			\
+		MFD_CELL_ALL(_name, _res, _pdata, _id, NULL, NULL)	\
+
+#define MFD_CELL_NAME(_name)						\
+		MFD_CELL_ALL(_name, NULL, NULL, 0, NULL, NULL)		\
+
 struct irq_domain;
 struct property_set;

[toc] | [prev] | [next] | [standalone]


#1331407 — Re: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-02-10 19:10 +0100
SubjectRe: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes
Message-ID<r0Hnd-5O7-31@gated-at.bofh.it>
In reply to#1331276
On Wednesday 10 February 2016 09:08 PM, Lee Jones wrote:
> mfd: Provide MACRO to declare commonly defined MFD cell attributes
>      
> Cc: Laxman Dewangan <ldewangan@nvidia.com>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Build passed with this patch when using it.

Acked-by: Laxman Dewangan <ldewangan@nvidia.com>

Please let me know if you applying this. I am going to use the macro 
from this patch on max77620 series on next spin.

[toc] | [prev] | [next] | [standalone]


#1331763 — Re: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes

FromLee Jones <lee.jones@linaro.org>
Date2016-02-11 10:20 +0100
SubjectRe: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes
Message-ID<r0VzQ-6IR-21@gated-at.bofh.it>
In reply to#1331407
On Wed, 10 Feb 2016, Laxman Dewangan wrote:

> 
> On Wednesday 10 February 2016 09:08 PM, Lee Jones wrote:
> >mfd: Provide MACRO to declare commonly defined MFD cell attributes
> >Cc: Laxman Dewangan <ldewangan@nvidia.com>
> >Signed-off-by: Lee Jones <lee.jones@linaro.org>
> 
> Build passed with this patch when using it.
> 
> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
> 
> Please let me know if you applying this. I am going to use the macro
> from this patch on max77620 series on next spin.

As you are the first user, just submit it as 0/1 of your set.

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

[toc] | [prev] | [next] | [standalone]


#1331764 — Re: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes

FromLaxman Dewangan <ldewangan@nvidia.com>
Date2016-02-11 10:20 +0100
SubjectRe: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes
Message-ID<r0VzQ-6IR-19@gated-at.bofh.it>
In reply to#1331763
On Thursday 11 February 2016 02:40 PM, Lee Jones wrote:
> On Wed, 10 Feb 2016, Laxman Dewangan wrote:
>
>> On Wednesday 10 February 2016 09:08 PM, Lee Jones wrote:
>>> mfd: Provide MACRO to declare commonly defined MFD cell attributes
>>> Cc: Laxman Dewangan <ldewangan@nvidia.com>
>>> Signed-off-by: Lee Jones <lee.jones@linaro.org>
>> Build passed with this patch when using it.
>>
>> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
>>
>> Please let me know if you applying this. I am going to use the macro
>> from this patch on max77620 series on next spin.
> As you are the first user, just submit it as 0/1 of your set.
>

I saw that it is merged and available in linux-next 20160211.
So it is fine to not submit this patch again and modify my patch 
assuming it is on tree.

[toc] | [prev] | [next] | [standalone]


#1331789 — Re: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes

FromLee Jones <lee.jones@linaro.org>
Date2016-02-11 10:50 +0100
SubjectRe: [PATCH v2] mfd: Provide MACRO to declare commonly defined MFD cell attributes
Message-ID<r0W2S-6Wl-13@gated-at.bofh.it>
In reply to#1331764
On Thu, 11 Feb 2016, Laxman Dewangan wrote:

> 
> On Thursday 11 February 2016 02:40 PM, Lee Jones wrote:
> >On Wed, 10 Feb 2016, Laxman Dewangan wrote:
> >
> >>On Wednesday 10 February 2016 09:08 PM, Lee Jones wrote:
> >>>mfd: Provide MACRO to declare commonly defined MFD cell attributes
> >>>Cc: Laxman Dewangan <ldewangan@nvidia.com>
> >>>Signed-off-by: Lee Jones <lee.jones@linaro.org>
> >>Build passed with this patch when using it.
> >>
> >>Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
> >>
> >>Please let me know if you applying this. I am going to use the macro
> >>from this patch on max77620 series on next spin.
> >As you are the first user, just submit it as 0/1 of your set.
> >
> 
> I saw that it is merged and available in linux-next 20160211.
> So it is fine to not submit this patch again and modify my patch
> assuming it is on tree.

I was going to handle that, but as you wish, either way is fine by
me.

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

[toc] | [prev] | [next] | [standalone]


#1331282 — [PATCH v2] mfd: ab8500: Provide a small example using new MFD cell MACROs

FromLee Jones <lee.jones@linaro.org>
Date2016-02-10 16:40 +0100
Subject[PATCH v2] mfd: ab8500: Provide a small example using new MFD cell MACROs
Message-ID<r0F22-3Zd-9@gated-at.bofh.it>
In reply to#1330284
mfd: ab8500: Provide a small example using new MFD cell MACROs
    
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/mfd/ab8500-core.c | 106 +++++++++++++++-------------------------------
 1 file changed, 34 insertions(+), 72 deletions(-)

diff --git a/drivers/mfd/ab8500-core.c b/drivers/mfd/ab8500-core.c
index f3d6891..c03a86e 100644
--- a/drivers/mfd/ab8500-core.c
+++ b/drivers/mfd/ab8500-core.c
@@ -634,79 +634,41 @@ static const struct mfd_cell ab8500_bm_devs[] = {
 
 static const struct mfd_cell ab8500_devs[] = {
 #ifdef CONFIG_DEBUG_FS
-	{
-		.name = "ab8500-debug",
-		.of_compatible = "stericsson,ab8500-debug",
-	},
+	OF_MFD_CELL("ab8500-debug",
+		    NULL, NULL, 0, "stericsson,ab8500-debug"),
 #endif
-	{
-		.name = "ab8500-sysctrl",
-		.of_compatible = "stericsson,ab8500-sysctrl",
-	},
-	{
-		.name = "ab8500-ext-regulator",
-		.of_compatible = "stericsson,ab8500-ext-regulator",
-	},
-	{
-		.name = "ab8500-regulator",
-		.of_compatible = "stericsson,ab8500-regulator",
-	},
-	{
-		.name = "abx500-clk",
-		.of_compatible = "stericsson,abx500-clk",
-	},
-	{
-		.name = "ab8500-gpadc",
-		.of_compatible = "stericsson,ab8500-gpadc",
-	},
-	{
-		.name = "ab8500-rtc",
-		.of_compatible = "stericsson,ab8500-rtc",
-	},
-	{
-		.name = "ab8500-acc-det",
-		.of_compatible = "stericsson,ab8500-acc-det",
-	},
-	{
-
-		.name = "ab8500-poweron-key",
-		.of_compatible = "stericsson,ab8500-poweron-key",
-	},
-	{
-		.name = "ab8500-pwm",
-		.of_compatible = "stericsson,ab8500-pwm",
-		.id = 1,
-	},
-	{
-		.name = "ab8500-pwm",
-		.of_compatible = "stericsson,ab8500-pwm",
-		.id = 2,
-	},
-	{
-		.name = "ab8500-pwm",
-		.of_compatible = "stericsson,ab8500-pwm",
-		.id = 3,
-	},
-	{
-		.name = "ab8500-denc",
-		.of_compatible = "stericsson,ab8500-denc",
-	},
-	{
-		.name = "pinctrl-ab8500",
-		.of_compatible = "stericsson,ab8500-gpio",
-	},
-	{
-		.name = "abx500-temp",
-		.of_compatible = "stericsson,abx500-temp",
-	},
-	{
-		.name = "ab8500-usb",
-		.of_compatible = "stericsson,ab8500-usb",
-	},
-	{
-		.name = "ab8500-codec",
-		.of_compatible = "stericsson,ab8500-codec",
-	},
+	OF_MFD_CELL("ab8500-sysctrl",
+		    NULL, NULL, 0, "stericsson,ab8500-sysctrl"),
+	OF_MFD_CELL("ab8500-ext-regulator",
+		    NULL, NULL, 0, "stericsson,ab8500-ext-regulator"),
+	OF_MFD_CELL("ab8500-regulator",
+		    NULL, NULL, 0, "stericsson,ab8500-regulator"),
+	OF_MFD_CELL("abx500-clk",
+		    NULL, NULL, 0, "stericsson,abx500-clk"),
+	OF_MFD_CELL("ab8500-gpadc",
+		    NULL, NULL, 0, "stericsson,ab8500-gpadc"),
+	OF_MFD_CELL("ab8500-rtc",
+		    NULL, NULL, 0, "stericsson,ab8500-rtc"),
+	OF_MFD_CELL("ab8500-acc-det",
+		    NULL, NULL, 0, "stericsson,ab8500-acc-det"),
+	OF_MFD_CELL("ab8500-poweron-key",
+		    NULL, NULL, 0, "stericsson,ab8500-poweron-key"),
+	OF_MFD_CELL("ab8500-pwm",
+		    NULL, NULL, 1, "stericsson,ab8500-pwm"),
+	OF_MFD_CELL("ab8500-pwm",
+		    NULL, NULL, 2, "stericsson,ab8500-pwm"),
+	OF_MFD_CELL("ab8500-pwm",
+		    NULL, NULL, 3, "stericsson,ab8500-pwm"),
+	OF_MFD_CELL("ab8500-denc",
+		    NULL, NULL, 0, "stericsson,ab8500-denc"),
+	OF_MFD_CELL("pinctrl-ab8500",
+		    NULL, NULL, 0, "stericsson,ab8500-gpio"),
+	OF_MFD_CELL("abx500-temp",
+		    NULL, NULL, 0, "stericsson,abx500-temp"),
+	OF_MFD_CELL("ab8500-usb",
+		    NULL, NULL, 0, "stericsson,ab8500-usb"),
+	OF_MFD_CELL("ab8500-codec",
+		    NULL, NULL, 0, "stericsson,ab8500-codec"),
 };
 
 static const struct mfd_cell ab9540_devs[] = {

[toc] | [prev] | [next] | [standalone]


#1334336 — Re: [PATCH v2] mfd: ab8500: Provide a small example using new MFD cell MACROs

FromLinus Walleij <linus.walleij@linaro.org>
Date2016-02-15 11:00 +0100
SubjectRe: [PATCH v2] mfd: ab8500: Provide a small example using new MFD cell MACROs
Message-ID<r2o6L-7Cc-19@gated-at.bofh.it>
In reply to#1331282
On Wed, Feb 10, 2016 at 4:39 PM, Lee Jones <lee.jones@linaro.org> wrote:

> mfd: ab8500: Provide a small example using new MFD cell MACROs
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Oh, that's pretty.
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web