[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>
This commit is contained in:
Mauro Carvalho Chehab
2013-03-09 11:34:56 -03:00
parent fe802fd92d
commit 80ccb51a0f
4 changed files with 9 additions and 25 deletions

View File

@@ -129,6 +129,8 @@ static void smsusb_onresponse(struct urb *urb)
smscore_translate_msg(phdr->msgType),
phdr->msgType, phdr->msgLength);
smsendian_handle_rx_message((struct SmsMsgData_ST *) phdr);
smscore_onresponse(dev->coredev, surb->cb);
surb->cb = NULL;
} else {
@@ -207,13 +209,14 @@ static int smsusb_sendrequest(void *context, void *buffer, size_t size)
struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) buffer;
int dummy;
if (dev->state != SMSUSB_ACTIVE)
return -ENOENT;
sms_debug("sending %s(%d) size: %d",
smscore_translate_msg(phdr->msgType), phdr->msgType,
phdr->msgLength);
if (dev->state != SMSUSB_ACTIVE)
return -ENOENT;
smsendian_handle_tx_message((struct SmsMsgData_ST *) phdr);
smsendian_handle_message_header((struct SmsMsgHdr_ST *)buffer);
return usb_bulk_msg(dev->udev, usb_sndbulkpipe(dev->udev, 2),
buffer, size, &dummy, 1000);