From: Ziggy Date: Wed, 16 Jan 2013 21:07:37 +0000 (-0500) Subject: Code cleanup and re-formatting X-Git-Url: https://ziggy471.com/git/gitweb.cgi?p=ziggy471-sgs3-jb.git;a=commitdiff;h=5cdeaf64a1462091e57eb9759999081edc8f768e Code cleanup and re-formatting --- --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -277,15 +277,7 @@ void __init smp_setup_processor_id(void) for (i = 1; i < NR_CPUS; ++i) cpu_logical_map(i) = i == cpu ? 0 : i; - printk(KERN_INFO "Booting AnthraX on physical CPU %d\n", cpu); - printk(KERN_INFO " "); - printk(KERN_INFO "........................................................................."); - printk(KERN_INFO "This software is not authorized for public use or distribution. "); - printk(KERN_INFO "see http://anthrax-kernels.us for details and use restrictions."); - printk(KERN_INFO "........................................................................."); - printk(KERN_INFO " "); - printk(KERN_INFO "Copyright(C) 2011-2012 Chad Goodman, All Rights Reserved. "); - printk(KERN_INFO " "); + printk(KERN_INFO "Booting Linux on physical CPU %d\n", cpu); } /* --- a/arch/arm/mach-msm/cpufreq.c +++ b/arch/arm/mach-msm/cpufreq.c @@ -363,10 +363,6 @@ static int __cpuinit msm_cpufreq_init(st init_completion(&cpu_work->complete); #endif -#ifdef CONFIG_MSM_CPU_FREQ_SET_MIN_MAX - policy->min = CONFIG_MSM_CPU_FREQ_MIN; - policy->max = CONFIG_MSM_CPU_FREQ_MAX; -#endif return 0; } @@ -379,8 +375,6 @@ static int msm_cpufreq_suspend(void) per_cpu(cpufreq_suspend, cpu).device_suspended = 1; mutex_unlock(&per_cpu(cpufreq_suspend, cpu).suspend_mutex); } - if (num_online_cpus() > 1) - cpu_down(1); return NOTIFY_DONE; } --- a/arch/arm/mach-msm/msm_mpdecision.c +++ b/arch/arm/mach-msm/msm_mpdecision.c @@ -37,11 +37,11 @@ #define DEBUG 0 -#define MPDEC_TAG "[AnThRaX MPDEC]: " -#define MSM_MPDEC_STARTDELAY 20000 -#define MSM_MPDEC_DELAY 70 -#define MSM_MPDEC_PAUSE 10000 -#define MSM_MPDEC_IDLE_FREQ 486000 +#define MPDEC_TAG "[AnThRaX MPDEC]: " +#define MSM_MPDEC_STARTDELAY 20000 +#define MSM_MPDEC_DELAY 70 +#define MSM_MPDEC_PAUSE 10000 +#define MSM_MPDEC_IDLE_FREQ 486000 enum { MSM_MPDEC_DISABLED = 0, @@ -68,16 +68,16 @@ static struct msm_mpdec_tuners { unsigned int pause; bool scroff_single_core; unsigned long int idle_freq; - unsigned int max_cpus; - unsigned int min_cpus; + unsigned int max_cpus; + unsigned int min_cpus; } msm_mpdec_tuners_ins = { .startdelay = MSM_MPDEC_STARTDELAY, .delay = MSM_MPDEC_DELAY, .pause = MSM_MPDEC_PAUSE, .scroff_single_core = true, .idle_freq = MSM_MPDEC_IDLE_FREQ, - .max_cpus = CONFIG_NR_CPUS, - .min_cpus = 1, + .max_cpus = CONFIG_NR_CPUS, + .min_cpus = 1, }; static unsigned int NwNs_Threshold[8] = {12, 0, 25, 20, 32, 28, 0, 35}; @@ -91,50 +91,47 @@ bool was_paused = false; static unsigned long get_rate(int cpu) { - return acpuclk_get_rate(cpu); + return acpuclk_get_rate(cpu); } static int get_slowest_cpu(void) { - int i, cpu = 0; - unsigned long rate, slow_rate = 0; + int i, cpu = 0; + unsigned long rate, slow_rate = 0; - for (i = 1; i < CONFIG_NR_CPUS; i++) { - if (!cpu_online(i)) - continue; - - rate = get_rate(i); - if (slow_rate == 0) { - slow_rate = rate; - } - - if ((rate <= slow_rate) && (slow_rate != 0)) { - cpu = i; - slow_rate = rate; - } - } + for (i = 1; i < CONFIG_NR_CPUS; i++) { + if (!cpu_online(i)) + continue; + + rate = get_rate(i); + if (slow_rate == 0) + slow_rate = rate; + + if ((rate <= slow_rate) && (slow_rate != 0)) { + cpu = i; + slow_rate = rate; + } + } - return cpu; + return cpu; } static unsigned long get_slowest_cpu_rate(void) { - int i = 0; - unsigned long rate, slow_rate = 0; + int i = 0; + unsigned long rate, slow_rate = 0; - for (i = 0; i < CONFIG_NR_CPUS; i++) { - if (!cpu_online(i)) - continue; - rate = get_rate(i); - if ((rate < slow_rate) && (slow_rate != 0)) { - slow_rate = rate; - } - if (slow_rate == 0) { - slow_rate = rate; - } - } + for (i = 0; i < CONFIG_NR_CPUS; i++) { + if (!cpu_online(i)) + continue; + rate = get_rate(i); + if ((rate < slow_rate) && (slow_rate != 0)) + slow_rate = rate; + if (slow_rate == 0) + slow_rate = rate; + } - return slow_rate; + return slow_rate; } static int mp_decision(void) @@ -169,18 +166,16 @@ static int mp_decision(void) if (nr_cpu_online) { index = (nr_cpu_online - 1) * 2; if ((nr_cpu_online < CONFIG_NR_CPUS) && (rq_depth >= NwNs_Threshold[index])) { - if ((total_time >= TwTs_Threshold[index]) && - (nr_cpu_online < msm_mpdec_tuners_ins.max_cpus)) { + if ((total_time >= TwTs_Threshold[index]) && (nr_cpu_online < msm_mpdec_tuners_ins.max_cpus)) { new_state = MSM_MPDEC_UP; - if (get_slowest_cpu_rate() <= msm_mpdec_tuners_ins.idle_freq) - new_state = MSM_MPDEC_IDLE; + if (get_slowest_cpu_rate() <= msm_mpdec_tuners_ins.idle_freq) + new_state = MSM_MPDEC_IDLE; } } else if ((nr_cpu_online > 1) && (rq_depth <= NwNs_Threshold[index+1])) { - if ((total_time >= TwTs_Threshold[index+1]) && - (nr_cpu_online > msm_mpdec_tuners_ins.min_cpus)) { + if ((total_time >= TwTs_Threshold[index+1]) && (nr_cpu_online > msm_mpdec_tuners_ins.min_cpus)) { new_state = MSM_MPDEC_DOWN; - if (get_slowest_cpu_rate() > msm_mpdec_tuners_ins.idle_freq) - new_state = MSM_MPDEC_IDLE; + if (get_slowest_cpu_rate() > msm_mpdec_tuners_ins.idle_freq) + new_state = MSM_MPDEC_IDLE; } } else { new_state = MSM_MPDEC_IDLE; @@ -206,17 +201,17 @@ static void msm_mpdec_work_thread(struct { unsigned int cpu = nr_cpu_ids; cputime64_t on_time = 0; - bool suspended = false; + bool suspended = false; - if (ktime_to_ms(ktime_get()) <= msm_mpdec_tuners_ins.startdelay) - goto out; + if (ktime_to_ms(ktime_get()) <= msm_mpdec_tuners_ins.startdelay) + goto out; - for_each_possible_cpu(cpu) { - if ((per_cpu(msm_mpdec_cpudata, cpu).device_suspended == true)) { - suspended = true; - break; - } - } + for_each_possible_cpu(cpu) { + if ((per_cpu(msm_mpdec_cpudata, cpu).device_suspended == true)) { + suspended = true; + break; + } + } if (suspended == true) goto out; @@ -300,18 +295,18 @@ static void msm_mpdec_early_suspend(stru for_each_possible_cpu(cpu) { mutex_lock(&per_cpu(msm_mpdec_cpudata, cpu).suspend_mutex); if ((cpu >= 1) && (cpu_online(cpu))) { - cpu_down(cpu); - pr_info(MPDEC_TAG"Screen -> off. Suspended CPU[%d] | Mask=[%d%d%d%d]\n", - cpu, cpu_online(0), cpu_online(1), cpu_online(2), cpu_online(3)); + cpu_down(cpu); + pr_info(MPDEC_TAG"Screen -> off. Suspended CPU[%d] | Mask=[%d%d%d%d]\n", + cpu, cpu_online(0), cpu_online(1), cpu_online(2), cpu_online(3)); per_cpu(msm_mpdec_cpudata, cpu).online = false; } per_cpu(msm_mpdec_cpudata, cpu).device_suspended = true; mutex_unlock(&per_cpu(msm_mpdec_cpudata, cpu).suspend_mutex); } - /* main work thread can sleep now */ - cancel_delayed_work_sync(&msm_mpdec_work); + /* main work thread can sleep now */ + cancel_delayed_work_sync(&msm_mpdec_work); - pr_info(MPDEC_TAG"Screen -> off. Deactivated mpdecision.\n"); + pr_info(MPDEC_TAG"Screen -> off. Deactivated mpdecision.\n"); } static void msm_mpdec_late_resume(struct early_suspend *h) @@ -332,11 +327,11 @@ static void msm_mpdec_late_resume(struct } mutex_unlock(&per_cpu(msm_mpdec_cpudata, 1).suspend_mutex); - /* wake up main work thread */ - was_paused = true; - queue_delayed_work(msm_mpdec_workq, &msm_mpdec_work, 0); + /* wake up main work thread */ + was_paused = true; + queue_delayed_work(msm_mpdec_workq, &msm_mpdec_work, 0); - pr_info(MPDEC_TAG"Screen -> on. Activated mpdecision. | Mask=[%d%d%d%d]\n", + pr_info(MPDEC_TAG"Screen -> on. Activated mpdecision. | Mask=[%d%d%d%d]\n", cpu_online(0), cpu_online(1), cpu_online(2), cpu_online(3)); } @@ -546,7 +541,7 @@ static ssize_t store_max_cpus(struct kob int ret; ret = sscanf(buf, "%u", &input); if ((ret != 1) || input > CONFIG_NR_CPUS) - return -EINVAL; + return -EINVAL; msm_mpdec_tuners_ins.max_cpus = input; @@ -560,7 +555,7 @@ static ssize_t store_min_cpus(struct kob int ret; ret = sscanf(buf, "%u", &input); if ((ret != 1) || input < 1) - return -EINVAL; + return -EINVAL; msm_mpdec_tuners_ins.min_cpus = input; @@ -595,17 +590,17 @@ static ssize_t store_enabled(struct kobj switch (buf[0]) { case '0': state = MSM_MPDEC_DISABLED; - pr_info(MPDEC_TAG"nap time... Hot plugging offline CPUs...\n"); + pr_info(MPDEC_TAG"nap time... Hot plugging offline CPUs...\n"); - for (cpu = 1; cpu < CONFIG_NR_CPUS; cpu++) { - if (!cpu_online(cpu)) { - per_cpu(msm_mpdec_cpudata, cpu).on_time = ktime_to_ms(ktime_get()); - per_cpu(msm_mpdec_cpudata, cpu).online = true; - cpu_up(cpu); - pr_info(MPDEC_TAG" DISABLED... Hot plugged CPU[%d] | Mask=[%d%d%d%d]\n", - cpu, cpu_online(0), cpu_online(1), cpu_online(2), cpu_online(3)); - } - } + for (cpu = 1; cpu < CONFIG_NR_CPUS; cpu++) { + if (!cpu_online(cpu)) { + per_cpu(msm_mpdec_cpudata, cpu).on_time = ktime_to_ms(ktime_get()); + per_cpu(msm_mpdec_cpudata, cpu).online = true; + cpu_up(cpu); + pr_info(MPDEC_TAG" DISABLED... Hot plugged CPU[%d] | Mask=[%d%d%d%d]\n", + cpu, cpu_online(0), cpu_online(1), cpu_online(2), cpu_online(3)); + } + } break; case '1': state = MSM_MPDEC_IDLE; @@ -635,8 +630,8 @@ static struct attribute *msm_mpdec_attri &pause.attr, &scroff_single_core.attr, &idle_freq.attr, - &min_cpus.attr, - &max_cpus.attr, + &min_cpus.attr, + &max_cpus.attr, &enabled.attr, &twts_threshold_0.attr, &twts_threshold_1.attr, @@ -674,16 +669,16 @@ static int __init msm_mpdec_init(void) per_cpu(msm_mpdec_cpudata, cpu).online = true; } - was_paused = true; + was_paused = true; - msm_mpdec_workq = alloc_workqueue( - "mpdec", WQ_UNBOUND | WQ_RESCUER | WQ_FREEZABLE, 1); - if (!msm_mpdec_workq) - return -ENOMEM; + msm_mpdec_workq = alloc_workqueue( + "mpdec", WQ_UNBOUND | WQ_RESCUER | WQ_FREEZABLE, 1); + if (!msm_mpdec_workq) + return -ENOMEM; INIT_DELAYED_WORK(&msm_mpdec_work, msm_mpdec_work_thread); if (state != MSM_MPDEC_DISABLED) queue_delayed_work(msm_mpdec_workq, &msm_mpdec_work, - msecs_to_jiffies(msm_mpdec_tuners_ins.delay)); + msecs_to_jiffies(msm_mpdec_tuners_ins.delay)); register_early_suspend(&msm_mpdec_early_suspend_handler); @@ -705,8 +700,8 @@ late_initcall(msm_mpdec_init); void msm_mpdec_exit(void) { - destroy_workqueue(msm_mpdec_workq); - destroy_workqueue(msm_mpdec_workq); + destroy_workqueue(msm_mpdec_workq); + destroy_workqueue(msm_mpdec_workq); } MODULE_DESCRIPTION("Kernel based MPDECISION (C) 2011-12 Chad Goodman"); --- a/arch/arm/mach-msm/smd.c +++ b/arch/arm/mach-msm/smd.c @@ -675,7 +675,7 @@ static void smd_channel_reset_state(stru void smd_channel_reset(uint32_t restart_pid) { struct smd_alloc_elm *shared; - unsigned long flags; + unsigned long flags = 0; SMD_DBG("%s: starting reset\n", __func__); shared = smem_find(ID_CH_ALLOC_TBL, sizeof(*shared) * 64); @@ -971,7 +971,7 @@ static void smd_state_change(struct smd_ static void handle_smd_irq_closing_list(void) { - unsigned long flags; + unsigned long flags = 0; struct smd_channel *ch; struct smd_channel *index; unsigned tmp; @@ -989,7 +989,7 @@ static void handle_smd_irq_closing_list( static void handle_smd_irq(struct list_head *list, void (*notify)(void)) { - unsigned long flags; + unsigned long flags = 0; struct smd_channel *ch; unsigned ch_flags; unsigned tmp; @@ -1087,7 +1087,7 @@ static inline int smd_need_int(struct sm void smd_sleep_exit(void) { - unsigned long flags; + unsigned long flags = 0; struct smd_channel *ch; int need_int = 0; @@ -1245,7 +1245,7 @@ static int smd_stream_read(smd_channel_t static int smd_packet_read(smd_channel_t *ch, void *data, int len, int user_buf) { - unsigned long flags; + unsigned long flags = 0; int r; if (len < 0) @@ -1421,7 +1421,7 @@ static int smd_alloc_channel(struct smd_ static inline void notify_loopback_smd(void) { - unsigned long flags; + unsigned long flags = 0; struct smd_channel *ch; spin_lock_irqsave(&smd_lock, flags); @@ -1483,7 +1483,7 @@ static void do_nothing_notify(void *priv static void finalize_channel_close_fn(struct work_struct *work) { - unsigned long flags; + unsigned long flags = 0; struct smd_channel *ch; struct smd_channel *index; @@ -1522,7 +1522,7 @@ int smd_named_open_on_edge(const char *n void *priv, void (*notify)(void *, unsigned)) { struct smd_channel *ch; - unsigned long flags; + unsigned long flags = 0; if (smd_initialized == 0) { SMD_INFO("smd_open() before smd_init()\n"); @@ -1615,7 +1615,7 @@ EXPORT_SYMBOL(smd_open); int smd_close(smd_channel_t *ch) { - unsigned long flags; + unsigned long flags = 0; if (ch == 0) return -1; @@ -1898,7 +1898,7 @@ EXPORT_SYMBOL(smd_tiocmset_from_cb); int smd_tiocmset(smd_channel_t *ch, unsigned int set, unsigned int clear) { - unsigned long flags; + unsigned long flags = 0; if (!ch) { pr_err("%s: Invalid channel specified\n", __func__); @@ -1932,7 +1932,7 @@ void *smem_alloc2(unsigned id, unsigned { struct smem_shared *shared = (void *) MSM_SHARED_RAM_BASE; struct smem_heap_entry *toc = shared->heap_toc; - unsigned long flags; + unsigned long flags = 0; void *ret = NULL; if (!shared->heap_info.initialized) { @@ -2146,7 +2146,7 @@ EXPORT_SYMBOL(smsm_reset_modem); void smsm_reset_modem_cont(void) { - unsigned long flags; + unsigned long flags = 0; uint32_t state; if (!smsm_info.state) @@ -2165,7 +2165,7 @@ static void smsm_cb_snapshot(uint32_t us { int n; uint32_t new_state; - unsigned long flags; + unsigned long flags = 0; int ret; ret = kfifo_avail(&smsm_snapshot_fifo); @@ -2241,7 +2241,7 @@ restore_snapshot_count: static irqreturn_t smsm_irq_handler(int irq, void *data) { - unsigned long flags; + unsigned long flags = 0; if (irq == INT_ADSP_A11_SMSM) { uint32_t mux_val; @@ -2338,7 +2338,7 @@ int smsm_change_intr_mask(uint32_t smsm_ uint32_t clear_mask, uint32_t set_mask) { uint32_t old_mask, new_mask; - unsigned long flags; + unsigned long flags = 0; if (smsm_entry >= SMSM_NUM_ENTRIES) { pr_err("smsm_change_state: Invalid entry %d\n", @@ -2387,7 +2387,7 @@ EXPORT_SYMBOL(smsm_get_intr_mask); int smsm_change_state(uint32_t smsm_entry, uint32_t clear_mask, uint32_t set_mask) { - unsigned long flags; + unsigned long flags = 0; uint32_t old_state, new_state; if (smsm_entry >= SMSM_NUM_ENTRIES) { @@ -2447,7 +2447,7 @@ void notify_smsm_cb_clients_worker(struc uint32_t state_changes; uint32_t use_wakelock; int ret; - unsigned long flags; + unsigned long flags = 0; if (!smd_initialized) return; @@ -2579,7 +2579,7 @@ int smsm_state_cb_register(uint32_t smsm new_mask |= LEGACY_MODEM_SMSM_MASK; if (smsm_info.intr_mask) { - unsigned long flags; + unsigned long flags = 0; spin_lock_irqsave(&smem_lock, flags); new_mask = (new_mask & ~state->intr_mask_clear) @@ -2654,7 +2654,7 @@ int smsm_state_cb_deregister(uint32_t sm new_mask |= LEGACY_MODEM_SMSM_MASK; if (smsm_info.intr_mask) { - unsigned long flags; + unsigned long flags = 0; spin_lock_irqsave(&smem_lock, flags); new_mask = (new_mask & ~state->intr_mask_clear) --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1118,9 +1118,6 @@ static int cpufreq_add_dev(struct sys_de pr_debug("initialization failed\n"); goto err_unlock_policy; } - - if (policy->max > 1512000) policy->max = 1512000; - policy->user_policy.min = policy->min; policy->user_policy.max = policy->max;