mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: John Stultz <john.stultz@linaro.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	Colin Cross <ccross@android.com>,
	Android Kernel Team <kernel-team@android.com>,
	Greg KH <gregkh@linuxfoundation.org>
Subject: [RFC][PATCH 3/3] staging: ion: Avoid using rt_mutexes directly.
Date: Mon, 16 Dec 2013 13:32:44 -0800	[thread overview]
Message-ID: <1387229564-19517-4-git-send-email-john.stultz@linaro.org> (raw)
In-Reply-To: <1387229564-19517-1-git-send-email-john.stultz@linaro.org>

RT_MUTEXES can be configured out of the kernel, causing compile
problems with ION.

Since there is no documentation as to why directly using rt_mutexes
is necessary (and very few drivers directly use rt_mutexes), simply
convert the ion_heap lock to a normal mutex.

Cc: Colin Cross <ccross@android.com>
Cc: Android Kernel Team <kernel-team@android.com>
Cc: Greg KH <gregkh@linuxfoundation.org>
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
 drivers/staging/android/ion/ion_heap.c | 20 ++++++++++----------
 drivers/staging/android/ion/ion_priv.h |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/android/ion/ion_heap.c b/drivers/staging/android/ion/ion_heap.c
index 9cf5622..88685da 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/ion/ion_heap.c
@@ -160,10 +160,10 @@ int ion_heap_pages_zero(struct page *page, size_t size, pgprot_t pgprot)
 
 void ion_heap_freelist_add(struct ion_heap *heap, struct ion_buffer *buffer)
 {
-	rt_mutex_lock(&heap->lock);
+	mutex_lock(&heap->lock);
 	list_add(&buffer->list, &heap->free_list);
 	heap->free_list_size += buffer->size;
-	rt_mutex_unlock(&heap->lock);
+	mutex_unlock(&heap->lock);
 	wake_up(&heap->waitqueue);
 }
 
@@ -171,9 +171,9 @@ size_t ion_heap_freelist_size(struct ion_heap *heap)
 {
 	size_t size;
 
-	rt_mutex_lock(&heap->lock);
+	mutex_lock(&heap->lock);
 	size = heap->free_list_size;
-	rt_mutex_unlock(&heap->lock);
+	mutex_unlock(&heap->lock);
 
 	return size;
 }
@@ -186,7 +186,7 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, size_t size)
 	if (ion_heap_freelist_size(heap) == 0)
 		return 0;
 
-	rt_mutex_lock(&heap->lock);
+	mutex_lock(&heap->lock);
 	if (size == 0)
 		size = heap->free_list_size;
 
@@ -198,7 +198,7 @@ size_t ion_heap_freelist_drain(struct ion_heap *heap, size_t size)
 		total_drained += buffer->size;
 		ion_buffer_destroy(buffer);
 	}
-	rt_mutex_unlock(&heap->lock);
+	mutex_unlock(&heap->lock);
 
 	return total_drained;
 }
@@ -213,16 +213,16 @@ static int ion_heap_deferred_free(void *data)
 		wait_event_freezable(heap->waitqueue,
 				     ion_heap_freelist_size(heap) > 0);
 
-		rt_mutex_lock(&heap->lock);
+		mutex_lock(&heap->lock);
 		if (list_empty(&heap->free_list)) {
-			rt_mutex_unlock(&heap->lock);
+			mutex_unlock(&heap->lock);
 			continue;
 		}
 		buffer = list_first_entry(&heap->free_list, struct ion_buffer,
 					  list);
 		list_del(&buffer->list);
 		heap->free_list_size -= buffer->size;
-		rt_mutex_unlock(&heap->lock);
+		mutex_unlock(&heap->lock);
 		ion_buffer_destroy(buffer);
 	}
 
@@ -235,7 +235,7 @@ int ion_heap_init_deferred_free(struct ion_heap *heap)
 
 	INIT_LIST_HEAD(&heap->free_list);
 	heap->free_list_size = 0;
-	rt_mutex_init(&heap->lock);
+	mutex_init(&heap->lock);
 	init_waitqueue_head(&heap->waitqueue);
 	heap->task = kthread_run(ion_heap_deferred_free, heap,
 				 "%s", heap->name);
diff --git a/drivers/staging/android/ion/ion_priv.h b/drivers/staging/android/ion/ion_priv.h
index fc8a4c3..df81ce1 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -159,7 +159,7 @@ struct ion_heap {
 	struct shrinker shrinker;
 	struct list_head free_list;
 	size_t free_list_size;
-	struct rt_mutex lock;
+	struct mutex lock;
 	wait_queue_head_t waitqueue;
 	struct task_struct *task;
 	int (*debug_show)(struct ion_heap *heap, struct seq_file *, void *);
-- 
1.8.3.2


  parent reply	other threads:[~2013-12-16 21:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-16 21:32 [RFC][PATCH 0/3] ION fixups for staging-next John Stultz
2013-12-16 21:32 ` [RFC][PATCH 1/3] staging: ion: Add HAVE_MEMBLOCK config dependency John Stultz
2013-12-16 21:32 ` [RFC][PATCH 2/3] staging: ion: Fix possible null pointer dereference John Stultz
2013-12-16 21:40   ` Greg KH
2013-12-17  0:26   ` Colin Cross
2013-12-17  0:37     ` John Stultz
2013-12-16 21:32 ` John Stultz [this message]
2013-12-17  0:17   ` [RFC][PATCH 3/3] staging: ion: Avoid using rt_mutexes directly Colin Cross
2013-12-17  1:22     ` John Stultz
2013-12-17  1:34       ` Colin Cross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1387229564-19517-4-git-send-email-john.stultz@linaro.org \
    --to=john.stultz@linaro.org \
    --cc=ccross@android.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome