linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Shovel firmware specific code to appropriate locations
@ 2022-02-06  9:16 Sakari Ailus
  2022-02-06  9:16 ` [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode Sakari Ailus
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Sakari Ailus @ 2022-02-06  9:16 UTC (permalink / raw)
  To: linux-acpi
  Cc: andriy.shevchenko, devicetree, Rafael J. Wysocki, Daniel Scally,
	Heikki Krogerus, Rob Herring, Frank Rowand

Hi folks,

This set moves the implementation of recently added device property API
functions to OF and ACPI frameworks, where the rest of such functionality
resides.

Compile tested.

Note that after some initial confusion, this set actually does depend on
Andy's patch "device property: Don't split fwnode_get_irq*() APIs in the
code" to appear in the linux-acpi tree.

Sakari Ailus (4):
  device property: Convert device_{dma_supported,get_dma_attr} to fwnode
  ACPI: property: Move acpi_fwnode_device_get_match_data() up
  device property: Add iomap to fwnode operations
  device property: Add irq_get to fwnode operation

 drivers/acpi/property.c | 36 +++++++++++++++++++++++++++++++----
 drivers/base/property.c | 42 ++++++-----------------------------------
 drivers/of/property.c   | 31 ++++++++++++++++++++++++++++++
 include/linux/fwnode.h  |  5 +++++
 4 files changed, 74 insertions(+), 40 deletions(-)

-- 
2.30.2



^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode
  2022-02-06  9:16 [PATCH 0/4] Shovel firmware specific code to appropriate locations Sakari Ailus
@ 2022-02-06  9:16 ` Sakari Ailus
  2022-02-07 12:20   ` Andy Shevchenko
  2022-02-11 15:55   ` Rob Herring
  2022-02-06  9:16 ` [PATCH 2/4] ACPI: property: Move acpi_fwnode_device_get_match_data() up Sakari Ailus
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 15+ messages in thread
From: Sakari Ailus @ 2022-02-06  9:16 UTC (permalink / raw)
  To: linux-acpi
  Cc: andriy.shevchenko, devicetree, Rafael J. Wysocki, Daniel Scally,
	Heikki Krogerus, Rob Herring, Frank Rowand

Make the device_dma_supported and device_get_dma_attr functions to use the
fwnode ops, and move the implementation to ACPI and OF frameworks.

Depends-on: ("device property: Don't split fwnode_get_irq*() APIs in the code")
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/acpi/property.c | 14 ++++++++++++++
 drivers/base/property.c | 25 ++++---------------------
 drivers/of/property.c   | 17 +++++++++++++++++
 include/linux/fwnode.h  |  3 +++
 4 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index d0986bda2964..1541b318ba46 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1253,6 +1253,17 @@ static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)
 	return acpi_device_is_present(to_acpi_device_node(fwnode));
 }
 
+static bool acpi_fwnode_device_dma_supported(const struct fwnode_handle *fwnode)
+{
+	return acpi_dma_supported(to_acpi_device_node(fwnode));
+}
+
+static enum dev_dma_attr
+acpi_fwnode_device_get_dma_attr(const struct fwnode_handle *fwnode)
+{
+	return acpi_get_dma_attr(to_acpi_device_node(fwnode));
+}
+
 static bool acpi_fwnode_property_present(const struct fwnode_handle *fwnode,
 					 const char *propname)
 {
@@ -1384,6 +1395,9 @@ acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
 	const struct fwnode_operations ops = {				\
 		.device_is_available = acpi_fwnode_device_is_available, \
 		.device_get_match_data = acpi_fwnode_device_get_match_data, \
+		.device_dma_supported =				\
+			acpi_fwnode_device_dma_supported,		\
+		.device_get_dma_attr = acpi_fwnode_device_get_dma_attr,	\
 		.property_present = acpi_fwnode_property_present,	\
 		.property_read_int_array =				\
 			acpi_fwnode_property_read_int_array,		\
diff --git a/drivers/base/property.c b/drivers/base/property.c
index c0e94cce9c29..09686e2e903e 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -823,33 +823,16 @@ EXPORT_SYMBOL_GPL(device_get_child_node_count);
 
 bool device_dma_supported(struct device *dev)
 {
-	const struct fwnode_handle *fwnode = dev_fwnode(dev);
-
-	/* For DT, this is always supported.
-	 * For ACPI, this depends on CCA, which
-	 * is determined by the acpi_dma_supported().
-	 */
-	if (is_of_node(fwnode))
-		return true;
-
-	return acpi_dma_supported(to_acpi_device_node(fwnode));
+	return fwnode_call_bool_op(dev_fwnode(dev), device_dma_supported);
 }
 EXPORT_SYMBOL_GPL(device_dma_supported);
 
 enum dev_dma_attr device_get_dma_attr(struct device *dev)
 {
-	const struct fwnode_handle *fwnode = dev_fwnode(dev);
-	enum dev_dma_attr attr = DEV_DMA_NOT_SUPPORTED;
-
-	if (is_of_node(fwnode)) {
-		if (of_dma_is_coherent(to_of_node(fwnode)))
-			attr = DEV_DMA_COHERENT;
-		else
-			attr = DEV_DMA_NON_COHERENT;
-	} else
-		attr = acpi_get_dma_attr(to_acpi_device_node(fwnode));
+	if (!fwnode_has_op(dev_fwnode(dev), device_get_dma_attr))
+		return DEV_DMA_NOT_SUPPORTED;
 
-	return attr;
+	return fwnode_call_int_op(dev_fwnode(dev), device_get_dma_attr);
 }
 EXPORT_SYMBOL_GPL(device_get_dma_attr);
 
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 8e90071de6ed..676899566f7c 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -22,6 +22,7 @@
 #define pr_fmt(fmt)	"OF: " fmt
 
 #include <linux/of.h>
+#include <linux/of_address.h>
 #include <linux/of_device.h>
 #include <linux/of_graph.h>
 #include <linux/of_irq.h>
@@ -872,6 +873,20 @@ static bool of_fwnode_device_is_available(const struct fwnode_handle *fwnode)
 	return of_device_is_available(to_of_node(fwnode));
 }
 
+static bool of_fwnode_device_dma_supported(const struct fwnode_handle *fwnode)
+{
+	return true;
+}
+
+static enum dev_dma_attr
+of_fwnode_device_get_dma_attr(const struct fwnode_handle *fwnode)
+{
+	if (of_dma_is_coherent(to_of_node(fwnode)))
+		return DEV_DMA_COHERENT;
+	else
+		return DEV_DMA_NON_COHERENT;
+}
+
 static bool of_fwnode_property_present(const struct fwnode_handle *fwnode,
 				       const char *propname)
 {
@@ -1472,6 +1487,8 @@ const struct fwnode_operations of_fwnode_ops = {
 	.put = of_fwnode_put,
 	.device_is_available = of_fwnode_device_is_available,
 	.device_get_match_data = of_fwnode_device_get_match_data,
+	.device_dma_supported = of_fwnode_device_dma_supported,
+	.device_get_dma_attr = of_fwnode_device_get_dma_attr,
 	.property_present = of_fwnode_property_present,
 	.property_read_int_array = of_fwnode_property_read_int_array,
 	.property_read_string_array = of_fwnode_property_read_string_array,
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 3a532ba66f6c..6f307f21fc65 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -113,6 +113,9 @@ struct fwnode_operations {
 	bool (*device_is_available)(const struct fwnode_handle *fwnode);
 	const void *(*device_get_match_data)(const struct fwnode_handle *fwnode,
 					     const struct device *dev);
+	bool (*device_dma_supported)(const struct fwnode_handle *fwnode);
+	enum dev_dma_attr
+	(*device_get_dma_attr)(const struct fwnode_handle *fwnode);
 	bool (*property_present)(const struct fwnode_handle *fwnode,
 				 const char *propname);
 	int (*property_read_int_array)(const struct fwnode_handle *fwnode,
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 2/4] ACPI: property: Move acpi_fwnode_device_get_match_data() up
  2022-02-06  9:16 [PATCH 0/4] Shovel firmware specific code to appropriate locations Sakari Ailus
  2022-02-06  9:16 ` [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode Sakari Ailus
@ 2022-02-06  9:16 ` Sakari Ailus
  2022-02-06  9:16 ` [PATCH 3/4] device property: Add iomap to fwnode operations Sakari Ailus
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 15+ messages in thread
From: Sakari Ailus @ 2022-02-06  9:16 UTC (permalink / raw)
  To: linux-acpi
  Cc: andriy.shevchenko, devicetree, Rafael J. Wysocki, Daniel Scally,
	Heikki Krogerus, Rob Herring, Frank Rowand

Move acpi_fwnode_device_get_match_data() up below
acpi_fwnode_device_is_available() so the order matches that in struct
fwnode_operations.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/acpi/property.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 1541b318ba46..75dc22c117a5 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1253,6 +1253,13 @@ static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)
 	return acpi_device_is_present(to_acpi_device_node(fwnode));
 }
 
