* [PATCH V5 2/7] ACPI / bus: Introduce acpi_get_match_data() function
[not found] ` <1512188864-773-1-git-send-email-okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2017-12-02 4:27 ` Sinan Kaya
2017-12-04 21:59 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Sinan Kaya @ 2017-12-02 4:27 UTC (permalink / raw)
To: dmaengine-u79uwXL29TY76Z2rM5mHXA, timur-sgV2jX0FEOL9JmXXK+q4OQ,
devicetree-u79uwXL29TY76Z2rM5mHXA
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Sinan Kaya,
Rafael J. Wysocki, Len Brown, open list:ACPI, open list
OF has of_device_get_match_data() function to extract driver specific data
structure. Add a similar function for ACPI.
Signed-off-by: Sinan Kaya <okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
drivers/acpi/bus.c | 13 +++++++++++++
include/linux/acpi.h | 8 ++++++++
2 files changed, 21 insertions(+)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 4d0979e..05d8d9a 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -785,6 +785,19 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
}
EXPORT_SYMBOL_GPL(acpi_match_device);
+void *acpi_get_match_data(struct acpi_device *device,
+ const struct acpi_device_id *ids)
+{
+ const struct acpi_device_id *match;
+
+ match = __acpi_match_device(device, ids, NULL);
+ if (!match)
+ return NULL;
+
+ return (void *)match->driver_data;
+}
+EXPORT_SYMBOL_GPL(acpi_get_match_data);
+
int acpi_match_device_ids(struct acpi_device *device,
const struct acpi_device_id *ids)
{
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 502af53..196bc7a 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -584,6 +584,8 @@ extern int acpi_nvs_for_each_region(int (*func)(__u64, __u64, void *),
const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids,
const struct device *dev);
+void *acpi_get_match_data(struct acpi_device *device,
+ const struct acpi_device_id *ids);
extern bool acpi_driver_match_device(struct device *dev,
const struct device_driver *drv);
int acpi_device_uevent_modalias(struct device *, struct kobj_uevent_env *);
@@ -755,6 +757,12 @@ static inline const struct acpi_device_id *acpi_match_device(
return NULL;
}
+static inline void *acpi_get_match_data(struct acpi_device *device,
+ const struct acpi_device_id *ids)
+{
+ return NULL;
+}
+
static inline bool acpi_driver_match_device(struct device *dev,
const struct device_driver *drv)
{
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V5 3/7] device property: Introduce a common API to fetch device match data
[not found] <1512188864-773-1-git-send-email-okaya@codeaurora.org>
[not found] ` <1512188864-773-1-git-send-email-okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
@ 2017-12-02 4:27 ` Sinan Kaya
2017-12-02 4:27 ` [PATCH V5 5/7] ACPI: properties: Implement get_match_data() callback Sinan Kaya
2 siblings, 0 replies; 5+ messages in thread
From: Sinan Kaya @ 2017-12-02 4:27 UTC (permalink / raw)
To: dmaengine, timur, devicetree
Cc: Rob Herring, linux-arm-msm, Dmitry Torokhov, Rafael J. Wysocki,
open list, Sinan Kaya, open list:ACPI, Kieran Bingham,
Sakari Ailus, Greg Kroah-Hartman, Mika Westerberg,
linux-arm-kernel, Len Brown
There is an OF/ACPI function to obtain the driver data. We want to hide
OF/ACPI details from the device drivers and abstract following the device
family of functions.
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
drivers/base/property.c | 7 +++++++
include/linux/fwnode.h | 4 ++++
include/linux/property.h | 2 ++
3 files changed, 13 insertions(+)
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 7ed99c1..dfc53af 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1335,3 +1335,10 @@ int fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
return fwnode_call_int_op(fwnode, graph_parse_endpoint, endpoint);
}
EXPORT_SYMBOL(fwnode_graph_parse_endpoint);
+
+void *device_get_match_data(struct device *dev)
+{
+ return fwnode_call_ptr_op(dev_fwnode(dev), get_match_data,
+ dev->driver);
+}
+EXPORT_SYMBOL_GPL(device_get_match_data);
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 0c35b6c..6e5e1dd 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -15,6 +15,7 @@
#include <linux/types.h>
struct fwnode_operations;
+struct device_driver;
struct fwnode_handle {
struct fwnode_handle *secondary;
@@ -66,6 +67,7 @@ struct fwnode_reference_args {
* endpoint node.
* @graph_get_port_parent: Return the parent node of a port node.
* @graph_parse_endpoint: Parse endpoint for port and endpoint id.
+ * @get_match_data: Return the driver match data.
*/
struct fwnode_operations {
void (*get)(struct fwnode_handle *fwnode);
@@ -101,6 +103,8 @@ struct fwnode_operations {
(*graph_get_port_parent)(struct fwnode_handle *fwnode);
int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
struct fwnode_endpoint *endpoint);
+ void *(*get_match_data)(const struct fwnode_handle *fwnode,
+ const struct device_driver *drv);
};
#define fwnode_has_op(fwnode, op) \
diff --git a/include/linux/property.h b/include/linux/property.h
index 6bebee1..01fa55b 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -275,6 +275,8 @@ int device_add_properties(struct device *dev,
enum dev_dma_attr device_get_dma_attr(struct device *dev);
+void *device_get_match_data(struct device *dev);
+
int device_get_phy_mode(struct device *dev);
void *device_get_mac_address(struct device *dev, char *addr, int alen);
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V5 5/7] ACPI: properties: Implement get_match_data() callback
[not found] <1512188864-773-1-git-send-email-okaya@codeaurora.org>
[not found] ` <1512188864-773-1-git-send-email-okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-12-02 4:27 ` [PATCH V5 3/7] device property: Introduce a common API to fetch device match data Sinan Kaya
@ 2017-12-02 4:27 ` Sinan Kaya
2 siblings, 0 replies; 5+ messages in thread
From: Sinan Kaya @ 2017-12-02 4:27 UTC (permalink / raw)
To: dmaengine, timur, devicetree
Cc: linux-arm-msm, linux-arm-kernel, Sinan Kaya, Rafael J. Wysocki,
Len Brown, open list:ACPI, open list
Now that we have a get_match_data() callback as part of the firmware node,
implement the ACPI specific piece for it.
Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
---
drivers/acpi/property.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index e26ea20..49dd50b 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1271,6 +1271,17 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
return 0;
}
+static void *acpi_fwnode_get_match_data(const struct fwnode_handle *fwnode,
+ const struct device_driver *drv)
+{
+ struct acpi_device *adev = to_acpi_device_node(fwnode);
+
+ if (!adev)
+ return NULL;
+
+ return acpi_get_match_data(adev, drv->acpi_match_table);
+}
+
#define DECLARE_ACPI_FWNODE_OPS(ops) \
const struct fwnode_operations ops = { \
.device_is_available = acpi_fwnode_device_is_available, \
@@ -1289,6 +1300,7 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
acpi_fwnode_graph_get_remote_endpoint, \
.graph_get_port_parent = acpi_fwnode_get_parent, \
.graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \
+ .get_match_data = acpi_fwnode_get_match_data, \
}; \
EXPORT_SYMBOL_GPL(ops)
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V5 2/7] ACPI / bus: Introduce acpi_get_match_data() function
2017-12-02 4:27 ` [PATCH V5 2/7] ACPI / bus: Introduce acpi_get_match_data() function Sinan Kaya
@ 2017-12-04 21:59 ` Rafael J. Wysocki
2017-12-04 22:01 ` Sinan Kaya
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2017-12-04 21:59 UTC (permalink / raw)
To: Sinan Kaya
Cc: dmaengine, Timur Tabi, devicetree@vger.kernel.org, linux-arm-msm,
linux-arm-kernel@lists.infradead.org, Rafael J. Wysocki,
Len Brown, open list:ACPI, open list
On Sat, Dec 2, 2017 at 5:27 AM, Sinan Kaya <okaya@codeaurora.org> wrote:
> OF has of_device_get_match_data() function to extract driver specific data
> structure. Add a similar function for ACPI.
>
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
Haven't I ACKed this already?
Anyway, please resend the whole series with a CC to linux-acpi.
Thanks,
Rafael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V5 2/7] ACPI / bus: Introduce acpi_get_match_data() function
2017-12-04 21:59 ` Rafael J. Wysocki
@ 2017-12-04 22:01 ` Sinan Kaya
0 siblings, 0 replies; 5+ messages in thread
From: Sinan Kaya @ 2017-12-04 22:01 UTC (permalink / raw)
To: Rafael J. Wysocki
Cc: dmaengine, Timur Tabi, devicetree@vger.kernel.org, linux-arm-msm,
linux-arm-kernel@lists.infradead.org, Rafael J. Wysocki,
Len Brown, open list:ACPI, open list
On 12/4/2017 4:59 PM, Rafael J. Wysocki wrote:
> On Sat, Dec 2, 2017 at 5:27 AM, Sinan Kaya <okaya@codeaurora.org> wrote:
>> OF has of_device_get_match_data() function to extract driver specific data
>> structure. Add a similar function for ACPI.
>>
>> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
>
> Haven't I ACKed this already?
>
> Anyway, please resend the whole series with a CC to linux-acpi.
Yeah, you acked the previous one. Then, I changed the calling parameter from
struct device to struct acpi_device and removed your ACK.
--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-12-04 22:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1512188864-773-1-git-send-email-okaya@codeaurora.org>
[not found] ` <1512188864-773-1-git-send-email-okaya-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-12-02 4:27 ` [PATCH V5 2/7] ACPI / bus: Introduce acpi_get_match_data() function Sinan Kaya
2017-12-04 21:59 ` Rafael J. Wysocki
2017-12-04 22:01 ` Sinan Kaya
2017-12-02 4:27 ` [PATCH V5 3/7] device property: Introduce a common API to fetch device match data Sinan Kaya
2017-12-02 4:27 ` [PATCH V5 5/7] ACPI: properties: Implement get_match_data() callback Sinan Kaya
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).