Use const pointer for chopstx_poll.
authorNIIBE Yutaka <gniibe@fsij.org>
Thu, 16 Nov 2017 00:17:33 +0000 (09:17 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Thu, 16 Nov 2017 00:17:33 +0000 (09:17 +0900)
ChangeLog
chopstx
src/usb-ccid.c

index f677777..5c4bf2c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2017-11-16  NIIBE Yutaka  <gniibe@fsij.org>
+
+       * src/usb-ccid.c (ccid_thread): Use constant pointer for
+       chopstx_poll.
+       (poll_event_intr): Remove.
+
 2017-11-15  NIIBE Yutaka  <gniibe@fsij.org>
 
        * src/usb-ccid.c (usb_event_handle): Allow sleep on suspend.
diff --git a/chopstx b/chopstx
index bbe09de..3552fc5 160000 (submodule)
--- a/chopstx
+++ b/chopstx
@@ -1 +1 @@
-Subproject commit bbe09de209d0bafd1b9a089b328e7e64ff9bbe2f
+Subproject commit 3552fc5615fff7c7be3f96a0e7e9ac81470a82cb
index 471cea1..f78f763 100644 (file)
@@ -1665,24 +1665,18 @@ usb_event_handle (struct usb_dev *dev)
   return 0;
 }
 
-static void
-poll_event_intr (uint32_t *timeout_p,
-                struct eventflag *ev, chopstx_intr_t *intr)
-{
-  chopstx_poll_cond_t poll_desc;
-  struct chx_poll_head *pd_array[2] = {
-    (struct chx_poll_head *)intr,
-    (struct chx_poll_head *)&poll_desc
-  };
 
-  eventflag_prepare_poll (ev, &poll_desc);
-  chopstx_poll (timeout_p, 2, pd_array);
-}
+static chopstx_intr_t interrupt;
+static chopstx_poll_cond_t cond_poll_desc;
+static struct chx_poll_head *const pd_array[] = {
+  (struct chx_poll_head *const)&interrupt,
+  (struct chx_poll_head *const)&cond_poll_desc
+};
+#define PD_SIZE (sizeof (pd_array)/sizeof (struct chx_poll_head *))
 
 void *
 ccid_thread (void *arg)
 {
-  chopstx_intr_t interrupt;
   uint32_t timeout;
   struct usb_dev dev;
   struct ccid *c = &ccid;
@@ -1725,7 +1719,9 @@ ccid_thread (void *arg)
       else
        timeout_p = NULL;
 
-      poll_event_intr (timeout_p, &c->ccid_comm, &interrupt);
+      eventflag_prepare_poll (&c->ccid_comm, &cond_poll_desc);
+      chopstx_poll (timeout_p, PD_SIZE, pd_array);
+
       if (interrupt.ready)
        {
          if (usb_event_handle (&dev) == 0)