From: jolly.shah@xilinx.com (Jolly Shah)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/3] firmware: xilinx: Replace if/else with switch case
Date: Mon, 10 Sep 2018 13:01:34 -0700 [thread overview]
Message-ID: <1536609694-7920-4-git-send-email-jollys@xilinx.com> (raw)
In-Reply-To: <1536609694-7920-1-git-send-email-jollys@xilinx.com>
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
prev parent reply other threads:[~2018-09-10 20:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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=1536609694-7920-4-git-send-email-jollys@xilinx.com \
--to=jolly.shah@xilinx.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).