diff options
-rw-r--r-- | drivers/nfc/st21nfcb/i2c.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c index b65847c62631..eb886932d972 100644 --- a/drivers/nfc/st21nfcb/i2c.c +++ b/drivers/nfc/st21nfcb/i2c.c | |||
@@ -199,7 +199,7 @@ static irqreturn_t st21nfcb_nci_irq_thread_fn(int irq, void *phy_id) | |||
199 | struct sk_buff *skb = NULL; | 199 | struct sk_buff *skb = NULL; |
200 | int r; | 200 | int r; |
201 | 201 | ||
202 | if (!phy || irq != phy->i2c_dev->irq) { | 202 | if (!phy || !phy->ndlc || irq != phy->i2c_dev->irq) { |
203 | WARN_ON_ONCE(1); | 203 | WARN_ON_ONCE(1); |
204 | return IRQ_NONE; | 204 | return IRQ_NONE; |
205 | } | 205 | } |
@@ -343,18 +343,22 @@ static int st21nfcb_nci_i2c_probe(struct i2c_client *client, | |||
343 | return -ENODEV; | 343 | return -ENODEV; |
344 | } | 344 | } |
345 | 345 | ||
346 | r = ndlc_probe(phy, &i2c_phy_ops, &client->dev, | ||
347 | ST21NFCB_FRAME_HEADROOM, ST21NFCB_FRAME_TAILROOM, | ||
348 | &phy->ndlc); | ||
349 | if (r < 0) { | ||
350 | nfc_err(&client->dev, "Unable to register ndlc layer\n"); | ||
351 | return r; | ||
352 | } | ||
353 | |||
346 | r = devm_request_threaded_irq(&client->dev, client->irq, NULL, | 354 | r = devm_request_threaded_irq(&client->dev, client->irq, NULL, |
347 | st21nfcb_nci_irq_thread_fn, | 355 | st21nfcb_nci_irq_thread_fn, |
348 | phy->irq_polarity | IRQF_ONESHOT, | 356 | phy->irq_polarity | IRQF_ONESHOT, |
349 | ST21NFCB_NCI_DRIVER_NAME, phy); | 357 | ST21NFCB_NCI_DRIVER_NAME, phy); |
350 | if (r < 0) { | 358 | if (r < 0) |
351 | nfc_err(&client->dev, "Unable to register IRQ handler\n"); | 359 | nfc_err(&client->dev, "Unable to register IRQ handler\n"); |
352 | return r; | ||
353 | } | ||
354 | 360 | ||
355 | return ndlc_probe(phy, &i2c_phy_ops, &client->dev, | 361 | return r; |
356 | ST21NFCB_FRAME_HEADROOM, ST21NFCB_FRAME_TAILROOM, | ||
357 | &phy->ndlc); | ||
358 | } | 362 | } |
359 | 363 | ||
360 | static int st21nfcb_nci_i2c_remove(struct i2c_client *client) | 364 | static int st21nfcb_nci_i2c_remove(struct i2c_client *client) |