Re: [PATCH 1/2] staging: vc04_services: remove duplicate mutex_lock_interruptible

2016-11-16 Thread Eric Anholt
Arnd Bergmann  writes:

> The driver tries to redefine mutex_lock_interruptible as an open-coded
> mutex_lock_killable, but that definition clashes with the normal
> mutex_lock_interruptible definition when CONFIG_DEBUG_LOCK_ALLOC
> is set:

These two are:

Acked-by: Eric Anholt 


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: vc04_services: remove duplicate mutex_lock_interruptible

2016-11-16 Thread Arnd Bergmann
The driver tries to redefine mutex_lock_interruptible as an open-coded
mutex_lock_killable, but that definition clashes with the normal
mutex_lock_interruptible definition when CONFIG_DEBUG_LOCK_ALLOC
is set:

staging/vc04_services/interface/vchiq_arm/vchiq_killable.h:67:0: error: 
"mutex_lock_interruptible" redefined [-Werror]
 #define mutex_lock_interruptible mutex_lock_interruptible_killable
include/linux/mutex.h:161:0: note: this is the location of the previous 
definition

This simply removes the private implementation and uses the
normal mutex_lock_killable directly.

We could do the same for the down_interruptible_killable here, but
it's better to just remove the semaphores entirely from the driver,
which also takes care of that.

Signed-off-by: Arnd Bergmann 
---
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c|  2 +-
 .../interface/vchiq_arm/vchiq_connected.c|  4 ++--
 .../vc04_services/interface/vchiq_arm/vchiq_core.c   | 20 ++--
 .../interface/vchiq_arm/vchiq_kern_lib.c |  4 ++--
 .../interface/vchiq_arm/vchiq_killable.h | 14 --
 5 files changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index d0435a05ea35..0d987898b4f8 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -554,7 +554,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned 
long arg)
ret = -EINVAL;
break;
}
-   rc = mutex_lock_interruptible(&instance->state->mutex);
+   rc = mutex_lock_killable(&instance->state->mutex);
if (rc != 0) {
vchiq_log_error(vchiq_arm_log_level,
"vchiq: connect: could not lock mutex for "
diff --git 
a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
index 5efc62ffb2f5..7ea29665bd0c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c
@@ -72,7 +72,7 @@ void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T 
callback)
 {
connected_init();
 
-   if (mutex_lock_interruptible(&g_connected_mutex) != 0)
+   if (mutex_lock_killable(&g_connected_mutex) != 0)
return;
 
if (g_connected)
@@ -107,7 +107,7 @@ void vchiq_call_connected_callbacks(void)
 
connected_init();
 
-   if (mutex_lock_interruptible(&g_connected_mutex) != 0)
+   if (mutex_lock_killable(&g_connected_mutex) != 0)
return;
 
for (i = 0; i <  g_num_deferred_callbacks; i++)
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index 7440db2ce40b..028e90bc1cdc 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -794,7 +794,7 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T 
*service,
WARN_ON(!(stride <= VCHIQ_SLOT_SIZE));
 
if (!(flags & QMFLAGS_NO_MUTEX_LOCK) &&
-   (mutex_lock_interruptible(&state->slot_mutex) != 0))
+   (mutex_lock_killable(&state->slot_mutex) != 0))
return VCHIQ_RETRY;
 
if (type == VCHIQ_MSG_DATA) {
@@ -863,7 +863,7 @@ queue_message(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T 
*service,
return VCHIQ_RETRY;
if (service->closing)
return VCHIQ_ERROR;
-   if (mutex_lock_interruptible(&state->slot_mutex) != 0)
+   if (mutex_lock_killable(&state->slot_mutex) != 0)
return VCHIQ_RETRY;
if (service->srvstate != VCHIQ_SRVSTATE_OPEN) {
/* The service has been closed */
@@ -1033,7 +1033,7 @@ queue_message_sync(VCHIQ_STATE_T *state, VCHIQ_SERVICE_T 
*service,
local = state->local;
 
if ((VCHIQ_MSG_TYPE(msgid) != VCHIQ_MSG_RESUME) &&
-   (mutex_lock_interruptible(&state->sync_mutex) != 0))
+   (mutex_lock_killable(&state->sync_mutex) != 0))
return VCHIQ_RETRY;
 
remote_event_wait(state, &local->sync_release);
@@ -1365,7 +1365,7 @@ resolve_bulks(VCHIQ_SERVICE_T *service, 
VCHIQ_BULK_QUEUE_T *queue)
WARN_ON(!((int)(queue->local_insert - queue->process) > 0));
WARN_ON(!((int)(queue->remote_insert - queue->process) > 0));
 
-   rc = mutex_lock_interruptible(&state->bulk_transfer_mutex);
+   rc = mutex_lock_killable(&state->bulk_transfer_mutex);