All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH linux dev-4.13 0/2] OCC: Fixup occ, occ-hwmon, and dts
@ 2018-02-20 21:27 Eddie James
  2018-02-20 21:27 ` [PATCH linux dev-4.13 1/2] Revert "ARM: dts: power9-cfam: Update OCC hwmon compatible" Eddie James
  2018-02-20 21:27 ` [PATCH linux dev-4.13 2/2] drivers: occ: Create hwmon platform device directly Eddie James
  0 siblings, 2 replies; 5+ messages in thread
From: Eddie James @ 2018-02-20 21:27 UTC (permalink / raw)
  To: openbmc; +Cc: joel, Eddie James

This series includes a couple of minor fixes to the get OCC driver stack
working correctly in the 4.13 tree.

Eddie James (2):
  Revert "ARM: dts: power9-cfam: Update OCC hwmon compatible"
  drivers: occ: Create hwmon platform device directly

 arch/arm/boot/dts/ibm-power9-cfam.dtsi |  5 +++--
 drivers/fsi/fsi-occ.c                  | 29 ++++++++++++-----------------
 drivers/hwmon/occ/p9_sbe.c             |  6 ------
 3 files changed, 15 insertions(+), 25 deletions(-)

-- 
1.8.3.1

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

* [PATCH linux dev-4.13 1/2] Revert "ARM: dts: power9-cfam: Update OCC hwmon compatible"
  2018-02-20 21:27 [PATCH linux dev-4.13 0/2] OCC: Fixup occ, occ-hwmon, and dts Eddie James
@ 2018-02-20 21:27 ` Eddie James
  2018-02-23  0:59   ` Andrew Jeffery
  2018-02-20 21:27 ` [PATCH linux dev-4.13 2/2] drivers: occ: Create hwmon platform device directly Eddie James
  1 sibling, 1 reply; 5+ messages in thread
From: Eddie James @ 2018-02-20 21:27 UTC (permalink / raw)
  To: openbmc; +Cc: joel, Eddie James

This reverts commit f370fa626a127aec50801dafcd595a2b5a47e482. The
dts properties were correct for the OCC driver.
---
 arch/arm/boot/dts/ibm-power9-cfam.dtsi | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/ibm-power9-cfam.dtsi b/arch/arm/boot/dts/ibm-power9-cfam.dtsi
index e0e738f..c110417 100644
--- a/arch/arm/boot/dts/ibm-power9-cfam.dtsi
+++ b/arch/arm/boot/dts/ibm-power9-cfam.dtsi
@@ -113,7 +113,7 @@
 			#size-cells = <0>;
 
 			occ@1 {
-				compatible = "ibm,p9-occ-hwmon";
+				compatible = "ibm,p9-occ";
 				reg = <1>;
 			};
 		};
@@ -205,7 +205,8 @@
 					#size-cells = <0>;
 
 					occ@2 {
-						compatible = "ibm,p9-occ-hwmon";
+						compatible =
+							"ibm,p9-occ";
 						reg = <2>;
 					};
 				};
-- 
1.8.3.1

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

* [PATCH linux dev-4.13 2/2] drivers: occ: Create hwmon platform device directly
  2018-02-20 21:27 [PATCH linux dev-4.13 0/2] OCC: Fixup occ, occ-hwmon, and dts Eddie James
  2018-02-20 21:27 ` [PATCH linux dev-4.13 1/2] Revert "ARM: dts: power9-cfam: Update OCC hwmon compatible" Eddie James
@ 2018-02-20 21:27 ` Eddie James
  2018-02-23  4:59   ` Andrew Jeffery
  1 sibling, 1 reply; 5+ messages in thread
From: Eddie James @ 2018-02-20 21:27 UTC (permalink / raw)
  To: openbmc; +Cc: joel, Eddie James

Previously, the OCC driver parses the device tree and creates platform
devices for each child node found there. This was used to probe the
OCC hwmon devices. However, this doesn't make sense since hmwon isn't a
device. Therefore, just directly create a platform device for each OCC
for the hwmon driver to probe.

Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>
---
 drivers/fsi/fsi-occ.c      | 29 ++++++++++++-----------------
 drivers/hwmon/occ/p9_sbe.c |  6 ------
 2 files changed, 12 insertions(+), 23 deletions(-)

diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
index 1713550..8a1d0a1 100644
--- a/drivers/fsi/fsi-occ.c
+++ b/drivers/fsi/fsi-occ.c
@@ -21,7 +21,6 @@
 #include <linux/mutex.h>
 #include <linux/fsi-occ.h>
 #include <linux/of.h>