+static const void *
+acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
+				  const struct device *dev)
+{
+	return acpi_device_get_match_data(dev);
+}
+
 static bool acpi_fwnode_device_dma_supported(const struct fwnode_handle *fwnode)
 {
 	return acpi_dma_supported(to_acpi_device_node(fwnode));
@@ -1384,13 +1391,6 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
 	return 0;
 }
 
-static const void *
-acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
-				  const struct device *dev)
-{
-	return acpi_device_get_match_data(dev);
-}
-
 #define DECLARE_ACPI_FWNODE_OPS(ops) \
 	const struct fwnode_operations ops = {				\
 		.device_is_available = acpi_fwnode_device_is_available, \
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 3/4] device property: Add iomap to fwnode operations
  2022-02-06  9:16 [PATCH 0/4] Shovel firmware specific code to appropriate locations Sakari Ailus
  2022-02-06  9:16 ` [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode Sakari Ailus
  2022-02-06  9:16 ` [PATCH 2/4] ACPI: property: Move acpi_fwnode_device_get_match_data() up Sakari Ailus
@ 2022-02-06  9:16 ` Sakari Ailus
  2022-02-11 15:59   ` Rob Herring
  2022-02-06  9:16 ` [PATCH 4/4] device property: Add irq_get to fwnode operation Sakari Ailus
  2022-02-07 12:27 ` [PATCH 0/4] Shovel firmware specific code to appropriate locations Andy Shevchenko
  4 siblings, 1 reply; 15+ messages in thread
