Merge branch 'work.compat' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux-2.6-microblaze.git] / net / bluetooth / hidp / core.c
index 7962111..a442e21 100644 (file)
@@ -431,8 +431,8 @@ static void hidp_del_timer(struct hidp_session *session)
                del_timer(&session->timer);
 }
 
-static void hidp_process_report(struct hidp_session *session,
-                               int type, const u8 *data, int len, int intr)
+static void hidp_process_report(struct hidp_session *session, int type,
+                               const u8 *data, unsigned int len, int intr)
 {
        if (len > HID_MAX_BUFFER_SIZE)
                len = HID_MAX_BUFFER_SIZE;
@@ -775,7 +775,7 @@ static int hidp_setup_hid(struct hidp_session *session,
        hid->version = req->version;
        hid->country = req->country;
 
-       strncpy(hid->name, req->name, sizeof(req->name) - 1);
+       strncpy(hid->name, req->name, sizeof(hid->name));
 
        snprintf(hid->phys, sizeof(hid->phys), "%pMR",
                 &l2cap_pi(session->ctrl_sock->sk)->chan->src);
@@ -1074,6 +1074,10 @@ static int hidp_session_start_sync(struct hidp_session *session)
 static void hidp_session_terminate(struct hidp_session *session)
 {
        atomic_inc(&session->terminate);
+       /*
+        * See the comment preceding the call to wait_woken()
+        * in hidp_session_run().
+        */
        wake_up_interruptible(&hidp_session_wq);
 }
 
@@ -1193,8 +1197,6 @@ static void hidp_session_run(struct hidp_session *session)
                 *    thread is woken up by ->sk_state_changed().
                 */
 
-               /* Ensure session->terminate is updated */
-               smp_mb__before_atomic();
                if (atomic_read(&session->terminate))
                        break;
 
@@ -1228,14 +1230,15 @@ static void hidp_session_run(struct hidp_session *session)
                hidp_process_transmit(session, &session->ctrl_transmit,
                                      session->ctrl_sock);
 
+               /*
+                * wait_woken() performs the necessary memory barriers
+                * for us; see the header comment for this primitive.
+                */
                wait_woken(&wait, TASK_INTERRUPTIBLE, MAX_SCHEDULE_TIMEOUT);
        }
        remove_wait_queue(&hidp_session_wq, &wait);
 
        atomic_inc(&session->terminate);
-
-       /* Ensure session->terminate is updated */
-       smp_mb__after_atomic();
 }
 
 static int hidp_session_wake_function(wait_queue_entry_t *wait,