diff --git a/include/net/nfc/nci_core.h b/include/net/nfc/nci_core.h index c49688c0985362a274cfa69407256ccd86d4a83d..886854a4ea91fa042f1c57bf3a6c81d9ca8f96a9 100644 --- a/include/net/nfc/nci_core.h +++ b/include/net/nfc/nci_core.h @@ -73,6 +73,7 @@ struct nci_prop_ops { }; struct nci_ops { + int (*init)(struct nci_dev *ndev); int (*open)(struct nci_dev *ndev); int (*close)(struct nci_dev *ndev); int (*send)(struct nci_dev *ndev, struct sk_buff *skb); diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c index b900e6a2a28449156246e132c092405a9880abf9..458e58bb9cb108ff7e6bdd9ce38a165275036e1c 100644 --- a/net/nfc/nci/core.c +++ b/net/nfc/nci/core.c @@ -344,8 +344,13 @@ static int nci_open_device(struct nci_dev *ndev) set_bit(NCI_INIT, &ndev->flags); - rc = __nci_request(ndev, nci_reset_req, 0, - msecs_to_jiffies(NCI_RESET_TIMEOUT)); + if (ndev->ops->init) + rc = ndev->ops->init(ndev); + + if (!rc) { + rc = __nci_request(ndev, nci_reset_req, 0, + msecs_to_jiffies(NCI_RESET_TIMEOUT)); + } if (!rc && ndev->ops->setup) { rc = ndev->ops->setup(ndev);