From: Sakari Ailus @ 2022-02-06  9:16 UTC (permalink / raw)
  To: linux-acpi
  Cc: andriy.shevchenko, devicetree, Rafael J. Wysocki, Daniel Scally,
	Heikki Krogerus, Rob Herring, Frank Rowand

Add iomap() fwnode operation to implement fwnode_iomap() through fwnode
operations, moving the code in fwnode_iomap() to OF framework.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/base/property.c | 5 +----
 drivers/of/property.c   | 7 +++++++
 include/linux/fwnode.h  | 1 +
 3 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 09686e2e903e..83dd22e7cb81 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -887,10 +887,7 @@ EXPORT_SYMBOL_GPL(device_get_phy_mode);
  */
 void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
 {
-	if (IS_ENABLED(CONFIG_OF_ADDRESS) && is_of_node(fwnode))
-		return of_iomap(to_of_node(fwnode), index);
-
-	return NULL;
+	return fwnode_call_ptr_op(fwnode, iomap, index);
 }
 EXPORT_SYMBOL(fwnode_iomap);
 
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 676899566f7c..8beb89709740 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1465,6 +1465,12 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)
 	return 0;
 }
 
+static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index)
+{
+	return IS_ENABLED(CONFIG_OF_ADDRESS) ?
+		of_iomap(to_of_node(fwnode), index) : NULL;
+}
+
 static int of_fwnode_add_links(struct fwnode_handle *fwnode)
 {
 	struct property *p;
@@ -1502,6 +1508,7 @@ const struct fwnode_operations of_fwnode_ops = {
 	.graph_get_remote_endpoint = of_fwnode_graph_get_remote_endpoint,
 	.graph_get_port_parent = of_fwnode_graph_get_port_parent,
 	.graph_parse_endpoint = of_fwnode_graph_parse_endpoint,
+	.iomap = of_fwnode_iomap,
 	.add_links = of_fwnode_add_links,
 };
 EXPORT_SYMBOL_GPL(of_fwnode_ops);
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index 6f307f21fc65..ebbc3bf03f95 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -148,6 +148,7 @@ 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 __iomem *(*iomap)(struct fwnode_handle *fwnode, int index);
 	int (*add_links)(struct fwnode_handle *fwnode);
 };
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* [PATCH 4/4] device property: Add irq_get to fwnode operation
  2022-02-06  9:16 [PATCH 0/4] Shovel firmware specific code to appropriate locations Sakari Ailus
                   ` (2 preceding siblings ...)
  2022-02-06  9:16 ` [PATCH 3/4] device property: Add iomap to fwnode operations Sakari Ailus