-#include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -737,24 +736,24 @@ void occ_drv_release(struct occ_client *client)
 
 static int occ_unregister_child(struct device *dev, void *data)
 {
-	struct platform_device *child = to_platform_device(dev);
+	struct platform_device *hwmon_dev = to_platform_device(dev);
 
-	of_device_unregister(child);
-	if (dev->of_node)
-		of_node_clear_flag(dev->of_node, OF_POPULATED);
+	platform_device_unregister(hwmon_dev);
 
 	return 0;
 }
 
 static int occ_probe(struct platform_device *pdev)
 {
-	int rc, child_idx = 0;
+	int rc;
 	u32 reg;
 	struct occ *occ;
-	struct device_node *np;
-	struct platform_device *child;
+	struct platform_device *hwmon_dev;
 	struct device *dev = &pdev->dev;
-	char child_name[32];
+	struct platform_device_info hwmon_dev_info = {
+		.parent = dev,
+		.name = "occ-hwmon",
+	};
 
 	occ = devm_kzalloc(dev, sizeof(*occ), GFP_KERNEL);
 	if (!occ)
@@ -796,14 +795,10 @@ static int occ_probe(struct platform_device *pdev)
 		return rc;
 	}
 
-	/* create platform devs for dts child nodes (hwmon, etc) */
-	for_each_available_child_of_node(dev->of_node, np) {
-		snprintf(child_name, sizeof(child_name), "occ%d-dev%d",
-			 occ->idx, child_idx++);
-		child = of_platform_device_create(np, child_name, dev);
-		if (!child)
-			dev_warn(dev, "failed to create child node dev\n");
-	}
+	hwmon_dev_info.id = occ->idx;
+	hwmon_dev = platform_device_register_full(&hwmon_dev_info);
+	if (!hwmon_dev)
+		dev_warn(dev, "failed to create hwmon device\n");
 
 	platform_set_drvdata(pdev, occ);
 
diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c
index 7dbe4d5..451a393 100644
--- a/drivers/hwmon/occ/p9_sbe.c
+++ b/drivers/hwmon/occ/p9_sbe.c
@@ -140,15 +140,9 @@ static int p9_sbe_occ_remove(struct platform_device *pdev)
 	return 0;
 }
 
-static const struct of_device_id p9_sbe_occ_of_match[] = {
-	{ .compatible = "ibm,p9-occ-hwmon" },
-	{ },
-};
-
 static struct platform_driver p9_sbe_occ_driver = {
 	.driver = {
 		.name = "occ-hwmon",
-		.of_match_table	= p9_sbe_occ_of_match,
 	},
 	.probe	= p9_sbe_occ_probe,
 	.remove = p9_sbe_occ_remove,
-- 
1.8.3.1

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

* Re: [PATCH linux dev-4.13 1/2] Revert "ARM: dts: power9-cfam: Update OCC hwmon compatible"
  2018-02-20 21:27 ` [PATCH linux dev-4.13 1/2] Revert "ARM: dts: power9-cfam: Update OCC hwmon compatible" Eddie James
@ 2018-02-23  0:59   ` Andrew Jeffery
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Jeffery @ 2018-02-23  0:59 UTC (permalink / raw)
  To: Eddie James, openbmc

On Wed, 21 Feb 2018, at 07:57, Eddie James wrote:
> This reverts commit f370fa626a127aec50801dafcd595a2b5a47e482. The
> dts properties were correct for the OCC driver.
> ---
>  arch/arm/boot/dts/ibm-power9-cfam.dtsi | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/ibm-power9-cfam.dtsi b/arch/arm/boot/dts/
> ibm-power9-cfam.dtsi
> index e0e738f..c110417 100644
> --- a/arch/arm/boot/dts/ibm-power9-cfam.dtsi
> +++ b/arch/arm/boot/dts/ibm-power9-cfam.dtsi
> @@ -113,7 +113,7 @@
>  			#size-cells = <0>;
>  
>  			occ@1 {
> -				compatible = "ibm,p9-occ-hwmon";
> +				compatible = "ibm,p9-occ";
>  				reg = <1>;
>  			};
>  		};
> @@ -205,7 +205,8 @@
>  					#size-cells = <0>;
>  
>  					occ@2 {
> -						compatible = "ibm,p9-occ-hwmon";
> +						compatible =
> +							"ibm,p9-occ";

A bit petty, but can we fix the whitespace here? Maybe Joel can fix it when it's applied.

Otherwise,

Acked-by: Andrew Jeffery <andrew@aj.id.au>

Cheers,

Andrew

>  						reg = <2>;
>  					};
>  				};
> -- 
> 1.8.3.1
> 

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

* Re: [PATCH linux dev-4.13 2/2] drivers: occ: Create hwmon platform device directly
  2018-02-20 21:27 ` [PATCH linux dev-4.13 2/2] drivers: occ: Create hwmon platform device directly Eddie James
@ 2018-02-23  4:59   ` Andrew Jeffery
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Jeffery @ 2018-02-23  4:59 UTC (permalink / raw)
  To: Eddie James, openbmc

