[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180717020926.176408-25-toddpoynor@gmail.com>
Date: Mon, 16 Jul 2018 19:09:18 -0700
From: Todd Poynor <toddpoynor@...il.com>
To: Rob Springer <rspringer@...gle.com>,
John Joseph <jnjoseph@...gle.com>,
Ben Chan <benchan@...omium.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Zhongze Hu <frankhu@...omium.org>, Simon Que <sque@...omium.org>,
Dmitry Torokhov <dtor@...omium.org>,
Guenter Roeck <groeck@...omium.org>,
devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
Todd Poynor <toddpoynor@...gle.com>
Subject: [PATCH 24/32] staging: gasket: apex_clock_gating simplify logic, reduce indentation
From: Todd Poynor <toddpoynor@...gle.com>
Collapse together two checks and return immediately, avoid conditional
indentation for most of function code.
Reported-by: Guenter Roeck <groeck@...omium.org>
Signed-off-by: Simon Que <sque@...omium.org>
Signed-off-by: Todd Poynor <toddpoynor@...gle.com>
---
drivers/staging/gasket/apex_driver.c | 44 +++++++++++++---------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/drivers/staging/gasket/apex_driver.c b/drivers/staging/gasket/apex_driver.c
index 6a22fa9a9c045..a1fec53d152b9 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -663,33 +663,31 @@ static long apex_clock_gating(struct gasket_dev *gasket_dev, void __user *arg)
{
struct apex_gate_clock_ioctl ibuf;
- if (bypass_top_level)
+ if (bypass_top_level || !allow_sw_clock_gating)
return 0;
- if (allow_sw_clock_gating) {
- if (copy_from_user(&ibuf, arg, sizeof(ibuf)))
- return -EFAULT;
+ if (copy_from_user(&ibuf, arg, sizeof(ibuf)))
+ return -EFAULT;
- gasket_log_error(
- gasket_dev, "%s %llu", __func__, ibuf.enable);
+ gasket_log_error(
+ gasket_dev, "%s %llu", __func__, ibuf.enable);
- if (ibuf.enable) {
- /* Quiesce AXI, gate GCB clock. */
- gasket_read_modify_write_32(
- gasket_dev, APEX_BAR_INDEX,
- APEX_BAR2_REG_AXI_QUIESCE, 0x1, 1, 16);
- gasket_read_modify_write_32(
- gasket_dev, APEX_BAR_INDEX,
- APEX_BAR2_REG_GCB_CLOCK_GATE, 0x1, 2, 18);
- } else {
- /* Un-gate GCB clock, un-quiesce AXI. */
- gasket_read_modify_write_32(
- gasket_dev, APEX_BAR_INDEX,
- APEX_BAR2_REG_GCB_CLOCK_GATE, 0x0, 2, 18);
- gasket_read_modify_write_32(
- gasket_dev, APEX_BAR_INDEX,
- APEX_BAR2_REG_AXI_QUIESCE, 0x0, 1, 16);
- }
+ if (ibuf.enable) {
+ /* Quiesce AXI, gate GCB clock. */
+ gasket_read_modify_write_32(
+ gasket_dev, APEX_BAR_INDEX,
+ APEX_BAR2_REG_AXI_QUIESCE, 0x1, 1, 16);
+ gasket_read_modify_write_32(
+ gasket_dev, APEX_BAR_INDEX,
+ APEX_BAR2_REG_GCB_CLOCK_GATE, 0x1, 2, 18);
+ } else {
+ /* Un-gate GCB clock, un-quiesce AXI. */
+ gasket_read_modify_write_32(
+ gasket_dev, APEX_BAR_INDEX,
+ APEX_BAR2_REG_GCB_CLOCK_GATE, 0x0, 2, 18);
+ gasket_read_modify_write_32(
+ gasket_dev, APEX_BAR_INDEX,
+ APEX_BAR2_REG_AXI_QUIESCE, 0x0, 1, 16);
}
return 0;
}
--
2.18.0.203.gfac676dfb9-goog
Powered by blists - more mailing lists