@ 2022-02-06  9:16 ` Sakari Ailus
  2022-02-11 16:02   ` Rob Herring
  2022-02-07 12:27 ` [PATCH 0/4] Shovel firmware specific code to appropriate locations Andy Shevchenko
  4 siblings, 1 reply; 15+ messages in thread
From: Sakari Ailus @ 2022-02-06  9:16 UTC (permalink / raw)
  To: linux-acpi
  Cc: andriy.shevchenko, devicetree, Rafael J. Wysocki, Daniel Scally,
	Heikki Krogerus, Rob Herring, Frank Rowand

Add irq_get() fwnode operation to implement fwnode_irq_get() through
fwnode operations, moving the code in fwnode_irq_get() to OF and ACPI
frameworks.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 drivers/acpi/property.c | 14 ++++++++++++++
 drivers/base/property.c | 12 +-----------
 drivers/of/property.c   |  7 +++++++
 include/linux/fwnode.h  |  1 +
 4 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
index 75dc22c117a5..1ad5f097c33a 100644
--- a/drivers/acpi/property.c
+++ b/drivers/acpi/property.c
@@ -1391,6 +1391,19 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
 	return 0;
 }
 
+static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode,
+			       unsigned int index)
+{
+	struct resource res;
+	int ret;
+
+	ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
+	if (ret)
+		return ret;
+
+	return res.start;
+}
+
 #define DECLARE_ACPI_FWNODE_OPS(ops) \
 	const struct fwnode_operations ops = {				\
 		.device_is_available = acpi_fwnode_device_is_available, \
@@ -1415,6 +1428,7 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode,
 			acpi_graph_get_remote_endpoint,			\
 		.graph_get_port_parent = acpi_fwnode_get_parent,	\
 		.graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \
+		.irq_get = acpi_fwnode_irq_get,				\
 	};								\
 	EXPORT_SYMBOL_GPL(ops)
 
diff --git a/drivers/base/property.c b/drivers/base/property.c
index 83dd22e7cb81..3560c4419d11 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -901,17 +901,7 @@ EXPORT_SYMBOL(fwnode_iomap);
  */
 int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
 {
-	struct resource res;
-	int ret;
-
-	if (is_of_node(fwnode))
-		return of_irq_get(to_of_node(fwnode), index);
-
-	ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res);
-	if (ret)
-		return ret;
-
-	return res.start;
+	return fwnode_call_int_op(fwnode, irq_get, index);
 }
 EXPORT_SYMBOL(fwnode_irq_get);
 
diff --git a/drivers/of/property.c b/drivers/of/property.c
index 8beb89709740..8a736bac56b9 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -1471,6 +1471,12 @@ static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index)
 		of_iomap(to_of_node(fwnode), index) : NULL;
 }
 
+static int of_fwnode_irq_get(const struct fwnode_handle *fwnode,
+			     unsigned int index)
+{
+	return of_irq_get(to_of_node(fwnode), index);
+}
+
 static int of_fwnode_add_links(struct fwnode_handle *fwnode)
 {
 	struct property *p;
@@ -1509,6 +1515,7 @@ const struct fwnode_operations of_fwnode_ops = {
 	.graph_get_port_parent = of_fwnode_graph_get_port_parent,
 	.graph_parse_endpoint = of_fwnode_graph_parse_endpoint,
 	.iomap = of_fwnode_iomap,
+	.irq_get = of_fwnode_irq_get,
 	.add_links = of_fwnode_add_links,
 };
 EXPORT_SYMBOL_GPL(of_fwnode_ops);
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
index ebbc3bf03f95..6ab69871b06d 100644
--- a/include/linux/fwnode.h
+++ b/include/linux/fwnode.h
@@ -149,6 +149,7 @@ struct fwnode_operations {
 	int (*graph_parse_endpoint)(const struct fwnode_handle *fwnode,
 				    struct fwnode_endpoint *endpoint);
 	void __iomem *(*iomap)(struct fwnode_handle *fwnode, int index);
+	int (*irq_get)(const struct fwnode_handle *fwnode, unsigned int index);
 	int (*add_links)(struct fwnode_handle *fwnode);
 };
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode
  2022-02-06  9:16 ` [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode Sakari Ailus
@ 2022-02-07 12:20   ` Andy Shevchenko
  2022-02-11 15:55   ` Rob Herring
  1 sibling, 0 replies; 15+ messages in thread
From: Andy Shevchenko @ 2022-02-07 12:20 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: linux-acpi, devicetree, Rafael J. Wysocki, Daniel Scally,
	Heikki Krogerus, Rob Herring, Frank Rowand

On Sun, Feb 06, 2022 at 11:16:40AM +0200, Sakari Ailus wrote:
> Make the device_dma_supported and device_get_dma_attr functions to use the
> fwnode ops, and move the implementation to ACPI and OF frameworks.
> 
> Depends-on: ("device property: Don't split fwnode_get_irq*() APIs in the code")

As of today: ffa743d3f33b, but might be changed in case of rebase happens in
the future.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/4] Shovel firmware specific code to appropriate locations
  2022-02-06  9:16 [PATCH 0/4] Shovel firmware specific code to appropriate locations Sakari Ailus
                   ` (3 preceding siblings ...)
  2022-02-06  9:16 ` [PATCH 4/4] device property: Add irq_get to fwnode operation Sakari Ailus
