/* * Reads an ndlc frame from the chip. * * On ST21NFCB, IRQ goes in idle state when read starts. */ static irqreturn_t st21nfcb_nci_irq_thread_fn(int irq, void *phy_id) { struct st21nfcb_i2c_phy *phy = phy_id; struct i2c_client *client; struct sk_buff *skb = NULL; int r; if (!phy || irq != phy->i2c_dev->irq) { WARN_ON_ONCE(1); return IRQ_NONE; } client = phy->i2c_dev; dev_dbg(&client->dev, "IRQ\n"); if (phy->ndlc->hard_fault) return IRQ_HANDLED; if (!phy->powered) { st21nfcb_nci_i2c_disable(phy); return IRQ_HANDLED; } r = st21nfcb_nci_i2c_read(phy, &skb); if (r == -EREMOTEIO || r == -ENOMEM || r == -EBADMSG) return IRQ_HANDLED; ndlc_recv(phy->ndlc, skb); return IRQ_HANDLED; }
static int st21nfcb_nci_i2c_remove(struct i2c_client *client) { struct st21nfcb_i2c_phy *phy = i2c_get_clientdata(client); dev_dbg(&client->dev, "%s\n", __func__); ndlc_remove(phy->ndlc); if (phy->powered) st21nfcb_nci_i2c_disable(phy); return 0; }