Skip to content

Commit af51834

Browse files
lkundrakdtor
authored andcommitted
Input: olpc_apsp - check FIFO status on open(), not probe()
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 <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 76d97b0 commit af51834

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/input/serio/olpc_apsp.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,15 @@ static int olpc_apsp_open(struct serio *port)
145145
{
146146
struct olpc_apsp *priv = port->port_data;
147147
unsigned int tmp;
148+
unsigned long l;
148149

149150
if (priv->open_count++ == 0) {
151+
l = readl(priv->base + COMMAND_FIFO_STATUS);
152+
if (!(l & CMD_STS_MASK)) {
153+
dev_err(priv->dev, "SP cannot accept commands.\n");
154+
return -EIO;
155+
}
156+
150157
/* Enable interrupt 0 by clearing its bit */
151158
tmp = readl(priv->base + PJ_INTERRUPT_MASK);
152159
writel(tmp & ~INT_0, priv->base + PJ_INTERRUPT_MASK);
@@ -173,7 +180,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
173180
struct olpc_apsp *priv;
174181
struct resource *res;
175182
struct device_node *np;
176-
unsigned long l;
177183
int error;
178184

179185
priv = devm_kzalloc(&pdev->dev, sizeof(struct olpc_apsp), GFP_KERNEL);
@@ -192,12 +198,6 @@ static int olpc_apsp_probe(struct platform_device *pdev)
192198
if (priv->irq < 0)
193199
return priv->irq;
194200

195-
l = readl(priv->base + COMMAND_FIFO_STATUS);
196-
if (!(l & CMD_STS_MASK)) {
197-
dev_err(&pdev->dev, "SP cannot accept commands.\n");
198-
return -EIO;
199-
}
200-
201201
/* KEYBOARD */
202202
kb_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
203203
if (!kb_serio)

0 commit comments

Comments
 (0)