Commit 8c767e10 authored by Anton Blanchard's avatar Anton Blanchard Committed by Linus Torvalds

[PATCH] ppc64: fix chrp_progress mismerge

Due to a mismerge, some code in chrp_progress appears twice. While here,
clean up some formatting issues.
Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8c6e17b3
...@@ -298,8 +298,7 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -298,8 +298,7 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
cur_cpu_spec->firmware_features); cur_cpu_spec->firmware_features);
} }
void void chrp_progress(char *s, unsigned short hex)
chrp_progress(char *s, unsigned short hex)
{ {
struct device_node *root; struct device_node *root;
int width, *p; int width, *p;
...@@ -313,60 +312,55 @@ chrp_progress(char *s, unsigned short hex) ...@@ -313,60 +312,55 @@ chrp_progress(char *s, unsigned short hex)
return; return;
if (max_width == 0) { if (max_width == 0) {
if ( (root = find_path_device("/rtas")) && if ((root = find_path_device("/rtas")) &&
(p = (unsigned int *)get_property(root, (p = (unsigned int *)get_property(root,
"ibm,display-line-length", "ibm,display-line-length",
NULL)) ) NULL)))
max_width = *p; max_width = *p;
else else
max_width = 0x10; max_width = 0x10;
display_character = rtas_token("display-character"); display_character = rtas_token("display-character");
set_indicator = rtas_token("set-indicator"); set_indicator = rtas_token("set-indicator");
} }
if (display_character == RTAS_UNKNOWN_SERVICE) {
/* use hex display */
if (set_indicator == RTAS_UNKNOWN_SERVICE)
return;
rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex);
return;
}
if(display_character == RTAS_UNKNOWN_SERVICE) { if (display_character == RTAS_UNKNOWN_SERVICE) {
/* use hex display if available */ /* use hex display if available */
if(set_indicator != RTAS_UNKNOWN_SERVICE) if (set_indicator != RTAS_UNKNOWN_SERVICE)
rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex); rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex);
return; return;
} }
spin_lock(&progress_lock); spin_lock(&progress_lock);
/* Last write ended with newline, but we didn't print it since /*
* Last write ended with newline, but we didn't print it since
* it would just clear the bottom line of output. Print it now * it would just clear the bottom line of output. Print it now
* instead. * instead.
* *
* If no newline is pending, print a CR to start output at the * If no newline is pending, print a CR to start output at the
* beginning of the line. * beginning of the line.
*/ */
if(pending_newline) { if (pending_newline) {
rtas_call(display_character, 1, 1, NULL, '\r'); rtas_call(display_character, 1, 1, NULL, '\r');
rtas_call(display_character, 1, 1, NULL, '\n'); rtas_call(display_character, 1, 1, NULL, '\n');
pending_newline = 0; pending_newline = 0;
} else } else {
rtas_call(display_character, 1, 1, NULL, '\r'); rtas_call(display_character, 1, 1, NULL, '\r');
}
width = max_width; width = max_width;
os = s; os = s;
while (*os) { while (*os) {
if(*os == '\n' || *os == '\r') { if (*os == '\n' || *os == '\r') {
/* Blank to end of line. */ /* Blank to end of line. */
while(width-- > 0) while (width-- > 0)
rtas_call(display_character, 1, 1, NULL, ' '); rtas_call(display_character, 1, 1, NULL, ' ');
/* If newline is the last character, save it /* If newline is the last character, save it
* until next call to avoid bumping up the * until next call to avoid bumping up the
* display output. * display output.
*/ */
if(*os == '\n' && !os[1]) { if (*os == '\n' && !os[1]) {
pending_newline = 1; pending_newline = 1;
spin_unlock(&progress_lock); spin_unlock(&progress_lock);
return; return;
...@@ -374,7 +368,7 @@ chrp_progress(char *s, unsigned short hex) ...@@ -374,7 +368,7 @@ chrp_progress(char *s, unsigned short hex)
/* RTAS wants CR-LF, not just LF */ /* RTAS wants CR-LF, not just LF */
if(*os == '\n') { if (*os == '\n') {
rtas_call(display_character, 1, 1, NULL, '\r'); rtas_call(display_character, 1, 1, NULL, '\r');
rtas_call(display_character, 1, 1, NULL, '\n'); rtas_call(display_character, 1, 1, NULL, '\n');
} else { } else {
...@@ -393,14 +387,14 @@ chrp_progress(char *s, unsigned short hex) ...@@ -393,14 +387,14 @@ chrp_progress(char *s, unsigned short hex)
os++; os++;
/* if we overwrite the screen length */ /* if we overwrite the screen length */
if ( width <= 0 ) if (width <= 0)
while ( (*os != 0) && (*os != '\n') && (*os != '\r') ) while ((*os != 0) && (*os != '\n') && (*os != '\r'))
os++; os++;
} }
/* Blank to end of line. */ /* Blank to end of line. */
while ( width-- > 0 ) while (width-- > 0)
rtas_call(display_character, 1, 1, NULL, ' ' ); rtas_call(display_character, 1, 1, NULL, ' ');
spin_unlock(&progress_lock); spin_unlock(&progress_lock);
} }
......
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