aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb/siano
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2013-03-09 09:34:56 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-03-21 06:46:18 -0400
commit80ccb51a0f970ab0935a8be70b677ecbcdf74e3e (patch)
treecd3edecad8522016a7de2545d34468c09dc511ab /drivers/media/usb/siano
parentfe802fd92d6abd1fce2ae8d03a073807d25e9453 (diff)
[media] siano: simplify message endianness logic
Currently, every time a message is sent or received, the endiannes need to be fixed on big endian machines. This is currently done on every call to the send API, and on every msg reception logic. Instead of doing that, move it to the send/receive functions. That simplifies the logic and avoids the risk of forgetting to fix it somewhere. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/siano')
-rw-r--r--drivers/media/usb/siano/smsusb.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c
index 751c0d6d98b8..acd3d1e82e03 100644
--- a/drivers/media/usb/siano/smsusb.c
+++ b/drivers/media/usb/siano/smsusb.c
@@ -129,6 +129,8 @@ static void smsusb_onresponse(struct urb *urb)
129 smscore_translate_msg(phdr->msgType), 129 smscore_translate_msg(phdr->msgType),
130 phdr->msgType, phdr->msgLength); 130 phdr->msgType, phdr->msgLength);
131 131
132 smsendian_handle_rx_message((struct SmsMsgData_ST *) phdr);
133
132 smscore_onresponse(dev->coredev, surb->cb); 134 smscore_onresponse(dev->coredev, surb->cb);
133 surb->cb = NULL; 135 surb->cb = NULL;
134 } else { 136 } else {
@@ -207,13 +209,14 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size)
207 struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) buffer; 209 struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) buffer;
208 int dummy; 210 int dummy;
209 211
212 if (dev->state != SMSUSB_ACTIVE)
213 return -ENOENT;
214
210 sms_debug("sending %s(%d) size: %d", 215 sms_debug("sending %s(%d) size: %d",
211 smscore_translate_msg(phdr->msgType), phdr->msgType, 216 smscore_translate_msg(phdr->msgType), phdr->msgType,
212 phdr->msgLength); 217 phdr->msgLength);
213 218
214 if (dev->state != SMSUSB_ACTIVE) 219 smsendian_handle_tx_message((struct SmsMsgData_ST *) phdr);
215 return -ENOENT;
216
217 smsendian_handle_message_header((struct SmsMsgHdr_ST *)buffer); 220 smsendian_handle_message_header((struct SmsMsgHdr_ST *)buffer);
218 return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2), 221 return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2),
219 buffer, size, &dummy, 1000); 222 buffer, size, &dummy, 1000);