Skip to contentSkip to conversation

Staging: speakup: Misc cleanups and code reformatting.

PATCH Superseded Sam Muhammed 2 participants 5 messages Mar 23, 2020 – Mar 24, 2020 Staging

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Staging: speakup: Misc cleanups and code reformatting.

Changes to clear multiple Checkpatch.pl CHECKs of proper use of kmalloc(), and adding identifier names to function declaration arguments.

All modifications made to match coding style and
to improve readability.

Changes in v2:
- Drop the first patch in the previous version:
Staging: speakup: Avoid multiple assignments.
This code is better with multiple assignments.

Sam Muhammed (2):
Staging: speakup: Use sizeof(*var) in kmalloc().
Staging: speakup: Add identifier name to function declaration
arguments.

 drivers/staging/speakup/spk_ttyio.c | 2 +-
 drivers/staging/speakup/spk_types.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

---
2.20.1

#1 lore raw

PATCH v2 1/2 Staging: speakup: Use sizeof(*var) in kmalloc().

Modifying struct allocation in kmalloc() to match the coding standards.

Checkpatch.pl CHECK: Prefer kmalloc(sizeof(*ldisc_data)...) over kmalloc(sizeof(struct spk_ldisc_data)...)

---
Changes in v2:
- None.

 drivers/staging/speakup/spk_ttyio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/spk_ttyio.c +1 -1
index 5a9eff08cb96..9b95f77f9265 100644
@@ -51,7 +51,7 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty)
 		return -EOPNOTSUPP;
 	speakup_tty = tty;
 
-	ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL);
+	ldisc_data = kmalloc(sizeof(*ldisc_data), GFP_KERNEL);
 	if (!ldisc_data)
 		return -ENOMEM;
 

---
2.20.1

#2 lore raw

Re: [PATCH v2 1/2] Staging: speakup: Use sizeof(*var) in kmalloc().

Sam Muhammed, le lun. 23 mars 2020 19:50:51 -0400, a ecrit:

Quoted 7 lines

Modifying struct allocation in kmalloc() to match the coding standards.

Checkpatch.pl CHECK: Prefer kmalloc(sizeof(*ldisc_data)...) over kmalloc(sizeof(struct spk_ldisc_data)...)

Since there was no change since last version in both patches, you can already put my previous Reviewed-by tag for both.

Quoted 23 lines

---
Changes in v2:
- None.

 drivers/staging/speakup/spk_ttyio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/spk_ttyio.c +1 -2
index 5a9eff08cb96..9b95f77f9265 100644
@@ -51,7 +51,7 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty)
 		return -EOPNOTSUPP;
 	speakup_tty = tty;
 
-	ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL);
+	ldisc_data = kmalloc(sizeof(*ldisc_data), GFP_KERNEL);
 	if (!ldisc_data)
 		return -ENOMEM;
 
---

2.20.1

Signature · 1 line
Samuel
Quoted 2 lines

Voici mon problème, j'ai deux PCs relies par des cartes ethernet, configures avec le protocole PPP.

-+- Romain in Guide du linuxien pervers - "Ils sont fous ces romains !" -+-

#3 lore raw

Re: [Outreachy kernel] Re: [PATCH v2 1/2] Staging: speakup: Use sizeof(*var) in kmalloc().

Quoted 4 lines · Samuel Thibault

Sam Muhammed, le lun. 23 mars 2020 19:50:51 -0400, a ecrit:

Quoted 3 lines

Modifying struct allocation in kmalloc() to match the coding standards.

Quoted 8 lines
Quoted 4 lines

Checkpatch.pl CHECK: Prefer kmalloc(sizeof(*ldisc_data)...) over kmalloc(sizeof(struct spk_ldisc_data)...)

Since there was no change since last version in both patches, you can already put my previous Reviewed-by tag for both.

Missed that.
Thanks!

Sam

Quoted 30 lines
Quoted 23 lines

---
Changes in v2:
- None.

 drivers/staging/speakup/spk_ttyio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/spk_ttyio.c +1 -2
index 5a9eff08cb96..9b95f77f9265 100644
@@ -51,7 +51,7 @@ static int spk_ttyio_ldisc_open(struct tty_struct *tty)
 		return -EOPNOTSUPP;
 	speakup_tty = tty;
 
-	ldisc_data = kmalloc(sizeof(struct spk_ldisc_data), GFP_KERNEL);
+	ldisc_data = kmalloc(sizeof(*ldisc_data), GFP_KERNEL);
 	if (!ldisc_data)
 		return -ENOMEM;
 
---

2.20.1

Signature · 1 line
Samuel
Quoted 2 lines

Voici mon problème, j'ai deux PCs relies par des cartes ethernet, configures avec le protocole PPP.

-+- Romain in Guide du linuxien pervers - "Ils sont fous ces romains !" -+-

#4 lore raw

PATCH v2 2/2 Staging: speakup: Add identifier name to function declaration arguments.

In reply to Sam Muhammed

void (*read_buff_add) argument didn't have an identifier name, adding a name to it like the rest of all functions' arguments.

---
Changes in v2:
- None.

 drivers/staging/speakup/spk_types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/speakup/spk_types.h +1 -1
index a2fc72c29894..fc6a9416829c 100644
@@ -189,7 +189,7 @@ struct spk_synth {
 	void (*flush)(struct spk_synth *synth);
 	int (*is_alive)(struct spk_synth *synth);
 	int (*synth_adjust)(struct st_var_header *var);
-	void (*read_buff_add)(u_char);
+	void (*read_buff_add)(u_char c);
 	unsigned char (*get_index)(struct spk_synth *synth);
 	struct synth_indexing indexing;
 	int alive;

---
2.20.1