Skip to contentSkip to conversation

staging: speakup: Fix multiple assignments on a single line

PATCH In review Frank A. Cancio Bello 4 participants 5 messages Oct 27, 2019 – Oct 28, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: speakup: Fix multiple assignments on a single line

checkpatch message: "multiple assignments should be avoided"

---

This is the second patch that I send for "Outreachy December 2019 to March 2020".

 drivers/staging/speakup/main.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/staging/speakup/main.c +14 -7
index 488f2539aa9a..6f5a58bd1f81 100644
@@ -263,9 +263,12 @@ static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
 
 static void speakup_date(struct vc_data *vc)
 {
-	spk_x = spk_cx = vc->vc_x;
-	spk_y = spk_cy = vc->vc_y;
-	spk_pos = spk_cp = vc->vc_pos;
+	spk_cx = vc->vc_x;
+	spk_x = spk_cx;
+	spk_cy = vc->vc_y;
+	spk_y = spk_cy;
+	spk_cp = vc->vc_pos;
+	spk_pos = spk_cp;
 	spk_old_attr = spk_attr;
 	spk_attr = get_attributes(vc, (u_short *)spk_pos);
 }
@@ -1672,9 +1675,12 @@ static int speak_highlight(struct vc_data *vc)
 		spk_do_flush();
 		spkup_write(speakup_console[vc_num]->ht.highbuf[hc],
 			    speakup_console[vc_num]->ht.highsize[hc]);
-		spk_pos = spk_cp = speakup_console[vc_num]->ht.rpos[hc];
-		spk_x = spk_cx = speakup_console[vc_num]->ht.rx[hc];
-		spk_y = spk_cy = speakup_console[vc_num]->ht.ry[hc];
+		spk_cp = speakup_console[vc_num]->ht.rpos[hc];
+		spk_pos = spk_cp;
+		spk_cx = speakup_console[vc_num]->ht.rx[hc];
+		spk_x = spk_cx;
+		spk_cy = speakup_console[vc_num]->ht.ry[hc];
+		spk_y = spk_cy;
 		return 1;
 	}
 	return 0;
@@ -2117,7 +2123,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 			spk_keydown = 0;
 			goto out;
 		}
-		value = spk_lastkey = pad_chars[value];
+		spk_lastkey = pad_chars[value];
+		value = spk_lastkey;
 		spk_keydown++;
 		spk_parked &= 0xfe;
 		goto no_map;
Signature · 1 line
2.17.1
#1 lore raw
Quoted 1 line · Frank A. Cancio Bello

checkpatch message: "multiple assignments should be avoided"

Despite the comment of checkpatch, I think it was clearer before. Maybe there is some way to rewrite the code so that not so many variables are needed, but since they seem to be globa variables, that may not be possible.

Quoted 6 lines

---

This is the second patch that I send for "Outreachy December 2019 to March 2020".

This comment isn't needed. The git logs show what patches you have gotten accepted.

julia

Quoted 57 lines
 drivers/staging/speakup/main.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/staging/speakup/main.c +14 -8
index 488f2539aa9a..6f5a58bd1f81 100644
@@ -263,9 +263,12 @@ static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
 
 static void speakup_date(struct vc_data *vc)
 {
-	spk_x = spk_cx = vc->vc_x;
-	spk_y = spk_cy = vc->vc_y;
-	spk_pos = spk_cp = vc->vc_pos;
+	spk_cx = vc->vc_x;
+	spk_x = spk_cx;
+	spk_cy = vc->vc_y;
+	spk_y = spk_cy;
+	spk_cp = vc->vc_pos;
+	spk_pos = spk_cp;
 	spk_old_attr = spk_attr;
 	spk_attr = get_attributes(vc, (u_short *)spk_pos);
 }
@@ -1672,9 +1675,12 @@ static int speak_highlight(struct vc_data *vc)
 		spk_do_flush();
 		spkup_write(speakup_console[vc_num]->ht.highbuf[hc],
 			    speakup_console[vc_num]->ht.highsize[hc]);
-		spk_pos = spk_cp = speakup_console[vc_num]->ht.rpos[hc];
-		spk_x = spk_cx = speakup_console[vc_num]->ht.rx[hc];
-		spk_y = spk_cy = speakup_console[vc_num]->ht.ry[hc];
+		spk_cp = speakup_console[vc_num]->ht.rpos[hc];
+		spk_pos = spk_cp;
+		spk_cx = speakup_console[vc_num]->ht.rx[hc];
+		spk_x = spk_cx;
+		spk_cy = speakup_console[vc_num]->ht.ry[hc];
+		spk_y = spk_cy;
 		return 1;
 	}
 	return 0;
@@ -2117,7 +2123,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
 			spk_keydown = 0;
 			goto out;
 		}
-		value = spk_lastkey = pad_chars[value];
+		spk_lastkey = pad_chars[value];
+		value = spk_lastkey;
 		spk_keydown++;
 		spk_parked &= 0xfe;
 		goto no_map;
--

2.17.1

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20191027050640.GA24283%40linux-kernel-dev.

maintainer
#2 lore raw
In reply to Frank A. Cancio Bello
Quoted 18 lines · Frank A. Cancio Bello

checkpatch message: "multiple assignments should be avoided"

---

This is the second patch that I send for "Outreachy December 2019 to March 2020".

 drivers/staging/speakup/main.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/staging/speakup/main.c +0 -0
index 488f2539aa9a..6f5a58bd1f81 100644
@@ -263,9 +263,12 @@ static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
 
 static void speakup_date(struct vc_data *vc)

drivers/staging/speakup/main.c static unsigned char get_attributes(struct vc_data *vc, u16 *pos) · line 271

Quoted 10 lines
drivers/staging/speakup/main.c +6 -3
 {
-	spk_x = spk_cx = vc->vc_x;
-	spk_y = spk_cy = vc->vc_y;
-	spk_pos = spk_cp = vc->vc_pos;
+	spk_cx = vc->vc_x;
+	spk_x = spk_cx;
+	spk_cy = vc->vc_y;
+	spk_y = spk_cy;
+	spk_cp = vc->vc_pos;
+	spk_pos = spk_cp;

As Julia said, the original is better here.

thanks,

greg k-h

#3 lore raw

Greg KH, le dim. 27 oct. 2019 08:13:10 +0100, a ecrit:

Quoted 1 line

As Julia said, the original is better here.

Confirmed, we have already had this patch suggestion in the past, but we prefer the original version.

Thanks for your contribution anyway!

Samuel

#4 lore raw
Quoted 8 lines · Samuel Thibault

Greg KH, le dim. 27 oct. 2019 08:13:10 +0100, a ecrit:

Quoted 1 line

As Julia said, the original is better here.

Confirmed, we have already had this patch suggestion in the past, but we prefer the original version.

Thanks for your contribution anyway!

Thank you all for your quick response and advice.

frank a.

Quoted 1 line

Samuel