aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc/pn533.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/nfc/pn533.c')
-rw-r--r--drivers/nfc/pn533.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 97c440a8cd61..18e279d3e836 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -84,6 +84,10 @@ MODULE_DEVICE_TABLE(usb, pn533_table);
84#define PN533_LISTEN_TIME 2 84#define PN533_LISTEN_TIME 2
85 85
86/* frame definitions */ 86/* frame definitions */
87#define PN533_NORMAL_FRAME_MAX_LEN 262 /* 6 (PREAMBLE, SOF, LEN, LCS, TFI)
88 254 (DATA)
89 2 (DCS, postamble) */
90
87#define PN533_FRAME_TAIL_SIZE 2 91#define PN533_FRAME_TAIL_SIZE 2
88#define PN533_FRAME_SIZE(f) (sizeof(struct pn533_frame) + f->datalen + \ 92#define PN533_FRAME_SIZE(f) (sizeof(struct pn533_frame) + f->datalen + \
89 PN533_FRAME_TAIL_SIZE) 93 PN533_FRAME_TAIL_SIZE)
@@ -1165,8 +1169,7 @@ static void pn533_poll_create_mod_list(struct pn533 *dev,
1165 pn533_poll_add_mod(dev, PN533_LISTEN_MOD); 1169 pn533_poll_add_mod(dev, PN533_LISTEN_MOD);
1166} 1170}
1167 1171
1168static int pn533_start_poll_complete(struct pn533 *dev, void *arg, 1172static int pn533_start_poll_complete(struct pn533 *dev, u8 *params, int params_len)
1169 u8 *params, int params_len)
1170{ 1173{
1171 struct pn533_poll_response *resp; 1174 struct pn533_poll_response *resp;
1172 int rc; 1175 int rc;
@@ -1304,8 +1307,7 @@ static void pn533_wq_tg_get_data(struct work_struct *work)
1304} 1307}
1305 1308
1306#define ATR_REQ_GB_OFFSET 17 1309#define ATR_REQ_GB_OFFSET 17
1307static int pn533_init_target_complete(struct pn533 *dev, void *arg, 1310static int pn533_init_target_complete(struct pn533 *dev, u8 *params, int params_len)
1308 u8 *params, int params_len)
1309{ 1311{
1310 struct pn533_cmd_init_target_response *resp; 1312 struct pn533_cmd_init_target_response *resp;
1311 u8 frame, comm_mode = NFC_COMM_PASSIVE, *gb; 1313 u8 frame, comm_mode = NFC_COMM_PASSIVE, *gb;
@@ -1402,9 +1404,9 @@ static int pn533_poll_complete(struct pn533 *dev, void *arg,
1402 if (cur_mod->len == 0) { 1404 if (cur_mod->len == 0) {
1403 del_timer(&dev->listen_timer); 1405 del_timer(&dev->listen_timer);
1404 1406
1405 return pn533_init_target_complete(dev, arg, params, params_len); 1407 return pn533_init_target_complete(dev, params, params_len);
1406 } else { 1408 } else {
1407 rc = pn533_start_poll_complete(dev, arg, params, params_len); 1409 rc = pn533_start_poll_complete(dev, params, params_len);
1408 if (!rc) 1410 if (!rc)
1409 return rc; 1411 return rc;
1410 } 1412 }
@@ -2373,9 +2375,9 @@ static int pn533_probe(struct usb_interface *interface,
2373 goto error; 2375 goto error;
2374 } 2376 }
2375 2377
2376 dev->in_frame = kmalloc(dev->in_maxlen, GFP_KERNEL); 2378 dev->in_frame = kmalloc(PN533_NORMAL_FRAME_MAX_LEN, GFP_KERNEL);
2377 dev->in_urb = usb_alloc_urb(0, GFP_KERNEL); 2379 dev->in_urb = usb_alloc_urb(0, GFP_KERNEL);
2378 dev->out_frame = kmalloc(dev->out_maxlen, GFP_KERNEL); 2380 dev->out_frame = kmalloc(PN533_NORMAL_FRAME_MAX_LEN, GFP_KERNEL);
2379 dev->out_urb = usb_alloc_urb(0, GFP_KERNEL); 2381 dev->out_urb = usb_alloc_urb(0, GFP_KERNEL);
2380 2382
2381 if (!dev->in_frame || !dev->out_frame || 2383 if (!dev->in_frame || !dev->out_frame ||