diff options
Diffstat (limited to 'drivers/nfc/pn533.c')
-rw-r--r-- | drivers/nfc/pn533.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c index 19fecdba611b..02043dc430b9 100644 --- a/drivers/nfc/pn533.c +++ b/drivers/nfc/pn533.c | |||
@@ -640,7 +640,7 @@ static int __pn533_send_cmd_frame_async(struct pn533 *dev, | |||
640 | int rc; | 640 | int rc; |
641 | 641 | ||
642 | nfc_dev_dbg(&dev->interface->dev, "Sending command 0x%x", | 642 | nfc_dev_dbg(&dev->interface->dev, "Sending command 0x%x", |
643 | PN533_FRAME_CMD(out_frame)); | 643 | PN533_FRAME_CMD(out_frame)); |
644 | 644 | ||
645 | dev->cmd = PN533_FRAME_CMD(out_frame); | 645 | dev->cmd = PN533_FRAME_CMD(out_frame); |
646 | dev->cmd_complete = cmd_complete; | 646 | dev->cmd_complete = cmd_complete; |
@@ -1107,9 +1107,9 @@ static bool pn533_target_type_a_is_valid(struct pn533_target_type_a *type_a, | |||
1107 | platconf = PN533_TYPE_A_SENS_RES_PLATCONF(type_a->sens_res); | 1107 | platconf = PN533_TYPE_A_SENS_RES_PLATCONF(type_a->sens_res); |
1108 | 1108 | ||
1109 | if ((ssd == PN533_TYPE_A_SENS_RES_SSD_JEWEL && | 1109 | if ((ssd == PN533_TYPE_A_SENS_RES_SSD_JEWEL && |
1110 | platconf != PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL) || | 1110 | platconf != PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL) || |
1111 | (ssd != PN533_TYPE_A_SENS_RES_SSD_JEWEL && | 1111 | (ssd != PN533_TYPE_A_SENS_RES_SSD_JEWEL && |
1112 | platconf == PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL)) | 1112 | platconf == PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL)) |
1113 | return false; | 1113 | return false; |
1114 | 1114 | ||
1115 | /* Requirements 4.8.2.1, 4.8.2.3, 4.8.2.5 and 4.8.2.7 from NFC Forum */ | 1115 | /* Requirements 4.8.2.1, 4.8.2.3, 4.8.2.5 and 4.8.2.7 from NFC Forum */ |
@@ -1187,9 +1187,8 @@ static int pn533_target_found_felica(struct nfc_target *nfc_tgt, u8 *tgt_data, | |||
1187 | if (!pn533_target_felica_is_valid(tgt_felica, tgt_data_len)) | 1187 | if (!pn533_target_felica_is_valid(tgt_felica, tgt_data_len)) |
1188 | return -EPROTO; | 1188 | return -EPROTO; |
1189 | 1189 | ||
1190 | if (tgt_felica->nfcid2[0] == PN533_FELICA_SENSF_NFCID2_DEP_B1 && | 1190 | if ((tgt_felica->nfcid2[0] == PN533_FELICA_SENSF_NFCID2_DEP_B1) && |
1191 | tgt_felica->nfcid2[1] == | 1191 | (tgt_felica->nfcid2[1] == PN533_FELICA_SENSF_NFCID2_DEP_B2)) |
1192 | PN533_FELICA_SENSF_NFCID2_DEP_B2) | ||
1193 | nfc_tgt->supported_protocols = NFC_PROTO_NFC_DEP_MASK; | 1192 | nfc_tgt->supported_protocols = NFC_PROTO_NFC_DEP_MASK; |
1194 | else | 1193 | else |
1195 | nfc_tgt->supported_protocols = NFC_PROTO_FELICA_MASK; | 1194 | nfc_tgt->supported_protocols = NFC_PROTO_FELICA_MASK; |
@@ -1219,9 +1218,9 @@ static bool pn533_target_jewel_is_valid(struct pn533_target_jewel *jewel, | |||
1219 | platconf = PN533_TYPE_A_SENS_RES_PLATCONF(jewel->sens_res); | 1218 | platconf = PN533_TYPE_A_SENS_RES_PLATCONF(jewel->sens_res); |
1220 | 1219 | ||
1221 | if ((ssd == PN533_TYPE_A_SENS_RES_SSD_JEWEL && | 1220 | if ((ssd == PN533_TYPE_A_SENS_RES_SSD_JEWEL && |
1222 | platconf != PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL) || | 1221 | platconf != PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL) || |
1223 | (ssd != PN533_TYPE_A_SENS_RES_SSD_JEWEL && | 1222 | (ssd != PN533_TYPE_A_SENS_RES_SSD_JEWEL && |
1224 | platconf == PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL)) | 1223 | platconf == PN533_TYPE_A_SENS_RES_PLATCONF_JEWEL)) |
1225 | return false; | 1224 | return false; |
1226 | 1225 | ||
1227 | return true; | 1226 | return true; |
@@ -1810,7 +1809,7 @@ static int pn533_activate_target(struct nfc_dev *nfc_dev, | |||
1810 | int rc; | 1809 | int rc; |
1811 | 1810 | ||
1812 | nfc_dev_dbg(&dev->interface->dev, "%s - protocol=%u", __func__, | 1811 | nfc_dev_dbg(&dev->interface->dev, "%s - protocol=%u", __func__, |
1813 | protocol); | 1812 | protocol); |
1814 | 1813 | ||
1815 | if (dev->poll_mod_count) { | 1814 | if (dev->poll_mod_count) { |
1816 | nfc_dev_err(&dev->interface->dev, | 1815 | nfc_dev_err(&dev->interface->dev, |
@@ -1908,7 +1907,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, | |||
1908 | if (dev->tgt_available_prots && | 1907 | if (dev->tgt_available_prots && |
1909 | !(dev->tgt_available_prots & (1 << NFC_PROTO_NFC_DEP))) { | 1908 | !(dev->tgt_available_prots & (1 << NFC_PROTO_NFC_DEP))) { |
1910 | nfc_dev_err(&dev->interface->dev, | 1909 | nfc_dev_err(&dev->interface->dev, |
1911 | "The target does not support DEP"); | 1910 | "The target does not support DEP"); |
1912 | rc = -EINVAL; | 1911 | rc = -EINVAL; |
1913 | goto error; | 1912 | goto error; |
1914 | } | 1913 | } |
@@ -1918,7 +1917,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, | |||
1918 | rc = rsp->status & PN533_CMD_RET_MASK; | 1917 | rc = rsp->status & PN533_CMD_RET_MASK; |
1919 | if (rc != PN533_CMD_RET_SUCCESS) { | 1918 | if (rc != PN533_CMD_RET_SUCCESS) { |
1920 | nfc_dev_err(&dev->interface->dev, | 1919 | nfc_dev_err(&dev->interface->dev, |
1921 | "Bringing DEP link up failed %d", rc); | 1920 | "Bringing DEP link up failed %d", rc); |
1922 | goto error; | 1921 | goto error; |
1923 | } | 1922 | } |
1924 | 1923 | ||
@@ -1982,13 +1981,13 @@ static int pn533_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, | |||
1982 | 1981 | ||
1983 | if (dev->poll_mod_count) { | 1982 | if (dev->poll_mod_count) { |
1984 | nfc_dev_err(&dev->interface->dev, | 1983 | nfc_dev_err(&dev->interface->dev, |
1985 | "Cannot bring the DEP link up while polling"); | 1984 | "Cannot bring the DEP link up while polling"); |
1986 | return -EBUSY; | 1985 | return -EBUSY; |
1987 | } | 1986 | } |
1988 | 1987 | ||
1989 | if (dev->tgt_active_prot) { | 1988 | if (dev->tgt_active_prot) { |
1990 | nfc_dev_err(&dev->interface->dev, | 1989 | nfc_dev_err(&dev->interface->dev, |
1991 | "There is already an active target"); | 1990 | "There is already an active target"); |
1992 | return -EBUSY; | 1991 | return -EBUSY; |
1993 | } | 1992 | } |
1994 | 1993 | ||
@@ -2533,17 +2532,15 @@ static int pn533_probe(struct usb_interface *interface, | |||
2533 | dev->out_frame = kmalloc(PN533_NORMAL_FRAME_MAX_LEN, GFP_KERNEL); | 2532 | dev->out_frame = kmalloc(PN533_NORMAL_FRAME_MAX_LEN, GFP_KERNEL); |
2534 | dev->out_urb = usb_alloc_urb(0, GFP_KERNEL); | 2533 | dev->out_urb = usb_alloc_urb(0, GFP_KERNEL); |
2535 | 2534 | ||
2536 | if (!dev->in_frame || !dev->out_frame || | 2535 | if (!dev->in_frame || !dev->out_frame || !dev->in_urb || !dev->out_urb) |
2537 | !dev->in_urb || !dev->out_urb) | ||
2538 | goto error; | 2536 | goto error; |
2539 | 2537 | ||
2540 | usb_fill_bulk_urb(dev->in_urb, dev->udev, | 2538 | usb_fill_bulk_urb(dev->in_urb, dev->udev, |
2541 | usb_rcvbulkpipe(dev->udev, in_endpoint), | 2539 | usb_rcvbulkpipe(dev->udev, in_endpoint), |
2542 | NULL, 0, NULL, dev); | 2540 | NULL, 0, NULL, dev); |
2543 | usb_fill_bulk_urb(dev->out_urb, dev->udev, | 2541 | usb_fill_bulk_urb(dev->out_urb, dev->udev, |
2544 | usb_sndbulkpipe(dev->udev, out_endpoint), | 2542 | usb_sndbulkpipe(dev->udev, out_endpoint), |
2545 | NULL, 0, | 2543 | NULL, 0, pn533_send_complete, dev); |
2546 | pn533_send_complete, dev); | ||
2547 | 2544 | ||
2548 | INIT_WORK(&dev->cmd_work, pn533_wq_cmd); | 2545 | INIT_WORK(&dev->cmd_work, pn533_wq_cmd); |
2549 | INIT_WORK(&dev->cmd_complete_work, pn533_wq_cmd_complete); | 2546 | INIT_WORK(&dev->cmd_complete_work, pn533_wq_cmd_complete); |