aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShow Liu <show.liu@linaro.org>2014-05-20 15:53:56 +0800
committerShow Liu <show.liu@linaro.org>2014-05-20 15:53:56 +0800
commitd6ff5c03dd412b87f7728ea66556eb4b99253c01 (patch)
treedb7f4f1e578d25526e4f37639cc450bc58450312
parentb79e2c2c98bb495368c6312a683a9b9eccdebb13 (diff)
downloadlinaro-lsk-d6ff5c03dd412b87f7728ea66556eb4b99253c01.tar.gz
upgrade kds driver
-rwxr-xr-xdrivers/base/kds/Kbuild1
-rwxr-xr-xdrivers/base/kds/Kconfig1
-rwxr-xr-xdrivers/base/kds/Makefile3
-rwxr-xr-xdrivers/base/kds/kds.c17
-rwxr-xr-xdrivers/base/kds/sconscript21
-rwxr-xr-xinclude/linux/kds.h4
6 files changed, 32 insertions, 15 deletions
diff --git a/drivers/base/kds/Kbuild b/drivers/base/kds/Kbuild
index 74db4816472..a88acd8fdce 100755
--- a/drivers/base/kds/Kbuild
+++ b/drivers/base/kds/Kbuild
@@ -13,5 +13,6 @@
#
+
obj-$(CONFIG_KDS) += kds.o
obj-$(CONFIG_KDS_TEST) += kds_test.o
diff --git a/drivers/base/kds/Kconfig b/drivers/base/kds/Kconfig
index 3efdb5f464f..5f96165f67d 100755
--- a/drivers/base/kds/Kconfig
+++ b/drivers/base/kds/Kconfig
@@ -13,6 +13,7 @@
#
+
config KDS
tristate "Kernel dependency system"
help
diff --git a/drivers/base/kds/Makefile b/drivers/base/kds/Makefile
index 03d2626df23..364d1515c1a 100755
--- a/drivers/base/kds/Makefile
+++ b/drivers/base/kds/Makefile
@@ -1,5 +1,5 @@
#
-# (C) COPYRIGHT 2011-2012 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2011-2013 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -13,6 +13,7 @@
#
+
# linux build system bootstrap for out-of-tree module
# default to building for the host
diff --git a/drivers/base/kds/kds.c b/drivers/base/kds/kds.c
index aada2da646a..151cf7c8e35 100755
--- a/drivers/base/kds/kds.c
+++ b/drivers/base/kds/kds.c
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2012-2013 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -15,6 +15,8 @@
+
+
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/spinlock.h>
@@ -25,6 +27,7 @@
#include <linux/workqueue.h>
#include <linux/kds.h>
+#include <asm/atomic.h>
#define KDS_LINK_TRIGGERED (1u << 0)
#define KDS_LINK_EXCLUSIVE (1u << 1)
@@ -41,6 +44,7 @@ struct kds_resource_set
void *callback_extra_parameter;
struct list_head callback_link;
struct work_struct callback_work;
+ atomic_t cb_queued;
/* This is only initted when kds_waitall() is called. */
wait_queue_head_t wake;
@@ -97,6 +101,8 @@ static void kds_queued_callback(struct work_struct *work)
struct kds_resource_set *rset;
rset = container_of(work, struct kds_resource_set, callback_work);
+ atomic_dec(&rset->cb_queued);
+
kds_do_user_callback(rset);
}
@@ -107,6 +113,9 @@ static void kds_callback_perform(struct kds_resource_set *rset)
else
{
int result;
+
+ atomic_inc(&rset->cb_queued);
+
result = queue_work(rset->cb->wq, &rset->callback_work);
/* if we got a 0 return it means we've triggered the same rset twice! */
WARN_ON(!result);
@@ -172,6 +181,7 @@ int kds_async_waitall(
rset->callback_extra_parameter = callback_extra_parameter;
INIT_LIST_HEAD(&rset->callback_link);
INIT_WORK(&rset->callback_work, kds_queued_callback);
+ atomic_set(&rset->cb_queued, 0);
for (i = 0; i < number_resources; i++)
{
@@ -280,6 +290,7 @@ struct kds_resource_set *kds_waitall(
init_waitqueue_head(&rset->wake);
INIT_LIST_HEAD(&rset->callback_link);
INIT_WORK(&rset->callback_work, kds_queued_callback);
+ atomic_set(&rset->cb_queued, 0);
spin_lock_irqsave(&kds_lock, lflags);
@@ -478,6 +489,7 @@ static void __kds_resource_set_release_common(struct kds_resource_set *rset)
void kds_resource_set_release(struct kds_resource_set **pprset)
{
struct kds_resource_set *rset;
+ int queued;
rset = cmpxchg(pprset,*pprset,NULL);
@@ -494,7 +506,8 @@ void kds_resource_set_release(struct kds_resource_set **pprset)
* Caller is responsible for guaranteeing that callback work is not
* pending (i.e. its running or completed) prior to calling release.
*/
- BUG_ON(work_pending(&rset->callback_work));
+ queued = atomic_read(&rset->cb_queued);
+ BUG_ON(queued);
/* free the resource set */
kfree(rset);
diff --git a/drivers/base/kds/sconscript b/drivers/base/kds/sconscript
index 23f8eca4cdc..5666d6bfb1a 100755
--- a/drivers/base/kds/sconscript
+++ b/drivers/base/kds/sconscript
@@ -1,5 +1,5 @@
#
-# (C) COPYRIGHT 2010-2012 ARM Limited. All rights reserved.
+# (C) COPYRIGHT 2010-2013 ARM Limited. All rights reserved.
#
# This program is free software and is provided to you under the terms of the
# GNU General Public License version 2 as published by the Free Software
@@ -13,10 +13,16 @@
#
+
import os
import re
Import('env')
+#Android uses sync_pt to accomplish KDS functionality.
+#Midgard KDS is not used by Android
+if env['os'] == 'android':
+ Return()
+
# If KDS is built into the kernel already we skip building the module ourselves
linux_config_file = os.path.normpath(os.environ['KDIR']) + '/.config'
search_term = '^[\ ]*CONFIG_KDS[\ ]*=[\ ]*y'
@@ -34,20 +40,13 @@ src = [Glob('#kernel/drivers/base/kds/*.c'), Glob('#kernel/include/linux/*.h'),
env.Append( CPPPATH = '#kernel/include' )
-arch = env['arch']
-# translate into something Linux understands
-if arch == 'x86_32':
- arch = 'x86'
-elif 'arm' in arch:
- arch = 'arm'
-
if Glob('tests/sconscript'):
SConscript( 'tests/sconscript' )
if env.GetOption('clean') :
# Clean KDS module
if build_kds:
- env.Execute(Action("make ARCH=%s clean" % arch, '[CLEAN] kds'))
+ env.Execute(Action("make clean", '[CLEAN] kds'))
cmd = env.Command('$STATIC_LIB_PATH/kds.ko', src, [])
env.ProgTarget('kds', cmd)
@@ -58,13 +57,13 @@ if env.GetOption('clean') :
else:
# Build KDS module
if build_kds:
- makeAction=Action("cd ${SOURCE.dir} && make kds ARCH=%s && cp kds.ko $STATIC_LIB_PATH/" % arch, '$MAKECOMSTR')
+ makeAction=Action("cd ${SOURCE.dir} && make kds && cp kds.ko $STATIC_LIB_PATH/", '$MAKECOMSTR')
cmd = env.Command('$STATIC_LIB_PATH/kds.ko', src, [makeAction])
env.ProgTarget('kds', cmd)
# Build KDS test module
if int(env['unit']) == 1:
- makeActionTest=Action("cd ${SOURCE.dir} && make kds_test ARCH=%s && cp kds_test.ko $STATIC_LIB_PATH/" %arch, '$MAKECOMSTR')
+ makeActionTest=Action("cd ${SOURCE.dir} && make kds_test && cp kds_test.ko $STATIC_LIB_PATH/", '$MAKECOMSTR')
cmdTest = env.Command('$STATIC_LIB_PATH/kds_test.ko', src, [makeActionTest])
env.ProgTarget('kds', cmdTest)
if build_kds:
diff --git a/include/linux/kds.h b/include/linux/kds.h
index 73168657b3c..0ba994db08e 100755
--- a/include/linux/kds.h
+++ b/include/linux/kds.h
@@ -1,6 +1,6 @@
/*
*
- * (C) COPYRIGHT 2012 ARM Limited. All rights reserved.
+ * (C) COPYRIGHT ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the
* GNU General Public License version 2 as published by the Free Software
@@ -15,6 +15,8 @@
+
+
#ifndef _KDS_H_
#define _KDS_H_