mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: linux-kernel@vger.kernel.org
Cc: Gilad Avidov <gavidov@codeaurora.org>,
	Sagar Dharia <sdharia@codeaurora.org>,
	Josh Cartwright <joshc@codeaurora.org>,
	Kenneth Heitke <kheitke@codeaurora.org>,
	"Ivan T. Ivanov" <iivanov@mm-sol.com>,
	GregKroah-Hartman <gregkh@linuxfoundation.org>
Subject: spmi: Question about qpnpint_irq_set_type implement
Date: Fri, 26 Jun 2015 16:17:24 +0800	[thread overview]
Message-ID: <1435306644.7057.2.camel@ingics.com> (raw)

Hi,
Current implementation in qpnpint_irq_set_type() will set (1 << irq) bit
for type.polarity_high/type.polarity_low but never clear this bit.
I'm wondering if it is intentional because the value write to
QPNPINT_REG_SET_TYPE register depends on it's original value.

Maybe it needs below changes, comments?

diff --git a/drivers/spmi/spmi-pmic-arb.c b/drivers/spmi/spmi-pmic-arb.c
index 6ea6eab..fe59cf4 100644
--- a/drivers/spmi/spmi-pmic-arb.c
+++ b/drivers/spmi/spmi-pmic-arb.c
@@ -557,18 +557,26 @@ static int qpnpint_irq_set_type(struct irq_data *d, unsigned int flow_type)
 		type.type |= 1 << irq;
 		if (flow_type & IRQF_TRIGGER_RISING)
 			type.polarity_high |= 1 << irq;
+		else
+			type.polarity_high &= ~(1 << irq);
+
 		if (flow_type & IRQF_TRIGGER_FALLING)
 			type.polarity_low  |= 1 << irq;
+		else
+			type.polarity_low &= ~(1 << irq);
 	} else {
 		if ((flow_type & (IRQF_TRIGGER_HIGH)) &&
 		    (flow_type & (IRQF_TRIGGER_LOW)))
 			return -EINVAL;
 
 		type.type &= ~(1 << irq); /* level trig */
-		if (flow_type & IRQF_TRIGGER_HIGH)
+		if (flow_type & IRQF_TRIGGER_HIGH) {
 			type.polarity_high |= 1 << irq;
-		else
+			type.polarity_low &= ~(1 << irq);
+		} else {
+			type.polarity_high &= ~(1 << irq);
 			type.polarity_low  |= 1 << irq;
+		}
 	}
 
 	qpnpint_spmi_write(d, QPNPINT_REG_SET_TYPE, &type, sizeof(type));



                 reply	other threads:[~2015-06-26  8:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1435306644.7057.2.camel@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=gavidov@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=iivanov@mm-sol.com \
    --cc=joshc@codeaurora.org \
    --cc=kheitke@codeaurora.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sdharia@codeaurora.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

all inboxes | Powered by JetHome®