aboutsummaryrefslogtreecommitdiffstats
path: root/net/nfc
diff options
context:
space:
mode:
authorFrederic Danis <frederic.danis@linux.intel.com>2013-05-22 05:36:17 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-13 18:25:53 -0400
commit1095e69f47926db6f1350a9d6a38626521580e87 (patch)
tree0519d46f84f0904f2d8b8c843857645d8b358284 /net/nfc
parent4674d0fecbeeb9731274f03ff35a108630be4585 (diff)
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>
Diffstat (limited to 'net/nfc')
-rw-r--r--net/nfc/nci/core.c17
-rw-r--r--net/nfc/nci/data.c2
2 files changed, 6 insertions, 13 deletions
diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
index 48ada0ec749e..8e0dbbeee9e3 100644
--- a/net/nfc/nci/core.c
+++ b/net/nfc/nci/core.c
@@ -797,12 +797,11 @@ EXPORT_SYMBOL(nci_unregister_device);
797/** 797/**
798 * nci_recv_frame - receive frame from NCI drivers 798 * nci_recv_frame - receive frame from NCI drivers
799 * 799 *
800 * @ndev: The nci device
800 * @skb: The sk_buff to receive 801 * @skb: The sk_buff to receive
801 */ 802 */
802int nci_recv_frame(struct sk_buff *skb) 803int nci_recv_frame(struct nci_dev *ndev, struct sk_buff *skb)
803{ 804{
804 struct nci_dev *ndev = (struct nci_dev *) skb->dev;
805
806 pr_debug("len %d\n", skb->len); 805 pr_debug("len %d\n", skb->len);
807 806
808 if (!ndev || (!test_bit(NCI_UP, &ndev->flags) && 807 if (!ndev || (!test_bit(NCI_UP, &ndev->flags) &&
@@ -819,10 +818,8 @@ int nci_recv_frame(struct sk_buff *skb)
819} 818}
820EXPORT_SYMBOL(nci_recv_frame); 819EXPORT_SYMBOL(nci_recv_frame);
821 820
822static int nci_send_frame(struct sk_buff *skb) 821static int nci_send_frame(struct nci_dev *ndev, struct sk_buff *skb)
823{ 822{
824 struct nci_dev *ndev = (struct nci_dev *) skb->dev;
825
826 pr_debug("len %d\n", skb->len); 823 pr_debug("len %d\n", skb->len);
827 824
828 if (!ndev) { 825 if (!ndev) {
@@ -833,7 +830,7 @@ static int nci_send_frame(struct sk_buff *skb)
833 /* Get rid of skb owner, prior to sending to the driver. */ 830 /* Get rid of skb owner, prior to sending to the driver. */
834 skb_orphan(skb); 831 skb_orphan(skb);
835 832
836 return ndev->ops->send(skb); 833 return ndev->ops->send(ndev, skb);
837} 834}
838 835
839/* Send NCI command */ 836/* Send NCI command */
@@ -861,8 +858,6 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, void *payload)
861 if (plen) 858 if (plen)
862 memcpy(skb_put(skb, plen), payload, plen); 859 memcpy(skb_put(skb, plen), payload, plen);
863 860
864 skb->dev = (void *) ndev;
865
866 skb_queue_tail(&ndev->cmd_q, skb); 861 skb_queue_tail(&ndev->cmd_q, skb);
867 queue_work(ndev->cmd_wq, &ndev->cmd_work); 862 queue_work(ndev->cmd_wq, &ndev->cmd_work);
868 863
@@ -894,7 +889,7 @@ static void nci_tx_work(struct work_struct *work)
894 nci_conn_id(skb->data), 889 nci_conn_id(skb->data),
895 nci_plen(skb->data)); 890 nci_plen(skb->data));
896 891
897 nci_send_frame(skb); 892 nci_send_frame(ndev, skb);
898 893
899 mod_timer(&ndev->data_timer, 894 mod_timer(&ndev->data_timer,
900 jiffies + msecs_to_jiffies(NCI_DATA_TIMEOUT)); 895 jiffies + msecs_to_jiffies(NCI_DATA_TIMEOUT));
@@ -963,7 +958,7 @@ static void nci_cmd_work(struct work_struct *work)
963 nci_opcode_oid(nci_opcode(skb->data)), 958 nci_opcode_oid(nci_opcode(skb->data)),
964 nci_plen(skb->data)); 959 nci_plen(skb->data));
965 960
966 nci_send_frame(skb); 961 nci_send_frame(ndev, skb);
967 962
968 mod_timer(&ndev->cmd_timer, 963 mod_timer(&ndev->cmd_timer,
969 jiffies + msecs_to_jiffies(NCI_CMD_TIMEOUT)); 964 jiffies + msecs_to_jiffies(NCI_CMD_TIMEOUT));
diff --git a/net/nfc/nci/data.c b/net/nfc/nci/data.c
index 76c48c5324f8..2a9399dd6c68 100644
--- a/net/nfc/nci/data.c
+++ b/net/nfc/nci/data.c
@@ -80,8 +80,6 @@ static inline void nci_push_data_hdr(struct nci_dev *ndev,
80 80
81 nci_mt_set((__u8 *)hdr, NCI_MT_DATA_PKT); 81 nci_mt_set((__u8 *)hdr, NCI_MT_DATA_PKT);
82 nci_pbf_set((__u8 *)hdr, pbf); 82 nci_pbf_set((__u8 *)hdr, pbf);
83
84 skb->dev = (void *) ndev;
85} 83}
86 84
87static int nci_queue_tx_data_frags(struct nci_dev *ndev, 85static int nci_queue_tx_data_frags(struct nci_dev *ndev,