Skip to contentSkip to conversation

hpilo: add locking comment

PATCH New David Altobelli 1 participant 1 message Aug 19, 2009

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

PATCH 1/1 hpilo: add locking comment

Add explanation about lock nesting and purpose of each lock in hpilo.

This applies on top of a set of patches I sent out to add polling to hpilo.

Please CC me on any replies, and thanks,
Dave

---

drivers/misc/hpilo.h renamed from drivers/misc/hpilo.h.orig +12 -1
@@ -44,9 +44,20 @@ struct ilo_hwinfo {
 
 	struct pci_dev *ilo_dev;
 
+	/*
+	 * open_lock      serializes ccb_cnt during open and close
+	 * [ irq disabled ]
+	 * -> alloc_lock  used when adding/removing/searching ccb_alloc,
+	 *                which represents all ccbs open on the device
+	 * --> fifo_lock  controls access to fifo queues shared with hw
+	 *
+	 * Locks must be taken in this order, but open_lock and alloc_lock
+	 * are optional, they do not need to be held in order to take a
+	 * lower level lock.
+	 */
+	spinlock_t open_lock;
 	spinlock_t alloc_lock;
 	spinlock_t fifo_lock;
-	spinlock_t open_lock;
 
 	struct cdev cdev;
 };