Skip to contentSkip to conversation

staging: emxx_udc: Add comment for spinlock_t definition.

PATCH Superseded Varsha Rao 2 participants 3 messages Mar 2, 2017 Staging

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Varsha Rao

author
#0 lore raw

PATCH v4 1/1 staging: emxx_udc: Add comment for spinlock_t definition.

The nbu2ss_udc structure is used to perform various usb device operations. It is important to protect the members as they can make system calls. Lock variable of type spinlock_t, is used to provide protection by using various spinlock functions.

In this patch, comment is added for spinlock_t definition, to fix the following checkpatch issue:

CHECK: spinlock_t definition without comment

---
Changes in v2:
-Modified commit message.

Changes in v3:
-Modified commit message.

Changes in v4:
-Added proper version number.

 drivers/staging/emxx_udc/emxx_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/emxx_udc/emxx_udc.h +1 -1
index 789bfb9..78c08e1 100644
@@ -567,7 +567,7 @@ struct nbu2ss_udc {
 	struct usb_gadget_driver *driver;
 	struct platform_device *pdev;
 	struct device *dev;
-	spinlock_t lock;
+	spinlock_t lock; /* Protects nbu2ss_udc structure fields */
 	struct completion		*pdone;
 
 	enum ep0_state			ep0state;
Signature · 1 line
2.9.3
#1 lore raw
Quoted 4 lines · Varsha Rao

The nbu2ss_udc structure is used to perform various usb device operations. It is important to protect the members as they can make system calls. Lock variable of type spinlock_t, is used to provide protection by using various spinlock functions.

I'm not sure to understand the idea of a structure member making a system call. Normally, one puts a lock around something because the location may be shared between multiple processes, who may try to update it concurrently with other reads or writes.

julia

Quoted 43 lines

In this patch, comment is added for spinlock_t definition, to fix the following checkpatch issue:

CHECK: spinlock_t definition without comment

---
Changes in v2:
-Modified commit message.

Changes in v3:
-Modified commit message.

Changes in v4:

(quoted diff) +0 -1
-Added proper version number.
 
 drivers/staging/emxx_udc/emxx_udc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/emxx_udc/emxx_udc.h +1 -2
index 789bfb9..78c08e1 100644
@@ -567,7 +567,7 @@ struct nbu2ss_udc {
 	struct usb_gadget_driver *driver;
 	struct platform_device *pdev;
 	struct device *dev;
-	spinlock_t lock;
+	spinlock_t lock; /* Protects nbu2ss_udc structure fields */
 	struct completion		*pdone;
 
 	enum ep0_state			ep0state;
--

2.9.3

--
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 post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/58b77c39.0532630a.33e60.bc40%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.

author
#2 lore raw
Quoted 9 lines
Quoted 6 lines

The nbu2ss_udc structure is used to perform various usb device operations. It is important to protect the members as they can make system calls. Lock variable of type spinlock_t, is used to provide protection by using various spinlock functions.

I'm not sure to understand the idea of a structure member making a system call.

Sorry, for not making it clear.

Quoted 14 lines

Normally, one puts a lock around something because the location may
be shared between multiple processes, who may try to update it concurrently with other reads or writes.

Quoted 9 lines
drivers/staging/emxx_udc/emxx_udc.h +1 -1
@@ -567,7 +567,7 @@ struct nbu2ss_udc { 
         struct usb_gadget_driver *driver; 
         struct platform_device *pdev; 
         struct device *dev; 
-        spinlock_t lock; 
+        spinlock_t lock; /* Protects nbu2ss_udc structure fields */ 
         struct completion                *pdone; 
 
         enum ep0_state                        ep0state;