On Wed, 21 Feb 2018, at 07:57, Eddie James wrote:
> Previously, the OCC driver parses the device tree and creates platform
> devices for each child node found there. This was used to probe the
> OCC hwmon devices. However, this doesn't make sense since hmwon isn't a
> device. Therefore, just directly create a platform device for each OCC
> for the hwmon driver to probe.
> 
> Signed-off-by: Eddie James <eajames@linux.vnet.ibm.com>

This reduces our dependence on bad devicetree practices, so:

Acked-by: Andrew Jeffery <andrew@aj.id.au>

> ---
>  drivers/fsi/fsi-occ.c      | 29 ++++++++++++-----------------
>  drivers/hwmon/occ/p9_sbe.c |  6 ------
>  2 files changed, 12 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/fsi/fsi-occ.c b/drivers/fsi/fsi-occ.c
> index 1713550..8a1d0a1 100644
> --- a/drivers/fsi/fsi-occ.c
> +++ b/drivers/fsi/fsi-occ.c
> @@ -21,7 +21,6 @@
>  #include <linux/mutex.h>
>  #include <linux/fsi-occ.h>
>  #include <linux/of.h>
> -#include <linux/of_platform.h>
>  #include <linux/platform_device.h>
>  #include <linux/sched.h>
>  #include <linux/slab.h>
> @@ -737,24 +736,24 @@ void occ_drv_release(struct occ_client *client)
>  
>  static int occ_unregister_child(struct device *dev, void *data)
>  {
> -	struct platform_device *child = to_platform_device(dev);
> +	struct platform_device *hwmon_dev = to_platform_device(dev);
>  
> -	of_device_unregister(child);
> -	if (dev->of_node)
> -		of_node_clear_flag(dev->of_node, OF_POPULATED);
> +	platform_device_unregister(hwmon_dev);
>  
>  	return 0;
>  }
>  
>  static int occ_probe(struct platform_device *pdev)
>  {
> -	int rc, child_idx = 0;
> +	int rc;
>  	u32 reg;
>  	struct occ *occ;
> -	struct device_node *np;
> -	struct platform_device *child;
> +	struct platform_device *hwmon_dev;
>  	struct device *dev = &pdev->dev;
> -	char child_name[32];
> +	struct platform_device_info hwmon_dev_info = {
> +		.parent = dev,
> +		.name = "occ-hwmon",
> +	};
>  
>  	occ = devm_kzalloc(dev, sizeof(*occ), GFP_KERNEL);
>  	if (!occ)
> @@ -796,14 +795,10 @@ static int occ_probe(struct platform_device *pdev)
>  		return rc;
>  	}
>  
> -	/* create platform devs for dts child nodes (hwmon, etc) */
> -	for_each_available_child_of_node(dev->of_node, np) {
> -		snprintf(child_name, sizeof(child_name), "occ%d-dev%d",
> -			 occ->idx, child_idx++);
> -		child = of_platform_device_create(np, child_name, dev);
> -		if (!child)
> -			dev_warn(dev, "failed to create child node dev\n");
> -	}
> +	hwmon_dev_info.id = occ->idx;
> +	hwmon_dev = platform_device_register_full(&hwmon_dev_info);
> +	if (!hwmon_dev)
> +		dev_warn(dev, "failed to create hwmon device\n");
>  
>  	platform_set_drvdata(pdev, occ);
>  
> diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c
> index 7dbe4d5..451a393 100644
> --- a/drivers/hwmon/occ/p9_sbe.c
> +++ b/drivers/hwmon/occ/p9_sbe.c
> @@ -140,15 +140,9 @@ static int p9_sbe_occ_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -static const struct of_device_id p9_sbe_occ_of_match[] = {
> -	{ .compatible = "ibm,p9-occ-hwmon" },
> -	{ },
> -};
> -
>  static struct platform_driver p9_sbe_occ_driver = {
>  	.driver = {
>  		.name = "occ-hwmon",
> -		.of_match_table	= p9_sbe_occ_of_match,
>  	},
>  	.probe	= p9_sbe_occ_probe,
>  	.remove = p9_sbe_occ_remove,
> -- 
> 1.8.3.1
> 


-- 
  Andrew Jeffery
  andrew@aj.id.au

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

end of thread, other threads:[~2018-02-23  4:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-20 21:27 [PATCH linux dev-4.13 0/2] OCC: Fixup occ, occ-hwmon, and dts Eddie James
2018-02-20 21:27 ` [PATCH linux dev-4.13 1/2] Revert "ARM: dts: power9-cfam: Update OCC hwmon compatible" Eddie James
2018-02-23  0:59   ` Andrew Jeffery
2018-02-20 21:27 ` [PATCH linux dev-4.13 2/2] drivers: occ: Create hwmon platform device directly Eddie James
2018-02-23  4:59   ` Andrew Jeffery

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.