From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: linux-acpi@vger.kernel.org
Cc: devicetree@vger.kernel.org, sudeep.holla@arm.com,
lorenzo.pieralisi@arm.com, mika.westerberg@linux.intel.com,
rafael@kernel.org, mark.rutland@arm.com, broonie@kernel.org,
robh@kernel.org, ahs3@redhat.com, frowand.list@gmail.com,
erik.veijola@intel.com, andriy.shevchenko@linux.intel.com
Subject: [PATCH v3 6/8] device property: Constify argument to pset fwnode backend
Date: Fri, 21 Jul 2017 14:39:35 +0300 [thread overview]
Message-ID: <1500637177-16095-7-git-send-email-sakari.ailus@linux.intel.com> (raw)
In-Reply-To: <1500637177-16095-1-git-send-email-sakari.ailus@linux.intel.com>
Internally constify pset fwnode backend. Do not touch the pset fwnode
operations yet.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
drivers/base/property.c | 36 ++++++++++++++++++++----------------
1 file changed, 20 insertions(+), 16 deletions(-)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 857e4d3..8fde824 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -27,19 +27,23 @@ struct property_set {
static const struct fwnode_operations pset_fwnode_ops;
-static inline bool is_pset_node(struct fwnode_handle *fwnode)
+static inline bool is_pset_node(const struct fwnode_handle *fwnode)
{
return !IS_ERR_OR_NULL(fwnode) && fwnode->ops == &pset_fwnode_ops;
}
-static inline struct property_set *to_pset_node(struct fwnode_handle *fwnode)
-{
- return is_pset_node(fwnode) ?
- container_of(fwnode, struct property_set, fwnode) : NULL;
-}
-
-static const struct property_entry *pset_prop_get(struct property_set *pset,
- const char *name)
+#define to_pset_node(__fwnode) \
+ ({ \
+ typeof(__fwnode) __to_pset_node_fwnode = __fwnode; \
+ \
+ is_pset_node(__to_pset_node_fwnode) ? \
+ container_of(__to_pset_node_fwnode, \
+ struct property_set, fwnode) : \
+ NULL; \
+ })
+
+static const struct property_entry *
+pset_prop_get(const struct property_set *pset, const char *name)
{
const struct property_entry *prop;
@@ -53,7 +57,7 @@ static const struct property_entry *pset_prop_get(struct property_set *pset,
return NULL;
}
-static const void *pset_prop_find(struct property_set *pset,
+static const void *pset_prop_find(const struct property_set *pset,
const char *propname, size_t length)
{
const struct property_entry *prop;
@@ -73,7 +77,7 @@ static const void *pset_prop_find(struct property_set *pset,
return pointer;
}
-static int pset_prop_read_u8_array(struct property_set *pset,
+static int pset_prop_read_u8_array(const struct property_set *pset,
const char *propname,
u8 *values, size_t nval)
{
@@ -88,7 +92,7 @@ static int pset_prop_read_u8_array(struct property_set *pset,
return 0;
}
-static int pset_prop_read_u16_array(struct property_set *pset,
+static int pset_prop_read_u16_array(const struct property_set *pset,
const char *propname,
u16 *values, size_t nval)
{
@@ -103,7 +107,7 @@ static int pset_prop_read_u16_array(struct property_set *pset,
return 0;
}
-static int pset_prop_read_u32_array(struct property_set *pset,
+static int pset_prop_read_u32_array(const struct property_set *pset,
const char *propname,
u32 *values, size_t nval)
{
@@ -118,7 +122,7 @@ static int pset_prop_read_u32_array(struct property_set *pset,
return 0;
}
-static int pset_prop_read_u64_array(struct property_set *pset,
+static int pset_prop_read_u64_array(const struct property_set *pset,
const char *propname,
u64 *values, size_t nval)
{
@@ -133,7 +137,7 @@ static int pset_prop_read_u64_array(struct property_set *pset,
return 0;
}
-static int pset_prop_count_elems_of_size(struct property_set *pset,
+static int pset_prop_count_elems_of_size(const struct property_set *pset,
const char *propname, size_t length)
{
const struct property_entry *prop;
@@ -145,7 +149,7 @@ static int pset_prop_count_elems_of_size(struct property_set *pset,
return prop->length / length;
}
-static int pset_prop_read_string_array(struct property_set *pset,
+static int pset_prop_read_string_array(const struct property_set *pset,
const char *propname,
const char **strings, size_t nval)
{
--
2.7.4
next prev parent reply other threads:[~2017-07-21 11:39 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 11:39 [PATCH v3 0/8] Remove fwnode type field, constify property fwnode arguments Sakari Ailus
2017-07-21 11:39 ` [PATCH v3 2/8] device property: Get rid of struct fwnode_handle type field Sakari Ailus
2017-07-21 11:39 ` [PATCH v3 3/8] ACPI: Prepare for constifying acpi_get_next_subnode() fwnode argument Sakari Ailus
2017-07-21 12:30 ` Andy Shevchenko
[not found] ` <1500637177-16095-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-21 11:39 ` [PATCH v3 1/8] ACPI: Use IS_ERR_OR_NULL() instead of non-NULL check in is_acpi_data_node Sakari Ailus
2017-07-21 11:59 ` Andy Shevchenko
2017-07-21 12:12 ` Andy Shevchenko
2017-07-21 11:39 ` [PATCH v3 4/8] ACPI: Constify acpi_bus helper functions, switch to macros Sakari Ailus
2017-07-21 11:52 ` [PATCH v3 0/8] Remove fwnode type field, constify property fwnode arguments Rafael J. Wysocki
2017-07-21 12:33 ` Andy Shevchenko
[not found] ` <1500640389.29303.177.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-21 12:29 ` Rafael J. Wysocki
2017-07-24 20:28 ` Rafael J. Wysocki
2017-08-08 9:32 ` Sakari Ailus
2017-08-09 0:53 ` Rafael J. Wysocki
2017-08-09 8:47 ` Sakari Ailus
2017-08-09 8:50 ` Sakari Ailus
2017-08-09 23:27 ` Rafael J. Wysocki
2017-07-21 11:39 ` [PATCH v3 5/8] ACPI: Constify internal " Sakari Ailus
2017-07-21 11:39 ` Sakari Ailus [this message]
2017-07-21 11:39 ` [PATCH v3 7/8] device property: Constify fwnode property API Sakari Ailus
2017-07-21 11:39 ` [PATCH v3 8/8] device property: Introduce fwnode_property_get_reference_args Sakari Ailus
[not found] ` <1500637177-16095-9-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-07-21 12:06 ` Andy Shevchenko
2017-07-21 12:11 ` [PATCH v3.1 " Sakari Ailus
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=1500637177-16095-7-git-send-email-sakari.ailus@linux.intel.com \
--to=sakari.ailus@linux.intel.com \
--cc=ahs3@redhat.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=erik.veijola@intel.com \
--cc=frowand.list@gmail.com \
--cc=linux-acpi@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mark.rutland@arm.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=sudeep.holla@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).