@ 2022-02-07 12:27 ` Andy Shevchenko
  2022-02-07 14:41   ` Sakari Ailus
  4 siblings, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2022-02-07 12:27 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: linux-acpi, devicetree, Rafael J. Wysocki, Daniel Scally,
	Heikki Krogerus, Rob Herring, Frank Rowand

On Sun, Feb 06, 2022 at 11:16:39AM +0200, Sakari Ailus wrote:
> Hi folks,
> 
> This set moves the implementation of recently added device property API
> functions to OF and ACPI frameworks, where the rest of such functionality
> resides.
> 
> Compile tested.

All look good to me,
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> Note that after some initial confusion, this set actually does depend on
> Andy's patch "device property: Don't split fwnode_get_irq*() APIs in the
> code" to appear in the linux-acpi tree.

Perhaps than you can add to your series the conversion of
fwnode_irq_get_byname()?

> Sakari Ailus (4):
>   device property: Convert device_{dma_supported,get_dma_attr} to fwnode
>   ACPI: property: Move acpi_fwnode_device_get_match_data() up
>   device property: Add iomap to fwnode operations
>   device property: Add irq_get to fwnode operation
> 
>  drivers/acpi/property.c | 36 +++++++++++++++++++++++++++++++----
>  drivers/base/property.c | 42 ++++++-----------------------------------
>  drivers/of/property.c   | 31 ++++++++++++++++++++++++++++++
>  include/linux/fwnode.h  |  5 +++++
>  4 files changed, 74 insertions(+), 40 deletions(-)
> 
> -- 
> 2.30.2
> 
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/4] Shovel firmware specific code to appropriate locations
  2022-02-07 12:27 ` [PATCH 0/4] Shovel firmware specific code to appropriate locations Andy Shevchenko
@ 2022-02-07 14:41   ` Sakari Ailus
  0 siblings, 0 replies; 15+ messages in thread
From: Sakari Ailus @ 2022-02-07 14:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-acpi, devicetree, Rafael J. Wysocki, Daniel Scally,
	Heikki Krogerus, Rob Herring, Frank Rowand

Hi Andy,

On Mon, Feb 07, 2022 at 02:27:43PM +0200, Andy Shevchenko wrote:
> On Sun, Feb 06, 2022 at 11:16:39AM +0200, Sakari Ailus wrote:
> > Hi folks,
> > 
> > This set moves the implementation of recently added device property API
> > functions to OF and ACPI frameworks, where the rest of such functionality
> > resides.
> > 
> > Compile tested.
> 
> All look good to me,
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Thanks!

> > Note that after some initial confusion, this set actually does depend on
> > Andy's patch "device property: Don't split fwnode_get_irq*() APIs in the
> > code" to appear in the linux-acpi tree.
> 
> Perhaps than you can add to your series the conversion of
> fwnode_irq_get_byname()?

It relies on other fwnode functions to do its job so there's nothing to fix
there.

-- 
Kind regards,

Sakari Ailus

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode
  2022-02-06  9:16 ` [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode Sakari Ailus
  2022-02-07 12:20   ` Andy Shevchenko
