Commit e8f40531 authored by Waldemar Rymarkiewicz's avatar Waldemar Rymarkiewicz Committed by Samuel Ortiz

NFC: pn533: Use skb in __pn533_send_cmd_frame_asyn

__pn533_send_cmd_frame_async() should be frame type independent. So, don't
use pn533_frame type params and instead use skb for req and resp pointers.
Signed-off-by: default avatarWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 5b5a4437
...@@ -606,28 +606,27 @@ static int pn533_send_ack(struct pn533 *dev, gfp_t flags) ...@@ -606,28 +606,27 @@ static int pn533_send_ack(struct pn533 *dev, gfp_t flags)
return rc; return rc;
} }
static int __pn533_send_cmd_frame_async(struct pn533 *dev, static int __pn533_send_frame_async(struct pn533 *dev,
struct pn533_frame *out_frame, struct sk_buff *out,
struct pn533_frame *in_frame, struct sk_buff *in,
int in_frame_len, int in_len,
pn533_cmd_complete_t cmd_complete, pn533_cmd_complete_t cmd_complete,
void *arg) void *arg)
{ {
int rc; int rc;
dev->cmd = PN533_FRAME_CMD(out_frame); dev->cmd = PN533_FRAME_CMD(((struct pn533_frame *)out->data));
dev->cmd_complete = cmd_complete; dev->cmd_complete = cmd_complete;
dev->cmd_complete_arg = arg; dev->cmd_complete_arg = arg;
dev->out_urb->transfer_buffer = out_frame; dev->out_urb->transfer_buffer = out->data;
dev->out_urb->transfer_buffer_length = dev->out_urb->transfer_buffer_length = out->len;
PN533_FRAME_SIZE(out_frame);
dev->in_urb->transfer_buffer = in_frame; dev->in_urb->transfer_buffer = in->data;
dev->in_urb->transfer_buffer_length = in_frame_len; dev->in_urb->transfer_buffer_length = in_len;
print_hex_dump(KERN_DEBUG, "PN533 TX: ", DUMP_PREFIX_NONE, 16, 1, print_hex_dump(KERN_DEBUG, "PN533 TX: ", DUMP_PREFIX_NONE, 16, 1,
out_frame, PN533_FRAME_SIZE(out_frame), false); out->data, out->len, false);
rc = usb_submit_urb(dev->out_urb, GFP_KERNEL); rc = usb_submit_urb(dev->out_urb, GFP_KERNEL);
if (rc) if (rc)
...@@ -725,11 +724,8 @@ static int __pn533_send_async(struct pn533 *dev, u8 cmd_code, ...@@ -725,11 +724,8 @@ static int __pn533_send_async(struct pn533 *dev, u8 cmd_code,
mutex_lock(&dev->cmd_lock); mutex_lock(&dev->cmd_lock);
if (!dev->cmd_pending) { if (!dev->cmd_pending) {
rc = __pn533_send_cmd_frame_async(dev, rc = __pn533_send_frame_async(dev, req, resp, resp_len,
(struct pn533_frame *)req->data, pn533_send_async_complete, arg);
(struct pn533_frame *)resp->data,
resp_len, pn533_send_async_complete,
arg);
if (rc) if (rc)
goto error; goto error;
...@@ -844,10 +840,8 @@ static int pn533_send_cmd_direct_async(struct pn533 *dev, u8 cmd_code, ...@@ -844,10 +840,8 @@ static int pn533_send_cmd_direct_async(struct pn533 *dev, u8 cmd_code,
pn533_build_cmd_frame(cmd_code, req); pn533_build_cmd_frame(cmd_code, req);
rc = __pn533_send_cmd_frame_async(dev, (struct pn533_frame *)req->data, rc = __pn533_send_frame_async(dev, req, resp, resp_len,
(struct pn533_frame *)resp->data, pn533_send_async_complete, arg);
resp_len, pn533_send_async_complete,
arg);
if (rc < 0) { if (rc < 0) {
dev_kfree_skb(resp); dev_kfree_skb(resp);
kfree(arg); kfree(arg);
...@@ -875,12 +869,10 @@ static void pn533_wq_cmd(struct work_struct *work) ...@@ -875,12 +869,10 @@ static void pn533_wq_cmd(struct work_struct *work)
mutex_unlock(&dev->cmd_lock); mutex_unlock(&dev->cmd_lock);
__pn533_send_cmd_frame_async(dev, __pn533_send_frame_async(dev, cmd->req, cmd->resp,
(struct pn533_frame *)cmd->req->data, PN533_NORMAL_FRAME_MAX_LEN,
(struct pn533_frame *)cmd->resp->data, pn533_send_async_complete,
PN533_NORMAL_FRAME_MAX_LEN, cmd->arg);
pn533_send_async_complete,
cmd->arg);
kfree(cmd); kfree(cmd);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment