linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3]  drivers: firmware: xilinx: Minor fixes
@ 2018-09-10 20:01 Jolly Shah
  2018-09-10 20:01 ` [PATCH 1/3] firmware: xilinx: Replace init call with probe method Jolly Shah
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jolly Shah @ 2018-09-10 20:01 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset is created on top of commit bca7067d2d4e91f58162b07d73cd94e20437b4f6 from below git repository:
https://github.com/Xilinx/linux-xlnx.git tags/zynqmp-soc-for-v4.20

It contains 1 pending patch from v11 patchset and 2 patches to fix minor review comments received from Olof Johansson.

Rajan Vaja (3):
  firmware: xilinx: Replace init call with probe method
  firmware: xilinx: Move declaration of qdata to top of the function
  firmware: xilinx: Replace if/else with switch case

 drivers/firmware/xilinx/zynqmp-debug.c | 15 ++++----
 drivers/firmware/xilinx/zynqmp.c       | 63 ++++++++++------------------------
 2 files changed, 26 insertions(+), 52 deletions(-)

-- 
2.7.4

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

* [PATCH 1/3] firmware: xilinx: Replace init call with probe method
  2018-09-10 20:01 [PATCH 0/3] drivers: firmware: xilinx: Minor fixes Jolly Shah
@ 2018-09-10 20:01 ` Jolly Shah
  2018-09-10 20:01 ` [PATCH 2/3] firmware: xilinx: Move declaration of qdata to top of the function Jolly Shah
  2018-09-10 20:01 ` [PATCH 3/3] firmware: xilinx: Replace if/else with switch case Jolly Shah
  2 siblings, 0 replies; 4+ messages in thread
From: Jolly Shah @ 2018-09-10 20:01 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rajan Vaja <rajan.vaja@xilinx.com>

As of all of child of ZynqMP firmware are platform
driver, there is no need of init call in firmware
driver. Earlier clock driver was init method so
firmware driver had to use init call to make sure
firmware init is done in early stage.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
---
 drivers/firmware/xilinx/zynqmp.c | 63 ++++++++++++----------------------------
 1 file changed, 18 insertions(+), 45 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 7ccedf0..ce6c746 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -476,50 +476,17 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_get_eemi_ops);
 static int zynqmp_firmware_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-
-	return of_platform_populate(dev->of_node, NULL, NULL, dev);
-}
-
-static const struct of_device_id zynqmp_firmware_of_match[] = {
-	{.compatible = "xlnx,zynqmp-firmware"},
-	{},
-};
-MODULE_DEVICE_TABLE(of, zynqmp_firmware_of_match);
-
-static struct platform_driver zynqmp_firmware_driver = {
-	.driver = {
-		.name = "zynqmp_firmware",
-		.of_match_table = zynqmp_firmware_of_match,
-	},
-	.probe = zynqmp_firmware_probe,
-};
-module_platform_driver(zynqmp_firmware_driver);
-
-static int __init zynqmp_plat_init(void)
-{
-	int ret;
 	struct device_node *np;
+	int ret;
 
 	np = of_find_compatible_node(NULL, NULL, "xlnx,zynqmp");
 	if (!np)
 		return 0;
 	of_node_put(np);
 
-	/*
-	 * We're running on a ZynqMP machine,
-	 * the zynqmp-firmware node is mandatory.
-	 */
-	np = of_find_compatible_node(NULL, NULL, "xlnx,zynqmp-firmware");
-	if (!np) {
-		pr_warn("%s: zynqmp-firmware node not found\n", __func__);
-		return -ENXIO;
-	}
-
-	ret = get_set_conduit_method(np);
-	if (ret) {
-		of_node_put(np);
+	ret = get_set_conduit_method(dev->of_node);
+	if (ret)
 		return ret;
-	}
 
 	/* Check PM API version number */
 	zynqmp_pm_get_api_version(&pm_api_version);
@@ -547,16 +514,22 @@ static int __init zynqmp_plat_init(void)
 	pr_info("%s Trustzone version v%d.%d\n", __func__,
 		pm_tz_version >> 16, pm_tz_version & 0xFFFF);
 
-	of_node_put(np);
+	zynqmp_pm_api_debugfs_init();
 
-	return ret;
+	return of_platform_populate(dev->of_node, NULL, NULL, dev);
 }
-early_initcall(zynqmp_plat_init);
 
-static int zynqmp_firmware_init(void)
-{
-	zynqmp_pm_api_debugfs_init();
+static const struct of_device_id zynqmp_firmware_of_match[] = {
+	{.compatible = "xlnx,zynqmp-firmware"},
+	{},
+};
+MODULE_DEVICE_TABLE(of, zynqmp_firmware_of_match);
 
-	return 0;
-}
-device_initcall(zynqmp_firmware_init);
+static struct platform_driver zynqmp_firmware_driver = {
+	.driver = {
+		.name = "zynqmp_firmware",
+		.of_match_table = zynqmp_firmware_of_match,
+	},
+	.probe = zynqmp_firmware_probe,
+};
+module_platform_driver(zynqmp_firmware_driver);
-- 
2.7.4

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

