[Galaxy 3 Android Development] cdesai:
Difference in drivers/staging

diff -crB linux/drivers/staging/android/binder.c g3/drivers/staging/android/binder.c
*** linux/drivers/staging/android/binder.c	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/android/binder.c	2011-02-26 04:41:49.000000000 -0800
***************
*** 46,51 ****
--- 46,52 ----
static struct binder_node *binder_context_mgr_node;
static uid_t binder_context_mgr_uid = -1;
static int binder_last_id;
+ static struct workqueue_struct *binder_deferred_workqueue;

static int binder_read_proc_proc(char *page, char **start, off_t off,
int count, int *eof, void *data);
***************
*** 3025,3035 ****
int i;
for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) {
if (proc->pages[i]) {
binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder_release: %d: "
"page %d at %p not freed\n",
proc->pid, i,
!	proc->buffer + i * PAGE_SIZE);
__free_page(proc->pages[i]);
page_count++;
}
--- 3026,3039 ----
int i;
for (i = 0; i < proc->buffer_size / PAGE_SIZE; i++) {
if (proc->pages[i]) {
+	void *page_addr = proc->buffer + i * PAGE_SIZE;
binder_debug(BINDER_DEBUG_BUFFER_ALLOC,
"binder_release: %d: "
"page %d at %p not freed\n",
proc->pid, i,
!	page_addr);
!	unmap_kernel_range((unsigned long)page_addr,
!	PAGE_SIZE);
__free_page(proc->pages[i]);
page_count++;
}
***************
*** 3099,3105 ****
if (hlist_unhashed(&proc->deferred_work_node)) {
hlist_add_head(&proc->deferred_work_node,
&binder_deferred_list);
!	schedule_work(&binder_deferred_work);
}
mutex_unlock(&binder_deferred_lock);
}
--- 3103,3109 ----
if (hlist_unhashed(&proc->deferred_work_node)) {
hlist_add_head(&proc->deferred_work_node,
&binder_deferred_list);
!	queue_work(binder_deferred_workqueue, &binder_deferred_work);
}
mutex_unlock(&binder_deferred_lock);
}
***************
*** 3727,3732 ****
--- 3731,3740 ----
{
int ret;

+	binder_deferred_workqueue = create_singlethread_workqueue("binder");
+	if (!binder_deferred_workqueue)
+	return -ENOMEM;
+
binder_proc_dir_entry_root = proc_mkdir("binder", NULL);
if (binder_proc_dir_entry_root)
binder_proc_dir_entry_proc = proc_mkdir("proc",
diff -crB linux/drivers/staging/android/Kconfig g3/drivers/staging/android/Kconfig
*** linux/drivers/staging/android/Kconfig	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/android/Kconfig	2011-02-26 04:41:49.000000000 -0800
***************
*** 2,8 ****

config ANDROID
bool "Android Drivers"
-	depends on BROKEN
default N
---help---
Enable support for various drivers needed on the Android platform
--- 2,7 ----
diff -crB linux/drivers/staging/android/logger.c g3/drivers/staging/android/logger.c
*** linux/drivers/staging/android/logger.c	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/android/logger.c	2011-02-26 04:41:49.000000000 -0800
***************
*** 17,22 ****
--- 17,23 ----
* GNU General Public License for more details.
*/

+ #include <linux/sched.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
***************
*** 28,33 ****
--- 29,90 ----
#include <asm/ioctls.h>

/*
+ * Mark for GetLog (tkhwang)
+ */
+
+ struct struct_plat_log_mark {
+	u32 special_mark_1;
+	u32 special_mark_2;
+	u32 special_mark_3;
+	u32 special_mark_4;
+	void *p_main;
+	void *p_radio;
+	void *p_events;
+	void *p_system;
+ };
+
+ static struct struct_plat_log_mark plat_log_mark = {
+	.special_mark_1 = (('*' << 24) | ('^' << 16) | ('^' << 8) | ('*' << 0)),
+	.special_mark_2 = (('I' << 24) | ('n' << 16) | ('f' << 8) | ('o' << 0)),
+	.special_mark_3 = (('H' << 24) | ('e' << 16) | ('r' << 8) | ('e' << 0)),
+	.special_mark_4 = (('p' << 24) | ('l' << 16) | ('o' << 8) | ('g' << 0)),
+	.p_main = 0,
+	.p_radio = 0,
+	.p_events = 0,
+	.p_system = 0,
+ };
+
+ struct struct_marks_ver_mark {
+ u32 special_mark_1;
+ u32 special_mark_2;
+ u32 special_mark_3;
+ u32 special_mark_4;
+ u32 log_mark_version;
+ u32 framebuffer_mark_version;
+ void * this; /* 2?? ???? ???? ??? ?????.*/
+ u32 first_size; /* first memory block? size */
+ u32 first_start_addr; /* first memory block? Physical address */
+ u32 second_size; /* second memory block? size */
+ u32 second_start_addr; /* second memory block? Physical address */
+ };
+
+ static struct struct_marks_ver_mark marks_ver_mark = {
+	.special_mark_1 = (('*' << 24) | ('^' << 16) | ('^' << 8) | ('*' << 0)),
+	.special_mark_2 = (('I' << 24) | ('n' << 16) | ('f' << 8) | ('o' << 0)),
+	.special_mark_3 = (('H' << 24) | ('e' << 16) | ('r' << 8) | ('e' << 0)),
+	.special_mark_4 = (('v' << 24) | ('e' << 16) | ('r' << 8) | ('s' << 0)),
+	.log_mark_version = 1,
+	.framebuffer_mark_version = 1,
+	.this=&marks_ver_mark,
+	.first_size=128*1024*1024,
+	.first_start_addr=0x30000000,
+	.second_size=256*1024*1024,
+	.second_start_addr=0x40000000
+ };
+
+ static char klog_buf[256];
+
+ /*
* struct logger_log - represents a specific log, such as 'main' or 'radio'
*
* This structure lives from module insertion until module removal, so it does
***************
*** 309,314 ****
--- 366,386 ----
if (copy_from_user(log->buffer, buf + len, count - len))
return -EFAULT;

+ #if 1
+ /* [LINUSYS] added by khoonk for calculating boot-time on 20070508 */
+	memset(klog_buf,0,255);
+
+	if(strncmp(log->buffer + log->w_off, "!@", 2) == 0) {
+	if (count < 255)
+	memcpy(klog_buf,log->buffer + log->w_off, count);
+	else
+	memcpy(klog_buf,log->buffer + log->w_off, 255);
+
+	klog_buf[255]=0;
+ }
+ /* [LINUSYS] added by khoonk for calculating boot-time on 20070508 */
+ #endif
+
log->w_off = logger_offset(log->w_off + count);

return count;
***************
*** 376,381 ****
--- 448,462 ----
/* wake up any blocked readers */
wake_up_interruptible(&log->wq);

+ #if 1
+ /* [LINUSYS] added by khoonk for calculating boot-time on 20070508 */
+ if(strncmp(klog_buf, "!@", 2) == 0)
+	{
+	printk("%s\n",klog_buf);
+	}
+ /* [LINUSYS] added by khoonk for calculating boot-time on 20070508 */
+ #endif
+
return ret;
}

***************
*** 553,561 ****
.size = SIZE, \
};

! DEFINE_LOGGER_DEVICE(log_main, LOGGER_LOG_MAIN, 64*1024)
DEFINE_LOGGER_DEVICE(log_events, LOGGER_LOG_EVENTS, 256*1024)
! DEFINE_LOGGER_DEVICE(log_radio, LOGGER_LOG_RADIO, 64*1024)

static struct logger_log *get_log_from_minor(int minor)
{
--- 634,643 ----
.size = SIZE, \
};

! DEFINE_LOGGER_DEVICE(log_main, LOGGER_LOG_MAIN, 256*1024) /* 64K -> 256K */
DEFINE_LOGGER_DEVICE(log_events, LOGGER_LOG_EVENTS, 256*1024)
! DEFINE_LOGGER_DEVICE(log_radio, LOGGER_LOG_RADIO, 256*1024) /* 64K -> 256K */
! DEFINE_LOGGER_DEVICE(log_system, LOGGER_LOG_SYSTEM, 64*1024)

static struct logger_log *get_log_from_minor(int minor)
{
***************
*** 565,570 ****
--- 647,654 ----
return &log_events;
if (log_radio.misc.minor == minor)
return &log_radio;
+	if (log_system.misc.minor == minor)
+	return &log_system;
return NULL;
}

***************
*** 589,594 ****
--- 673,688 ----
{
int ret;

+	/*
+	* Mark for GetLog (tkhwang)
+	*/
+	plat_log_mark.p_main = _buf_log_main;
+	plat_log_mark.p_radio = _buf_log_radio;
+	plat_log_mark.p_events = _buf_log_events;
+	plat_log_mark.p_system = _buf_log_system;
+
+	marks_ver_mark.log_mark_version = 1;
+
ret = init_log(&log_main);
if (unlikely(ret))
goto out;
***************
*** 601,606 ****
--- 695,704 ----
if (unlikely(ret))
goto out;

+	ret = init_log(&log_system);
+	if (unlikely(ret))
+	goto out;
+
out:
return ret;
}
diff -crB linux/drivers/staging/android/logger.h g3/drivers/staging/android/logger.h
*** linux/drivers/staging/android/logger.h	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/android/logger.h	2011-02-26 04:41:49.000000000 -0800
***************
*** 32,37 ****
--- 32,38 ----

