NFC: NCI: Fix skb->dev usage

skb->dev is used for carrying a net_device pointer and not
an nci_dev pointer.

Remove usage of skb-dev to carry nci_dev and replace it by parameter
in nci_recv_frame(), nci_send_frame() and driver send() functions.

NfcWilink driver is also updated to use those functions.

Signed-off-by: Frederic Danis <frederic.danis@linux.intel.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
Frederic Danis
2013-05-22 11:36:17 +02:00
committed by Samuel Ortiz
parent 4674d0fecb
commit 1095e69f47
4 changed files with 13 additions and 27 deletions
+6 -11
View File
@@ -797,12 +797,11 @@ EXPORT_SYMBOL(nci_unregister_device);
/**
* nci_recv_frame - receive frame from NCI drivers
*
* @ndev: The nci device
* @skb: The sk_buff to receive
*/
int nci_recv_frame(struct sk_buff *skb)
int nci_recv_frame(struct nci_dev *ndev, struct sk_buff *skb)
{
struct nci_dev *ndev = (struct nci_dev *) skb->dev;
pr_debug("len %d\n", skb->len);
if (!ndev || (!test_bit(NCI_UP, &ndev->flags) &&
@@ -819,10 +818,8 @@ int nci_recv_frame(struct sk_buff *skb)
}
EXPORT_SYMBOL(nci_recv_frame);
static int nci_send_frame(struct sk_buff *skb)
static int nci_send_frame(struct nci_dev *ndev, struct sk_buff *skb)
{
struct nci_dev *ndev = (struct nci_dev *) skb->dev;
pr_debug("len %d\n", skb->len);
if (!ndev) {
@@ -833,7 +830,7 @@ static int nci_send_frame(struct sk_buff *skb)
/* Get rid of skb owner, prior to sending to the driver. */
skb_orphan(skb);
return ndev->ops->send(skb);
return ndev->ops->send(ndev, skb);
}
/* Send NCI command */
@@ -861,8 +858,6 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload)
if (plen)
memcpy(skb_put(skb, plen), payload, plen);
skb->dev = (void *) ndev;
skb_queue_tail(&ndev->cmd_q, skb);
queue_work(ndev->cmd_wq, &ndev->cmd_work);
@@ -894,7 +889,7 @@ static void nci_tx_work(struct work_struct *work)
nci_conn_id(skb->data),
nci_plen(skb->data));
nci_send_frame(skb);
nci_send_frame(ndev, skb);
mod_timer(&ndev->data_timer,
jiffies + msecs_to_jiffies(NCI_DATA_TIMEOUT));
@@ -963,7 +958,7 @@ static void nci_cmd_work(struct work_struct *work)
nci_opcode_oid(nci_opcode(skb->data)),
nci_plen(skb->data));
nci_send_frame(skb);
nci_send_frame(ndev, skb);
mod_timer(&ndev->cmd_timer,
jiffies + msecs_to_jiffies(NCI_CMD_TIMEOUT));
-2
View File
@@ -80,8 +80,6 @@ static inline void nci_push_data_hdr(struct nci_dev *ndev,
nci_mt_set((__u8 *)hdr, NCI_MT_DATA_PKT);
nci_pbf_set((__u8 *)hdr, pbf);
skb->dev = (void *) ndev;
}
static int nci_queue_tx_data_frags(struct nci_dev *ndev,