* [PATCH 2/3] firmware: xilinx: Move declaration of qdata to top of the function
  2018-09-10 20:01 [PATCH 0/3] drivers: firmware: xilinx: Minor fixes Jolly Shah
  2018-09-10 20:01 ` [PATCH 1/3] firmware: xilinx: Replace init call with probe method Jolly Shah
@ 2018-09-10 20:01 ` Jolly Shah
  2018-09-10 20:01 ` [PATCH 3/3] firmware: xilinx: Replace if/else with switch case Jolly Shah
  2 siblings, 0 replies; 4+ messages in thread
From: Jolly Shah @ 2018-09-10 20:01 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rajan Vaja <rajan.vaja@xilinx.com>

Move structure declaration from switch case to the top of function
and drop the braces.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
---
 drivers/firmware/xilinx/zynqmp-debug.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
index 4532bd0..ecbd599 100644
--- a/drivers/firmware/xilinx/zynqmp-debug.c
+++ b/drivers/firmware/xilinx/zynqmp-debug.c
@@ -87,6 +87,7 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
 	const struct zynqmp_eemi_ops *eemi_ops = zynqmp_pm_get_eemi_ops();
 	u32 pm_api_version;
 	int ret;
+	struct zynqmp_pm_query_data qdata = {0};
 
 	if (!eemi_ops)
 		return -ENXIO;
@@ -107,9 +108,6 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
 				pm_api_ret[1]);
 		break;
 	case PM_QUERY_DATA:
-	{
-		struct zynqmp_pm_query_data qdata = {0};
-
 		qdata.qid = pm_api_arg[0];
 		qdata.arg1 = pm_api_arg[1];
 		qdata.arg2 = pm_api_arg[2];
@@ -131,7 +129,6 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
 				pm_api_ret[0], pm_api_ret[1],
 				pm_api_ret[2], pm_api_ret[3]);
 		break;
-	}
 	default:
 		sprintf(debugfs_buf, "Unsupported PM-API request\n");
 		ret = -EINVAL;
-- 
2.7.4

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

* [PATCH 3/3] firmware: xilinx: Replace if/else with switch case
  2018-09-10 20:01 [PATCH 0/3] drivers: firmware: xilinx: Minor fixes Jolly Shah
  2018-09-10 20:01 ` [PATCH 1/3] firmware: xilinx: Replace init call with probe method Jolly Shah
  2018-09-10 20:01 ` [PATCH 2/3] firmware: xilinx: Move declaration of qdata to top of the function Jolly Shah
@ 2018-09-10 20:01 ` Jolly Shah
  2 siblings, 0 replies; 4+ messages in thread
From: Jolly Shah @ 2018-09-10 20:01 UTC (permalink / raw)
  To: linux-arm-kernel

From: Rajan Vaja <rajan.vaja@xilinx.com>

There will be more query IDs in future so it is better to
use switch case than if/else to avoid unnecessary condition
checks.

Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com>
Signed-off-by: Jolly Shah <jollys@xilinx.com>
---
 drivers/firmware/xilinx/zynqmp-debug.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/xilinx/zynqmp-debug.c b/drivers/firmware/xilinx/zynqmp-debug.c
index ecbd599..f12dabf 100644
--- a/drivers/firmware/xilinx/zynqmp-debug.c
+++ b/drivers/firmware/xilinx/zynqmp-debug.c
@@ -117,17 +117,21 @@ static int process_api_request(u32 pm_id, u64 *pm_api_arg, u32 *pm_api_ret)
 		if (ret)
 			break;
 
-		if (qdata.qid == PM_QID_CLOCK_GET_NAME)
+		switch (qdata.qid) {
+		case PM_QID_CLOCK_GET_NAME:
 			sprintf(debugfs_buf, "Clock name = %s\n",
 				(char *)pm_api_ret);
-		else if (qdata.qid == PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS)
+			break;
+		case PM_QID_CLOCK_GET_FIXEDFACTOR_PARAMS:
 			sprintf(debugfs_buf, "Multiplier = %d, Divider = %d\n",
 				pm_api_ret[1], pm_api_ret[2]);
-		else
+			break;
+		default:
 			sprintf(debugfs_buf,
 				"data[0] = 0x%08x\ndata[1] = 0x%08x\n data[2] = 0x%08x\ndata[3] = 0x%08x\n",
 				pm_api_ret[0], pm_api_ret[1],
 				pm_api_ret[2], pm_api_ret[3]);
+		}
 		break;
 	default:
 		sprintf(debugfs_buf, "Unsupported PM-API request\n");
-- 
2.7.4

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

end of thread, other threads:[~2018-09-10 20:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-10 20:01 [PATCH 0/3] drivers: firmware: xilinx: Minor fixes Jolly Shah
2018-09-10 20:01 ` [PATCH 1/3] firmware: xilinx: Replace init call with probe method Jolly Shah
2018-09-10 20:01 ` [PATCH 2/3] firmware: xilinx: Move declaration of qdata to top of the function Jolly Shah
2018-09-10 20:01 ` [PATCH 3/3] firmware: xilinx: Replace if/else with switch case Jolly Shah

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