Skip to contentSkip to conversation

staging: greybus: uart: Add comments for lock definitions

PATCH In review Noah Techoueyres 2 participants 2 messages Aug 3 – Aug 8

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: greybus: uart: Add comments for lock definitions

Add comments to spinlock and mutex fields explaining what they protect, as required by kernel coding style for lock definitions.

---
 drivers/staging/greybus/uart.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/greybus/uart.c +3 -3
index 7d060b4cd33d..46f38428c5cc 100644
@@ -50,12 +50,12 @@ struct gb_tty {
 	unsigned int minor;
 	unsigned char clocal;
 	bool disconnected;
-	spinlock_t read_lock;
-	spinlock_t write_lock;
+	spinlock_t read_lock; /* Protects read operations */
+	spinlock_t write_lock; /* Protects write operations */
 	struct async_icount iocount;
 	struct async_icount oldcount;
 	wait_queue_head_t wioctl;
-	struct mutex mutex;
+	struct mutex mutex; /* Protects port configuration */
 	u8 ctrlin;	/* input control lines */
 	u8 ctrlout;	/* output control lines */
 	struct gb_uart_set_line_coding_request line_coding;
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · Noah Techoueyres

Add comments to spinlock and mutex fields explaining what they protect, as required by kernel coding style for lock definitions.

---

To be honest, I don't love this checkpatch warning. It seems like a really easy task but it's actually difficult so it tricks people into sending patches that they shouldn't.

We really want a proper analysis of the locking and not a three word guess. What I *really* want is for people to check for bugs as they are doing this analysis. If you can't find the bugs then this task is too difficult at this stage.

regards,
dan carpenter