Commit 40ab0a16 authored by Will Schmidt's avatar Will Schmidt Committed by Linus Torvalds

[PATCH] ppc64: lparcfg whitespace and wordwrap cleanup.

This patch is the result of running Lindent against
arch/ppc64/kernel/lparcfg.c.

This cleans up an assortment of whitespace and wordwrap inconsistencies.
Signed-off-by: default avatarWill Schmidt <willschm@us.ibm.com>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b9154df3
...@@ -40,25 +40,31 @@ ...@@ -40,25 +40,31 @@
/* #define LPARCFG_DEBUG */ /* #define LPARCFG_DEBUG */
/* find a better place for this function... */ /* find a better place for this function... */
void log_plpar_hcall_return(unsigned long rc,char * tag) void log_plpar_hcall_return(unsigned long rc, char *tag)
{ {
if (rc ==0 ) /* success, return */ if (rc == 0) /* success, return */
return; return;
/* check for null tag ? */ /* check for null tag ? */
if (rc == H_Hardware) if (rc == H_Hardware)
printk(KERN_INFO "plpar-hcall (%s) failed with hardware fault\n",tag); printk(KERN_INFO
"plpar-hcall (%s) failed with hardware fault\n", tag);
else if (rc == H_Function) else if (rc == H_Function)
printk(KERN_INFO "plpar-hcall (%s) failed; function not allowed\n",tag); printk(KERN_INFO
"plpar-hcall (%s) failed; function not allowed\n", tag);
else if (rc == H_Authority) else if (rc == H_Authority)
printk(KERN_INFO "plpar-hcall (%s) failed; not authorized to this function\n",tag); printk(KERN_INFO
"plpar-hcall (%s) failed; not authorized to this function\n",
tag);
else if (rc == H_Parameter) else if (rc == H_Parameter)
printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n",tag); printk(KERN_INFO "plpar-hcall (%s) failed; Bad parameter(s)\n",
tag);
else else
printk(KERN_INFO "plpar-hcall (%s) failed with unexpected rc(0x%lx)\n",tag,rc); printk(KERN_INFO
"plpar-hcall (%s) failed with unexpected rc(0x%lx)\n",
tag, rc);
} }
static struct proc_dir_entry *proc_ppc64_lparcfg; static struct proc_dir_entry *proc_ppc64_lparcfg;
#define LPARCFG_BUFF_SIZE 4096 #define LPARCFG_BUFF_SIZE 4096
...@@ -107,7 +113,7 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -107,7 +113,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
max_processors = (int)HvLpConfig_getMaxPhysicalProcessors(); max_processors = (int)HvLpConfig_getMaxPhysicalProcessors();
seq_printf(m, "partition_potential_processors=%d\n", max_processors); seq_printf(m, "partition_potential_processors=%d\n", max_processors);
if(shared) { if (shared) {
entitled_capacity = HvLpConfig_getSharedProcUnits(); entitled_capacity = HvLpConfig_getSharedProcUnits();
max_entitled_capacity = HvLpConfig_getMaxSharedProcUnits(); max_entitled_capacity = HvLpConfig_getMaxSharedProcUnits();
} else { } else {
...@@ -119,11 +125,12 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -119,11 +125,12 @@ static int lparcfg_data(struct seq_file *m, void *v)
seq_printf(m, "partition_max_entitled_capacity=%d\n", seq_printf(m, "partition_max_entitled_capacity=%d\n",
max_entitled_capacity); max_entitled_capacity);
if(shared) { if (shared) {
pool_id = HvLpConfig_getSharedPoolIndex(); pool_id = HvLpConfig_getSharedPoolIndex();
seq_printf(m, "pool=%d\n", (int)pool_id); seq_printf(m, "pool=%d\n", (int)pool_id);
seq_printf(m, "pool_capacity=%d\n", seq_printf(m, "pool_capacity=%d\n",
(int)(HvLpConfig_getNumProcsInSharedPool(pool_id)*100)); (int)(HvLpConfig_getNumProcsInSharedPool(pool_id) *
100));
} }
seq_printf(m, "shared_processor_mode=%d\n", shared); seq_printf(m, "shared_processor_mode=%d\n", shared);
...@@ -158,11 +165,13 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -158,11 +165,13 @@ static int lparcfg_data(struct seq_file *m, void *v)
* XXXX - Processors active on platform. * XXXX - Processors active on platform.
*/ */
static unsigned int h_get_ppp(unsigned long *entitled, static unsigned int h_get_ppp(unsigned long *entitled,
unsigned long *unallocated, unsigned long *aggregation, unsigned long *unallocated,
unsigned long *aggregation,
unsigned long *resource) unsigned long *resource)
{ {
unsigned long rc; unsigned long rc;
rc = plpar_hcall_4out(H_GET_PPP,0,0,0,0,entitled,unallocated,aggregation,resource); rc = plpar_hcall_4out(H_GET_PPP, 0, 0, 0, 0, entitled, unallocated,
aggregation, resource);
log_plpar_hcall_return(rc, "H_GET_PPP"); log_plpar_hcall_return(rc, "H_GET_PPP");
...@@ -185,7 +194,7 @@ static unsigned long get_purr(void); ...@@ -185,7 +194,7 @@ static unsigned long get_purr(void);
*/ */
static unsigned long get_purr() static unsigned long get_purr()
{ {
unsigned long sum_purr=0; unsigned long sum_purr = 0;
return sum_purr; return sum_purr;
} }
...@@ -202,7 +211,7 @@ static void parse_system_parameter_string(struct seq_file *m) ...@@ -202,7 +211,7 @@ static void parse_system_parameter_string(struct seq_file *m)
{ {
int call_status; int call_status;
char * local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); char *local_buffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
if (!local_buffer) { if (!local_buffer) {
printk(KERN_ERR "%s %s kmalloc failure at line %d \n", printk(KERN_ERR "%s %s kmalloc failure at line %d \n",
__FILE__, __FUNCTION__, __LINE__); __FILE__, __FUNCTION__, __LINE__);
...@@ -219,17 +228,18 @@ static void parse_system_parameter_string(struct seq_file *m) ...@@ -219,17 +228,18 @@ static void parse_system_parameter_string(struct seq_file *m)
spin_unlock(&rtas_data_buf_lock); spin_unlock(&rtas_data_buf_lock);
if (call_status != 0) { if (call_status != 0) {
printk(KERN_INFO "%s %s Error calling get-system-parameter (0x%x)\n", printk(KERN_INFO
"%s %s Error calling get-system-parameter (0x%x)\n",
__FILE__, __FUNCTION__, call_status); __FILE__, __FUNCTION__, call_status);
} else { } else {
int splpar_strlen; int splpar_strlen;
int idx, w_idx; int idx, w_idx;
char * workbuffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL); char *workbuffer = kmalloc(SPLPAR_MAXLENGTH, GFP_KERNEL);
if (!workbuffer) { if (!workbuffer) {
printk(KERN_ERR "%s %s kmalloc failure at line %d \n",__FILE__,__FUNCTION__,__LINE__); printk(KERN_ERR "%s %s kmalloc failure at line %d \n",
__FILE__, __FUNCTION__, __LINE__);
return; return;
} }
#ifdef LPARCFG_DEBUG #ifdef LPARCFG_DEBUG
printk(KERN_INFO "success calling get-system-parameter \n"); printk(KERN_INFO "success calling get-system-parameter \n");
#endif #endif
...@@ -254,12 +264,14 @@ static void parse_system_parameter_string(struct seq_file *m) ...@@ -254,12 +264,14 @@ static void parse_system_parameter_string(struct seq_file *m)
} else if (local_buffer[idx] == '=') { } else if (local_buffer[idx] == '=') {
/* code here to replace workbuffer contents /* code here to replace workbuffer contents
with different keyword strings */ with different keyword strings */
if (0 == strcmp(workbuffer,"MaxEntCap")) { if (0 == strcmp(workbuffer, "MaxEntCap")) {
strcpy(workbuffer, "partition_max_entitled_capacity"); strcpy(workbuffer,
"partition_max_entitled_capacity");
w_idx = strlen(workbuffer); w_idx = strlen(workbuffer);
} }
if (0 == strcmp(workbuffer,"MaxPlatProcs")) { if (0 == strcmp(workbuffer, "MaxPlatProcs")) {
strcpy(workbuffer, "system_potential_processors"); strcpy(workbuffer,
"system_potential_processors");
w_idx = strlen(workbuffer); w_idx = strlen(workbuffer);
} }
} }
...@@ -283,7 +295,7 @@ static int lparcfg_count_active_processors(void) ...@@ -283,7 +295,7 @@ static int lparcfg_count_active_processors(void)
while ((cpus_dn = of_find_node_by_type(cpus_dn, "cpu"))) { while ((cpus_dn = of_find_node_by_type(cpus_dn, "cpu"))) {
#ifdef LPARCFG_DEBUG #ifdef LPARCFG_DEBUG
printk(KERN_ERR "cpus_dn %p \n",cpus_dn); printk(KERN_ERR "cpus_dn %p \n", cpus_dn);
#endif #endif
count++; count++;
} }
...@@ -311,7 +323,6 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -311,7 +323,6 @@ static int lparcfg_data(struct seq_file *m, void *v)
lp_index = *lp_index_ptr; lp_index = *lp_index_ptr;
} }
seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
seq_printf(m, "serial_number=%s\n", system_id); seq_printf(m, "serial_number=%s\n", system_id);
...@@ -350,14 +361,12 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -350,14 +361,12 @@ static int lparcfg_data(struct seq_file *m, void *v)
/* this call handles the ibm,get-system-parameter contents */ /* this call handles the ibm,get-system-parameter contents */
parse_system_parameter_string(m); parse_system_parameter_string(m);
seq_printf(m, "partition_entitled_capacity=%ld\n", seq_printf(m, "partition_entitled_capacity=%ld\n", h_entitled);
h_entitled);
seq_printf(m, "group=%ld\n", seq_printf(m, "group=%ld\n", (h_aggregation >> 2 * 8) & 0xffff);
(h_aggregation >> 2*8) & 0xffff);
seq_printf(m, "system_active_processors=%ld\n", seq_printf(m, "system_active_processors=%ld\n",
(h_resource >> 0*8) & 0xffff); (h_resource >> 0 * 8) & 0xffff);
/* pool related entries are apropriate for shared configs */ /* pool related entries are apropriate for shared configs */
if (paca[0].lppaca.xSharedProc) { if (paca[0].lppaca.xSharedProc) {
...@@ -365,11 +374,11 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -365,11 +374,11 @@ static int lparcfg_data(struct seq_file *m, void *v)
h_pic(&pool_idle_time, &pool_procs); h_pic(&pool_idle_time, &pool_procs);
seq_printf(m, "pool=%ld\n", seq_printf(m, "pool=%ld\n",
(h_aggregation >> 0*8) & 0xffff); (h_aggregation >> 0 * 8) & 0xffff);
/* report pool_capacity in percentage */ /* report pool_capacity in percentage */
seq_printf(m, "pool_capacity=%ld\n", seq_printf(m, "pool_capacity=%ld\n",
((h_resource >> 2*8) & 0xffff)*100); ((h_resource >> 2 * 8) & 0xffff) * 100);
seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time); seq_printf(m, "pool_idle_time=%ld\n", pool_idle_time);
...@@ -377,21 +386,19 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -377,21 +386,19 @@ static int lparcfg_data(struct seq_file *m, void *v)
} }
seq_printf(m, "unallocated_capacity_weight=%ld\n", seq_printf(m, "unallocated_capacity_weight=%ld\n",
(h_resource >> 4*8) & 0xFF); (h_resource >> 4 * 8) & 0xFF);
seq_printf(m, "capacity_weight=%ld\n", seq_printf(m, "capacity_weight=%ld\n",
(h_resource >> 5*8) & 0xFF); (h_resource >> 5 * 8) & 0xFF);
seq_printf(m, "capped=%ld\n", (h_resource >> 6 * 8) & 0x01);
seq_printf(m, "capped=%ld\n", seq_printf(m, "unallocated_capacity=%ld\n", h_unallocated);
(h_resource >> 6*8) & 0x01);
seq_printf(m, "unallocated_capacity=%ld\n", seq_printf(m, "purr=%ld\n", purr);
h_unallocated);
seq_printf(m, "purr=%ld\n", } else { /* non SPLPAR case */
purr);
} else /* non SPLPAR case */ {
seq_printf(m, "system_active_processors=%d\n", seq_printf(m, "system_active_processors=%d\n",
partition_potential_processors); partition_potential_processors);
...@@ -411,8 +418,7 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -411,8 +418,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
seq_printf(m, "partition_potential_processors=%d\n", seq_printf(m, "partition_potential_processors=%d\n",
partition_potential_processors); partition_potential_processors);
seq_printf(m, "shared_processor_mode=%d\n", seq_printf(m, "shared_processor_mode=%d\n", paca[0].lppaca.xSharedProc);
paca[0].lppaca.xSharedProc);
return 0; return 0;
} }
...@@ -427,7 +433,8 @@ static int lparcfg_data(struct seq_file *m, void *v) ...@@ -427,7 +433,8 @@ static int lparcfg_data(struct seq_file *m, void *v)
* This function should be invoked only on systems with * This function should be invoked only on systems with
* FW_FEATURE_SPLPAR. * FW_FEATURE_SPLPAR.
*/ */
static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t count, loff_t *off) static ssize_t lparcfg_write(struct file *file, const char __user * buf,
size_t count, loff_t * off)
{ {
char *kbuf; char *kbuf;
char *tmp; char *tmp;
...@@ -459,13 +466,13 @@ static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t c ...@@ -459,13 +466,13 @@ static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t c
if (!strcmp(kbuf, "partition_entitled_capacity")) { if (!strcmp(kbuf, "partition_entitled_capacity")) {
char *endp; char *endp;
*new_entitled_ptr = (u64)simple_strtoul(tmp, &endp, 10); *new_entitled_ptr = (u64) simple_strtoul(tmp, &endp, 10);
if (endp == tmp) if (endp == tmp)
goto out; goto out;
new_weight_ptr = &current_weight; new_weight_ptr = &current_weight;
} else if (!strcmp(kbuf, "capacity_weight")) { } else if (!strcmp(kbuf, "capacity_weight")) {
char *endp; char *endp;
*new_weight_ptr = (u8)simple_strtoul(tmp, &endp, 10); *new_weight_ptr = (u8) simple_strtoul(tmp, &endp, 10);
if (endp == tmp) if (endp == tmp)
goto out; goto out;
new_entitled_ptr = &current_entitled; new_entitled_ptr = &current_entitled;
...@@ -479,7 +486,7 @@ static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t c ...@@ -479,7 +486,7 @@ static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t c
goto out; goto out;
} }
current_weight = (resource>>5*8)&0xFF; current_weight = (resource >> 5 * 8) & 0xFF;
pr_debug("%s: current_entitled = %lu, current_weight = %lu\n", pr_debug("%s: current_entitled = %lu, current_weight = %lu\n",
__FUNCTION__, current_entitled, current_weight); __FUNCTION__, current_entitled, current_weight);
...@@ -504,23 +511,23 @@ static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t c ...@@ -504,23 +511,23 @@ static ssize_t lparcfg_write(struct file *file, const char __user *buf, size_t c
retval = -EIO; retval = -EIO;
} }
out: out:
kfree(kbuf); kfree(kbuf);
return retval; return retval;
} }
#endif /* CONFIG_PPC_PSERIES */ #endif /* CONFIG_PPC_PSERIES */
static int lparcfg_open(struct inode * inode, struct file * file) static int lparcfg_open(struct inode *inode, struct file *file)
{ {
return single_open(file,lparcfg_data,NULL); return single_open(file, lparcfg_data, NULL);
} }
struct file_operations lparcfg_fops = { struct file_operations lparcfg_fops = {
owner: THIS_MODULE, owner:THIS_MODULE,
read: seq_read, read:seq_read,
open: lparcfg_open, open:lparcfg_open,
release: single_release, release:single_release,
}; };
int __init lparcfg_init(void) int __init lparcfg_init(void)
...@@ -539,7 +546,8 @@ int __init lparcfg_init(void) ...@@ -539,7 +546,8 @@ int __init lparcfg_init(void)
ent->proc_fops = &lparcfg_fops; ent->proc_fops = &lparcfg_fops;
ent->data = kmalloc(LPARCFG_BUFF_SIZE, GFP_KERNEL); ent->data = kmalloc(LPARCFG_BUFF_SIZE, GFP_KERNEL);
if (!ent->data) { if (!ent->data) {
printk(KERN_ERR "Failed to allocate buffer for lparcfg\n"); printk(KERN_ERR
"Failed to allocate buffer for lparcfg\n");
remove_proc_entry("lparcfg", ent->parent); remove_proc_entry("lparcfg", ent->parent);
return -ENOMEM; return -ENOMEM;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment