From: Lubomir Rintel <lkundrak@v3.sk>
To: linux-kernel@vger.kernel.org
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-input@vger.kernel.org, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>, Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH 6/8] Input: olpc_apsp: check FIFO status on open(), not probe()
Date: Mon, 10 Sep 2018 13:26:52 +0200 [thread overview]
Message-ID: <20180910112654.42061-7-lkundrak@v3.sk> (raw)
In-Reply-To: <20180910112654.42061-1-lkundrak@v3.sk>
Let's defer the FIFO status checking until open().
When we'll get a clk handle, this will allow us to defer clock enablement
until the device is actually used.
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
drivers/input/serio/olpc_apsp.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/drivers/input/serio/olpc_apsp.c b/drivers/input/serio/olpc_apsp.c
index 8e9a4209fcad..8b19a47dfa46 100644
--- a/drivers/input/serio/olpc_apsp.c
+++ b/drivers/input/serio/olpc_apsp.c
@@ -145,8 +145,15 @@ static int olpc_apsp_open(struct serio *port)
{
struct olpc_apsp *priv = port->port_data;
unsigned int tmp;
+ unsigned long l;
if (priv->open_count++ == 0) {
+ l = readl(priv->base + COMMAND_FIFO_STATUS);
+ if (!(l & CMD_STS_MASK)) {
+ dev_err(priv->dev, "SP cannot accept commands.\n");
+ return -EIO;
+ }
+
/* Enable interrupt 0 by clearing its bit */
tmp = readl(priv->base + PJ_INTERRUPT_MASK);
writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK);
@@ -173,7 +180,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
struct olpc_apsp *priv;
struct resource *res;
struct device_node *np;
- unsigned long l;
int error;
priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL);
@@ -192,12 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
if (priv->irq < 0)
return priv->irq;
- l = readl(priv->base + COMMAND_FIFO_STATUS);
- if (!(l & CMD_STS_MASK)) {
- dev_err(&pdev->dev, "SP cannot accept commands.\n");
- return -EIO;
- }
-
/* KEYBOARD */
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!kb_serio)
--
2.17.1
next prev parent reply other threads:[~2018-09-10 11:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-10 11:26 [PATCH 0/8] OLPC 1.75 Keyboard/Touchpad fixes Lubomir Rintel
2018-09-10 11:26 ` [PATCH 1/8] dt-bindings: olpc,ap-sp: add clock Lubomir Rintel
2018-09-10 11:26 ` [PATCH 2/8] dt-bindings: olpc,ap-sp: add GPIO lines Lubomir Rintel
2018-09-10 11:26 ` [PATCH 3/8] dt-bindings: marvell,mmp2: Add clock id for the SP clock Lubomir Rintel
2018-10-02 7:18 ` Stephen Boyd
2018-09-10 11:26 ` [PATCH 4/8] clk: mmp2: add " Lubomir Rintel
2018-10-02 7:18 ` Stephen Boyd
2018-09-10 11:26 ` [PATCH 5/8] Input: olpc_apsp: depend on CONFIG_OF Lubomir Rintel
2018-09-10 11:26 ` Lubomir Rintel [this message]
2018-11-02 22:16 ` [PATCH 6/8] Input: olpc_apsp: check FIFO status on open(), not probe() Pavel Machek
2018-09-10 11:26 ` [PATCH 7/8] Input: olpc_apsp: enable the SP clock Lubomir Rintel
2018-09-10 11:26 ` [PATCH 8/8] Input: olpc_apsp: allocate the GPIOs used Lubomir Rintel
2018-11-01 21:56 ` [PATCH 0/8] OLPC 1.75 Keyboard/Touchpad fixes Pavel Machek
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=20180910112654.42061-7-lkundrak@v3.sk \
--to=lkundrak@v3.sk \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-clk@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.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).