From: Rhyland Klein <rklein@nvidia.com>
To: Lee Jones <lee.jones@linaro.org>
Cc: <linux-kernel@vger.kernel.org>, Rhyland Klein <rklein@nvidia.com>,
Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH] mfd: Fix MACRO for commonly declared MFD cell attributes
Date: Thu, 18 Feb 2016 13:52:38 -0500 [thread overview]
Message-ID: <1455821558-28493-1-git-send-email-rklein@nvidia.com> (raw)
MFD_ARRAY_SIZE() would not accurately return 0 if the passed
parameter was NULL. Fix this so that num_resources will
accurately be 0 in the case that _res is NULL.
cc: Lee Jones <lee.jones@linaro.org>
cc: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
---
include/linux/mfd/core.h | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index 1a5a87f3cd38..62136ccff1df 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -18,11 +18,11 @@
#define MFD_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
-#define MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, _match) \
+#define MFD_CELL_ALL(_name, _nres, _res, _pdata, _id, _compat, _match) \
{ \
.name = (_name), \
.resources = (_res), \
- .num_resources = MFD_ARRAY_SIZE((_res)), \
+ .num_resources = (_nres), \
.platform_data = (_pdata), \
.pdata_size = MFD_ARRAY_SIZE((_pdata)), \
.of_compatible = (_compat), \
@@ -31,16 +31,19 @@
}
#define OF_MFD_CELL(_name, _res, _pdata, _id, _compat) \
- MFD_CELL_ALL(_name, _res, _pdata, _id, _compat, NULL) \
+ MFD_CELL_ALL(_name, MFD_ARRAY_SIZE((_res)), _res, \
+ _pdata, _id, _compat, NULL) \
#define ACPI_MFD_CELL(_name, _res, _pdata, _id, _match) \
- MFD_CELL_ALL(_name, _res, _pdata, _id, NULL, _match) \
+ MFD_CELL_ALL(_name, MFD_ARRAY_SIZE((_res)), _res, \
+ _pdata, _id, NULL, _match) \
#define MFD_CELL_BASIC(_name, _res, _pdata, _id) \
- MFD_CELL_ALL(_name, _res, _pdata, _id, NULL, NULL) \
+ MFD_CELL_ALL(_name, MFD_ARRAY_SIZE((_res)), _res, \
+ _pdata, _id, NULL, NULL) \
#define MFD_CELL_NAME(_name) \
- MFD_CELL_ALL(_name, NULL, NULL, 0, NULL, NULL) \
+ MFD_CELL_ALL(_name, 0, NULL, NULL, 0, NULL, NULL) \
struct irq_domain;
struct property_set;
--
1.9.1
next reply other threads:[~2016-02-18 18:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 18:52 Rhyland Klein [this message]
2016-02-19 8:50 ` Lee Jones
2016-02-19 16:28 ` Rhyland Klein
2016-02-26 16:35 ` Rhyland Klein
2016-02-29 12:38 ` Laxman Dewangan
2016-03-02 13:08 ` Lee Jones
2016-03-09 13:22 ` Laxman Dewangan
2016-03-11 8:39 ` Lee Jones
2016-03-11 8:57 ` Laxman Dewangan
2016-03-16 8:42 ` Lee Jones
2016-03-16 9:22 ` Laxman Dewangan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1455821558-28493-1-git-send-email-rklein@nvidia.com \
--to=rklein@nvidia.com \
--cc=ldewangan@nvidia.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®