#define LOGGER_LOG_RADIO	"log_radio"	/* radio-related messages */
#define LOGGER_LOG_EVENTS	"log_events"	/* system/hardware events */
+ #define LOGGER_LOG_SYSTEM	"log_system"	/* system/framework messages */
#define LOGGER_LOG_MAIN	"log_main"	/* everything else */

#define LOGGER_ENTRY_MAX_LEN	(4*1024)
diff -crB linux/drivers/staging/android/lowmemorykiller.c g3/drivers/staging/android/lowmemorykiller.c
*** linux/drivers/staging/android/lowmemorykiller.c	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/android/lowmemorykiller.c	2011-02-26 04:41:49.000000000 -0800
***************
*** 34,39 ****
--- 34,40 ----
#include <linux/mm.h>
#include <linux/oom.h>
#include <linux/sched.h>
+ #include <linux/notifier.h>

static uint32_t lowmem_debug_level = 2;
static int lowmem_adj[6] = {
***************
*** 51,62 ****
--- 52,83 ----
};
static int lowmem_minfree_size = 4;

+ static struct task_struct *lowmem_deathpending;
+
#define lowmem_print(level, x...)	\
do {	\
if (lowmem_debug_level >= (level))	\
printk(x);	\
} while (0)

+ static int
+ task_notify_func(struct notifier_block *self, unsigned long val, void *data);
+
+ static struct notifier_block task_nb = {
+	.notifier_call	= task_notify_func,
+ };
+
+ static int
+ task_notify_func(struct notifier_block *self, unsigned long val, void *data)
+ {
+	struct task_struct *task = data;
+	if (task == lowmem_deathpending) {
+	lowmem_deathpending = NULL;
+	task_free_unregister(&task_nb);
+	}
+	return NOTIFY_OK;
+ }
+
static int lowmem_shrink(int nr_to_scan, gfp_t gfp_mask)
{
struct task_struct *p;
***************
*** 71,76 ****
--- 92,107 ----
int other_free = global_page_state(NR_FREE_PAGES);
int other_file = global_page_state(NR_FILE_PAGES);

+	/*
+	* If we already have a death outstanding, then
+	* bail out right away; indicating to vmscan
+	* that we have nothing further to offer on
+	* this pass.
+	*
+	*/
+	if (lowmem_deathpending)
+	return 0;
+
if (lowmem_adj_size < array_size)
array_size = lowmem_adj_size;
if (lowmem_minfree_size < array_size)
***************
*** 100,114 ****
read_lock(&tasklist_lock);
for_each_process(p) {
struct mm_struct *mm;
int oom_adj;

task_lock(p);
mm = p->mm;
!	if (!mm) {
task_unlock(p);
continue;
}
!	oom_adj = mm->oom_adj;
if (oom_adj < min_adj) {
task_unlock(p);
continue;
--- 131,147 ----
read_lock(&tasklist_lock);
for_each_process(p) {
struct mm_struct *mm;
+	struct signal_struct *sig;
int oom_adj;

task_lock(p);
mm = p->mm;
!	sig = p->signal;
!	if (!mm || !sig) {
task_unlock(p);
continue;
}
!	oom_adj = sig->oom_adj;
if (oom_adj < min_adj) {
task_unlock(p);
continue;
***************
*** 134,142 ****
lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n",
selected->pid, selected->comm,
selected_oom_adj, selected_tasksize);
force_sig(SIGKILL, selected);
rem -= selected_tasksize;
!	}
lowmem_print(4, "lowmem_shrink %d, %x, return %d\n",
nr_to_scan, gfp_mask, rem);
read_unlock(&tasklist_lock);
--- 167,178 ----
lowmem_print(1, "send sigkill to %d (%s), adj %d, size %d\n",
selected->pid, selected->comm,
selected_oom_adj, selected_tasksize);
+	lowmem_deathpending = selected;
+	task_free_register(&task_nb);
force_sig(SIGKILL, selected);
rem -= selected_tasksize;
!	} else
!	rem = -1;
lowmem_print(4, "lowmem_shrink %d, %x, return %d\n",
nr_to_scan, gfp_mask, rem);
read_unlock(&tasklist_lock);
diff -crB linux/drivers/staging/android/ram_console.c g3/drivers/staging/android/ram_console.c
*** linux/drivers/staging/android/ram_console.c	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/android/ram_console.c	2011-02-26 04:41:49.000000000 -0800
***************
*** 146,151 ****
--- 146,159 ----
.index	= -1,
};

+ void ram_console_enable_console(int enabled)
+ {
+	if (enabled)
+	ram_console.flags |= CON_ENABLED;
+	else
+	ram_console.flags &= ~CON_ENABLED;
+ }
+
static void __init
ram_console_save_old(struct ram_console_buffer *buffer, char *dest)
{
***************
*** 404,410 ****
#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
console_initcall(ram_console_early_init);
#else
! module_init(ram_console_module_init);
#endif
late_initcall(ram_console_late_init);

--- 412,418 ----
#ifdef CONFIG_ANDROID_RAM_CONSOLE_EARLY_INIT
console_initcall(ram_console_early_init);
#else
! postcore_initcall(ram_console_module_init);
#endif
late_initcall(ram_console_late_init);

diff -crB linux/drivers/staging/android/timed_gpio.c g3/drivers/staging/android/timed_gpio.c
*** linux/drivers/staging/android/timed_gpio.c	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/android/timed_gpio.c	2011-02-26 04:41:49.000000000 -0800
***************
*** 106,115 ****
gpio_dat->dev.name = cur_gpio->name;
gpio_dat->dev.get_time = gpio_get_time;
gpio_dat->dev.enable = gpio_enable;
!	ret = timed_output_dev_register(&gpio_dat->dev);
if (ret < 0) {
!	for (j = 0; j < i; j++)
timed_output_dev_unregister(&gpio_data[i].dev);
kfree(gpio_data);
return ret;
}
--- 106,122 ----
gpio_dat->dev.name = cur_gpio->name;
gpio_dat->dev.get_time = gpio_get_time;
gpio_dat->dev.enable = gpio_enable;
!	ret = gpio_request(cur_gpio->gpio, cur_gpio->name);
!	if (ret >= 0) {
!	ret = timed_output_dev_register(&gpio_dat->dev);
!	if (ret < 0)
!	gpio_free(cur_gpio->gpio);
!	}
if (ret < 0) {
!	for (j = 0; j < i; j++) {
timed_output_dev_unregister(&gpio_data[i].dev);
+	gpio_free(gpio_data[i].gpio);
+	}
kfree(gpio_data);
return ret;
}
***************
*** 131,138 ****
struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev);
int i;

!	for (i = 0; i < pdata->num_gpios; i++)
timed_output_dev_unregister(&gpio_data[i].dev);

kfree(gpio_data);

--- 138,147 ----
struct timed_gpio_data *gpio_data = platform_get_drvdata(pdev);
int i;

!	for (i = 0; i < pdata->num_gpios; i++) {
timed_output_dev_unregister(&gpio_data[i].dev);
+	gpio_free(gpio_data[i].gpio);
+	}

kfree(gpio_data);

diff -crB linux/drivers/staging/android/timed_output.c g3/drivers/staging/android/timed_output.c
*** linux/drivers/staging/android/timed_output.c	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/android/timed_output.c	2011-02-26 04:41:49.000000000 -0800
***************
*** 41,47 ****
struct timed_output_dev *tdev = dev_get_drvdata(dev);
int value;

!	sscanf(buf, "%d", &value);
tdev->enable(tdev, value);

return size;
--- 41,49 ----
struct timed_output_dev *tdev = dev_get_drvdata(dev);
int value;

!	if (sscanf(buf, "%d", &value) != 1)
!	return -EINVAL;
!
tdev->enable(tdev, value);

return size;
diff -crB linux/drivers/staging/Makefile g3/drivers/staging/Makefile
*** linux/drivers/staging/Makefile	2010-02-23 07:38:51.000000000 -0800
--- g3/drivers/staging/Makefile	2011-02-26 04:41:49.000000000 -0800
***************
*** 26,32 ****
obj-$(CONFIG_INPUT_MIMIO)	+= mimio/
obj-$(CONFIG_TRANZPORT)	+= frontier/
obj-$(CONFIG_ANDROID)	+= android/
! obj-$(CONFIG_ANDROID)	+= dream/
obj-$(CONFIG_DST)	+= dst/
obj-$(CONFIG_POHMELFS)	+= pohmelfs/
obj-$(CONFIG_B3DFG)	+= b3dfg/
--- 26,32 ----
obj-$(CONFIG_INPUT_MIMIO)	+= mimio/
obj-$(CONFIG_TRANZPORT)	+= frontier/
obj-$(CONFIG_ANDROID)	+= android/
! obj-$(CONFIG_STAGING_DREAM)	+= dream/
obj-$(CONFIG_DST)	+= dst/
obj-$(CONFIG_POHMELFS)	+= pohmelfs/
obj-$(CONFIG_B3DFG)	+= b3dfg/