@ 2022-02-11 15:55   ` Rob Herring
  2022-02-11 16:18     ` Andy Shevchenko
  2022-02-14 13:31     ` Sakari Ailus
  1 sibling, 2 replies; 15+ messages in thread
From: Rob Herring @ 2022-02-11 15:55 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: linux-acpi, andriy.shevchenko, devicetree, Rafael J. Wysocki,
	Daniel Scally, Heikki Krogerus, Frank Rowand

On Sun, Feb 06, 2022 at 11:16:40AM +0200, Sakari Ailus wrote:
> Make the device_dma_supported and device_get_dma_attr functions to use the
> fwnode ops, and move the implementation to ACPI and OF frameworks.
> 
> Depends-on: ("device property: Don't split fwnode_get_irq*() APIs in the code")

Is this some new convention? What's wrong with 'base-commit' and 
shouldn't it be below the '---'?

> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/acpi/property.c | 14 ++++++++++++++
>  drivers/base/property.c | 25 ++++---------------------
>  drivers/of/property.c   | 17 +++++++++++++++++
>  include/linux/fwnode.h  |  3 +++
>  4 files changed, 38 insertions(+), 21 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] device property: Add iomap to fwnode operations
  2022-02-06  9:16 ` [PATCH 3/4] device property: Add iomap to fwnode operations Sakari Ailus
@ 2022-02-11 15:59   ` Rob Herring
  2022-02-14 10:31     ` Sakari Ailus
  0 siblings, 1 reply; 15+ messages in thread
From: Rob Herring @ 2022-02-11 15:59 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: linux-acpi, andriy.shevchenko, devicetree, Rafael J. Wysocki,
	Daniel Scally, Heikki Krogerus, Frank Rowand

On Sun, Feb 06, 2022 at 11:16:42AM +0200, Sakari Ailus wrote:
> Add iomap() fwnode operation to implement fwnode_iomap() through fwnode
> operations, moving the code in fwnode_iomap() to OF framework.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/base/property.c | 5 +----
>  drivers/of/property.c   | 7 +++++++
>  include/linux/fwnode.h  | 1 +
>  3 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 09686e2e903e..83dd22e7cb81 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -887,10 +887,7 @@ EXPORT_SYMBOL_GPL(device_get_phy_mode);
>   */
>  void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
>  {
> -	if (IS_ENABLED(CONFIG_OF_ADDRESS) && is_of_node(fwnode))
> -		return of_iomap(to_of_node(fwnode), index);
> -
> -	return NULL;
> +	return fwnode_call_ptr_op(fwnode, iomap, index);
>  }
>  EXPORT_SYMBOL(fwnode_iomap);
>  
> diff --git a/drivers/of/property.c b/drivers/of/property.c
> index 676899566f7c..8beb89709740 100644
> --- a/drivers/of/property.c
> +++ b/drivers/of/property.c
> @@ -1465,6 +1465,12 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)
>  	return 0;
>  }
>  
> +static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index)
> +{
> +	return IS_ENABLED(CONFIG_OF_ADDRESS) ?

I think this shouldn't be needed. !OF_ADDRESS is Sparc which just has 
its own implementation of of_iomap().

> +		of_iomap(to_of_node(fwnode), index) : NULL;
> +}
> +
>  static int of_fwnode_add_links(struct fwnode_handle *fwnode)
>  {
>  	struct property *p;
> @@ -1502,6 +1508,7 @@ const struct fwnode_operations of_fwnode_ops = {
>  	.graph_get_remote_endpoint = of_fwnode_graph_get_remote_endpoint,
>  	.graph_get_port_parent = of_fwnode_graph_get_port_parent,
>  	.graph_parse_endpoint = of_fwnode_graph_parse_endpoint,
> +	.iomap = of_fwnode_iomap,
>  	.add_links = of_fwnode_add_links,
>  };
>  EXPORT_SYMBOL_GPL(of_fwnode_ops);
> diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h
> index 6f307f21fc65..ebbc3bf03f95 100644
> --- a/include/linux/fwnode.h
> +++ b/include/linux/fwnode.h
> @@ -148,6 +148,7 @@ 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 __iomem *(*iomap)(struct fwnode_handle *fwnode, int index);
>  	int (*add_links)(struct fwnode_handle *fwnode);
>  };
>  
> -- 
> 2.30.2
> 
> 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 4/4] device property: Add irq_get to fwnode operation
  2022-02-06  9:16 ` [PATCH 4/4] device property: Add irq_get to fwnode operation Sakari Ailus
@ 2022-02-11 16:02   ` Rob Herring
  0 siblings, 0 replies; 15+ messages in thread
