summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches-2.6.24/1171-introduce-resume-dependency.patch.patch
diff options
context:
space:
mode:
authormirko <mirko@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-12-12 11:58:53 +0000
committermirko <mirko@3c298f89-4303-0410-b956-a3cf2f4a3e73>2008-12-12 11:58:53 +0000
commitfc54b9bf158eea9cae647ce2c58f7d9989af173a (patch)
tree54644c1229434d7ee13c5872bda4129e34337fc0 /target/linux/s3c24xx/patches-2.6.24/1171-introduce-resume-dependency.patch.patch
parentd9f49b62b28ebd245587854efa484974d90debbf (diff)
changed Makefile and profiles, added patches for kernel 2.6.24
(stable-branch of Openmoko) git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13613 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/s3c24xx/patches-2.6.24/1171-introduce-resume-dependency.patch.patch')
-rw-r--r--target/linux/s3c24xx/patches-2.6.24/1171-introduce-resume-dependency.patch.patch102
1 files changed, 102 insertions, 0 deletions
diff --git a/target/linux/s3c24xx/patches-2.6.24/1171-introduce-resume-dependency.patch.patch b/target/linux/s3c24xx/patches-2.6.24/1171-introduce-resume-dependency.patch.patch
new file mode 100644
index 0000000000..f652e4f0df
--- /dev/null
+++ b/target/linux/s3c24xx/patches-2.6.24/1171-introduce-resume-dependency.patch.patch
@@ -0,0 +1,102 @@
+From f07f917faa2f85625277f4d2f5294a630a6b0fb1 Mon Sep 17 00:00:00 2001
+From: Andy Green <andy@openmoko.com>
+Date: Wed, 2 Jul 2008 22:37:58 +0100
+Subject: [PATCH] introduce-resume-dependency.patch
+
+Defines a way for drivers to defer execution of resume callbacks
+until one or more other driver they are dependent on has itself
+resumed.
+
+Signed-off-by: Andy Green <andy@openmoko.com>
+---
+ include/linux/resume-dependency.h | 78 +++++++++++++++++++++++++++++++++++++
+ 1 files changed, 78 insertions(+), 0 deletions(-)
+ create mode 100644 include/linux/resume-dependency.h
+
+diff --git a/include/linux/resume-dependency.h b/include/linux/resume-dependency.h
+new file mode 100644
+index 0000000..b13aa3e
+--- /dev/null
++++ b/include/linux/resume-dependency.h
+@@ -0,0 +1,78 @@
++#ifndef __RESUME_DEPENDENCY_H__
++#define __RESUME_DEPENDENCY_H__
++
++/* Resume dependency framework
++ *
++ * (C) 2008 Openmoko, Inc.
++ * Author: Andy Green <andy@openmoko.com>
++ *
++ * This program is free software; you can redistribute it and/or
++ * modify it under the terms of the GNU General Public License as
++ * published by the Free Software Foundation; version 2.1.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
++ * MA 02111-1307 USA
++ *
++ */
++
++#include <linux/list.h>
++
++struct resume_dependency {
++ struct list_head list;
++
++ void (*callback)(void *); /* called with context as arg */
++ void * context;
++ int called_flag; /* set to 1 after called, use for multi dep */
++};
++
++/* if you are a driver accept to have other drivers as dependencies, you need to
++ * instantiate a struct resume_dependency above, then initialize it by invoking
++ * init_resume_dependency_list() on it
++ */
++
++#define init_resume_dependency_list(_head) \
++ INIT_LIST_HEAD(&_head.list);
++
++
++/* if your resume function depends on something else being resumed first, you
++ * can register the dependency by calling this in your suspend function with
++ * head being the list held by the thing you are dependent on, and dep being
++ * your struct resume_dependency
++ */
++
++#define register_resume_dependency(_head, _dep) { \
++ _dep->called_flag = 0; \
++ list_add(&_dep->list, &_head->list); \
++}
++
++/* In the resume function that things can be dependent on, at the end you
++ * invoke this macro. This calls back the dependent resumes now it is safe to
++ * use the resumed thing they were dependent on.
++ */
++
++#define callback_all_resume_dependencies(_head) { \
++ struct list_head *_pos, *_q; \
++ struct resume_dependency *_dep; \
++\
++ list_for_each_safe(pos, _q, &_head.list) { \
++ _dep = list_entry(_pos, struct resume_dependency, list); \
++ _dep->called_flag = 1; \
++ (_dep->callback)(dep->context); \
++ list_del(_pos); \
++ } \
++}
++
++/* if your resume action is dependent on multiple drivers being resumed already,
++ * register the same callback with each driver you are dependent on, and check
++ * .called_flag for all of the struct resume_dependency. When they are all 1
++ * you know it is the last callback and you can resume, otherwise just return
++ */
++
++#endif
+--
+1.5.6.5
+