Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1692513 > unrolled thread

[PATCH V1 04/12] spmi: pmic-arb: optimize qpnpint_irq_set_type function

Started byKiran Gunda <kgunda@codeaurora.org>
First post2017-07-20 09:40 +0200
Last post2017-07-28 01:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH V1 04/12] spmi: pmic-arb: optimize qpnpint_irq_set_type function Kiran Gunda <kgunda@codeaurora.org> - 2017-07-20 09:40 +0200
    Re: [PATCH V1 04/12] spmi: pmic-arb: optimize qpnpint_irq_set_type  function Stephen Boyd <sboyd@codeaurora.org> - 2017-07-28 01:50 +0200

#1692513 — [PATCH V1 04/12] spmi: pmic-arb: optimize qpnpint_irq_set_type function

FromKiran Gunda <kgunda@codeaurora.org>
Date2017-07-20 09:40 +0200
Subject[PATCH V1 04/12] spmi: pmic-arb: optimize qpnpint_irq_set_type function
Message-ID<u5ee2-46l-97@gated-at.bofh.it>
Optimize the qpnpint_irq_set_type() by using a local variable
to hold the handler type. Also clean up other variable usage.

Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
---
 drivers/spmi/spmi-pmic-arb.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index cd78665..0c98495 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -587,35 +587,35 @@ static void qpnpint_irq_unmask(struct irq_data *d)
 static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type)
 {
 	struct spmi_pmic_arb_qpnpint_type type;
+	irq_flow_handler_t flow_handler;
 	u8 irq = hwirq_to_irq(d->hwirq);
-	u8 bit_mask_irq = BIT(irq);
 
 	qpnpint_spmi_read(d, QPNPINT_REG_SET_TYPE, &type, sizeof(type));
 
 	if (flow_type & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
-		type.type |= bit_mask_irq;
+		type.type |= BIT(irq);
 		if (flow_type & IRQF_TRIGGER_RISING)
-			type.polarity_high |= bit_mask_irq;
+			type.polarity_high |= BIT(irq);
 		if (flow_type & IRQF_TRIGGER_FALLING)
-			type.polarity_low  |= bit_mask_irq;
+			type.polarity_low  |= BIT(irq);
+
+		flow_handler = handle_edge_irq;
 	} else {
 		if ((flow_type & (IRQF_TRIGGER_HIGH)) &&
 		    (flow_type & (IRQF_TRIGGER_LOW)))
 			return -EINVAL;
 
-		type.type &= ~bit_mask_irq; /* level trig */
+		type.type &= ~BIT(irq); /* level trig */
 		if (flow_type & IRQF_TRIGGER_HIGH)
-			type.polarity_high |= bit_mask_irq;
+			type.polarity_high |= BIT(irq);
 		else
-			type.polarity_low  |= bit_mask_irq;
+			type.polarity_low  |= BIT(irq);
+
+		flow_handler = handle_level_irq;
 	}
 
 	qpnpint_spmi_write(d, QPNPINT_REG_SET_TYPE, &type, sizeof(type));
-
-	if (flow_type & IRQ_TYPE_EDGE_BOTH)
-		irq_set_handler_locked(d, handle_edge_irq);
-	else
-		irq_set_handler_locked(d, handle_level_irq);
+	irq_set_handler_locked(d, flow_handler);
 
 	return 0;
 }
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [next] | [standalone]


#1698367 — Re: [PATCH V1 04/12] spmi: pmic-arb: optimize qpnpint_irq_set_type function

FromStephen Boyd <sboyd@codeaurora.org>
Date2017-07-28 01:50 +0200
SubjectRe: [PATCH V1 04/12] spmi: pmic-arb: optimize qpnpint_irq_set_type function
Message-ID<u80Hw-4iN-3@gated-at.bofh.it>
In reply to#1692513
On 07/20, Kiran Gunda wrote:
> Optimize the qpnpint_irq_set_type() by using a local variable
> to hold the handler type. Also clean up other variable usage.
> 
> Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
> ---

Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web