From: Rob Herring @ 2022-02-11 16:02 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: devicetree, linux-acpi, andriy.shevchenko, Rafael J. Wysocki,
	Rob Herring, Frank Rowand, Daniel Scally, Heikki Krogerus

On Sun, 06 Feb 2022 11:16:43 +0200, Sakari Ailus wrote:
> Add irq_get() fwnode operation to implement fwnode_irq_get() through
> fwnode operations, moving the code in fwnode_irq_get() to OF and ACPI
> frameworks.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  drivers/acpi/property.c | 14 ++++++++++++++
>  drivers/base/property.c | 12 +-----------
>  drivers/of/property.c   |  7 +++++++
>  include/linux/fwnode.h  |  1 +
>  4 files changed, 23 insertions(+), 11 deletions(-)
> 

Acked-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode
  2022-02-11 15:55   ` Rob Herring
@ 2022-02-11 16:18     ` Andy Shevchenko
  2022-03-08 15:50       ` Rob Herring
  2022-02-14 13:31     ` Sakari Ailus
  1 sibling, 1 reply; 15+ messages in thread
From: Andy Shevchenko @ 2022-02-11 16:18 UTC (permalink / raw)
  To: Rob Herring
  Cc: Sakari Ailus, linux-acpi, devicetree, Rafael J. Wysocki,
	Daniel Scally, Heikki Krogerus, Frank Rowand

On Fri, Feb 11, 2022 at 09:55:22AM -0600, Rob Herring wrote:
> On Sun, Feb 06, 2022 at 11:16:40AM +0200, Sakari Ailus wrote:
> > Make the device_dma_supported and device_get_dma_attr functions to use the
> > fwnode ops, and move the implementation to ACPI and OF frameworks.
> > 
> > Depends-on: ("device property: Don't split fwnode_get_irq*() APIs in the code")
> 
> Is this some new convention?

% git log --oneline --no-merges --grep Depends-on | wc -l
83

Or I misunderstood your question?

> What's wrong with 'base-commit' and 
> shouldn't it be below the '---'?

There is no guarantee with the SHA to be the same in either cases, it can be
filled later with a proper one.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 3/4] device property: Add iomap to fwnode operations
  2022-02-11 15:59   ` Rob Herring
@ 2022-02-14 10:31     ` Sakari Ailus
  0 siblings, 0 replies; 15+ messages in thread
From: Sakari Ailus @ 2022-02-14 10:31 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-acpi, andriy.shevchenko, devicetree, Rafael J. Wysocki,
	Daniel Scally, Heikki Krogerus, Frank Rowand

Hi Rob,

Thanks for the review.

