Skip to contentSkip to conversation

Staging: speakup: Misc cleanups and code reformatting.

PATCH New Sam Muhammed 1 participant 3 messages Mar 24, 2020 Staging

lore
Share & tools
lore
#0 lore raw

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

Changes to clear 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 v3:
- Adding Reviewed-by: Samuel Thibault <[email protected]> for both patches.

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 v3 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 v3:
- Adding Reviewed-by: Samuel Thibault <[email protected]> tag.

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

PATCH v3 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 v3:
- Adding Reviewed-by: Samuel Thibault <[email protected]> tag.

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