On Fri, Feb 11, 2022 at 09:59:42AM -0600, Rob Herring wrote:
> On Sun, Feb 06, 2022 at 11:16:42AM +0200, Sakari Ailus wrote:
> > Add iomap() fwnode operation to implement fwnode_iomap() through fwnode
> > operations, moving the code in fwnode_iomap() to OF framework.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> >  drivers/base/property.c | 5 +----
> >  drivers/of/property.c   | 7 +++++++
> >  include/linux/fwnode.h  | 1 +
> >  3 files changed, 9 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/base/property.c b/drivers/base/property.c
> > index 09686e2e903e..83dd22e7cb81 100644
> > --- a/drivers/base/property.c
> > +++ b/drivers/base/property.c
> > @@ -887,10 +887,7 @@ EXPORT_SYMBOL_GPL(device_get_phy_mode);
> >   */
> >  void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
> >  {
> > -	if (IS_ENABLED(CONFIG_OF_ADDRESS) && is_of_node(fwnode))
> > -		return of_iomap(to_of_node(fwnode), index);
> > -
> > -	return NULL;
> > +	return fwnode_call_ptr_op(fwnode, iomap, index);
> >  }
> >  EXPORT_SYMBOL(fwnode_iomap);
> >  
> > diff --git a/drivers/of/property.c b/drivers/of/property.c
> > index 676899566f7c..8beb89709740 100644
> > --- a/drivers/of/property.c
> > +++ b/drivers/of/property.c
> > @@ -1465,6 +1465,12 @@ static int of_link_property(struct device_node *con_np, const char *prop_name)
> >  	return 0;
> >  }
> >  
> > +static void __iomem *of_fwnode_iomap(struct fwnode_handle *fwnode, int index)
> > +{
> > +	return IS_ENABLED(CONFIG_OF_ADDRESS) ?
> 
> I think this shouldn't be needed. !OF_ADDRESS is Sparc which just has 
> its own implementation of of_iomap().

I'll drop it for v2.

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode
  2022-02-11 15:55   ` Rob Herring
  2022-02-11 16:18     ` Andy Shevchenko
@ 2022-02-14 13:31     ` Sakari Ailus
  1 sibling, 0 replies; 15+ messages in thread
From: Sakari Ailus @ 2022-02-14 13:31 UTC (permalink / raw)
  To: Rob Herring
  Cc: linux-acpi, andriy.shevchenko, devicetree, Rafael J. Wysocki,
	Daniel Scally, Heikki Krogerus, Frank Rowand

Hi Rob,

On Fri, Feb 11, 2022 at 09:55:22AM -0600, Rob Herring wrote:
> On Sun, Feb 06, 2022 at 11:16:40AM +0200, Sakari Ailus wrote:
> > Make the device_dma_supported and device_get_dma_attr functions to use the
> > fwnode ops, and move the implementation to ACPI and OF frameworks.
> > 
> > Depends-on: ("device property: Don't split fwnode_get_irq*() APIs in the code")
> 
> Is this some new convention? What's wrong with 'base-commit' and 
> shouldn't it be below the '---'?

I guess that could be possible, too. There are different practices it
seems.

I'll add commit id in v2 (or drop the tag if the dependent patch hits the
linux-acpi tree soonish).

> 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> >  drivers/acpi/property.c | 14 ++++++++++++++
> >  drivers/base/property.c | 25 ++++---------------------
> >  drivers/of/property.c   | 17 +++++++++++++++++
> >  include/linux/fwnode.h  |  3 +++
> >  4 files changed, 38 insertions(+), 21 deletions(-)
> 
> Acked-by: Rob Herring <robh@kernel.org>

Thanks!

-- 
Sakari Ailus

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode
  2022-02-11 16:18     ` Andy Shevchenko
@ 2022-03-08 15:50       ` Rob Herring
  0 siblings, 0 replies; 15+ messages in thread
From: Rob Herring @ 2022-03-08 15:50 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Sakari Ailus, open list:ACPI FOR ARM64 (ACPI/arm64),
	devicetree, Rafael J. Wysocki, Daniel Scally, Heikki Krogerus,
	Frank Rowand

On Fri, Feb 11, 2022 at 10:19 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Fri, Feb 11, 2022 at 09:55:22AM -0600, Rob Herring wrote:
> > On Sun, Feb 06, 2022 at 11:16:40AM +0200, Sakari Ailus wrote:
> > > Make the device_dma_supported and device_get_dma_attr functions to use the
> > > fwnode ops, and move the implementation to ACPI and OF frameworks.
> > >
> > > Depends-on: ("device property: Don't split fwnode_get_irq*() APIs in the code")
> >
> > Is this some new convention?
>
> % git log --oneline --no-merges --grep Depends-on | wc -l
> 83

With 10k+ commits per cycle that's not really compelling.

> Or I misunderstood your question?

% git grep 'Depends-on' | wc -l
0

What I mean is where's the documentation for using this? Or even a discussion?

Rob

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-03-08 15:50 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-06  9:16 [PATCH 0/4] Shovel firmware specific code to appropriate locations Sakari Ailus
2022-02-06  9:16 ` [PATCH 1/4] device property: Convert device_{dma_supported,get_dma_attr} to fwnode Sakari Ailus
2022-02-07 12:20   ` Andy Shevchenko
2022-02-11 15:55   ` Rob Herring
2022-02-11 16:18     ` Andy Shevchenko
2022-03-08 15:50       ` Rob Herring
2022-02-14 13:31     ` Sakari Ailus
2022-02-06  9:16 ` [PATCH 2/4] ACPI: property: Move acpi_fwnode_device_get_match_data() up Sakari Ailus
2022-02-06  9:16 ` [PATCH 3/4] device property: Add iomap to fwnode operations Sakari Ailus
2022-02-11 15:59   ` Rob Herring
2022-02-14 10:31     ` Sakari Ailus
2022-02-06  9:16 ` [PATCH 4/4] device property: Add irq_get to fwnode operation Sakari Ailus
2022-02-11 16:02   ` Rob Herring
2022-02-07 12:27 ` [PATCH 0/4] Shovel firmware specific code to appropriate locations Andy Shevchenko
2022-02-07 14:41   ` Sakari Ailus

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).