login
Header Space

 
 

Re: [PATCH 1/2 v2] Driver for Freescale 8610 and 5121 DIU

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: York Sun <yorksun@...>, <linux-kernel@...>, <linuxppc-dev@...>, <galak@...>, <linux-fbdev-devel@...>, <timur@...>, Ingo Molnar <mingo@...>
Date: Thursday, March 20, 2008 - 7:02 pm

On Thu, 2008-03-20 at 15:27 -0700, Andrew Morton wrote:


#define __SPIN_LOCK_UNLOCKED(lockname)

seems pretty suggestive to me, also DEFINE_SPINLOCK(x) shows the proper
usage; the right thing would have been:

static struct diu_hw dr = {
 	.mode = MFB_MODE1,
-	.reg_lock = __SPIN_LOCK_UNLOCKED(old_style_spin_init),
+	.reg_lock = __SPIN_LOCK_UNLOCKED(dr.reg_lock),
};

Where 'dr.reg_lock' is the expression to locate the actual object.

Does something like this make sense to you:

---
Subject: lockdep: document __SPIN_LOCK_UNLOCKED() usage

Small comment clarifying the intended usage of __SPIN_LOCK_UNLOCKED()

[ for the observant readers; yes this prescribes a usage that is more
  than strictly needed, it does however enable interesting future uses ]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
diff --git a/include/linux/spinlock_types.h b/include/linux/spinlock_types.h
index 68d88f7..4278558 100644
--- a/include/linux/spinlock_types.h
+++ b/include/linux/spinlock_types.h
@@ -63,6 +63,10 @@ typedef struct {
 # define RW_DEP_MAP_INIT(lockname)
 #endif
 
+/*
+ * __*_LOCK_UNLOCKED(lockname), where 'lockname' is a valid C expression
+ * that evaluates to the actual object being initialized.
+ */
 #ifdef CONFIG_DEBUG_SPINLOCK
 # define __SPIN_LOCK_UNLOCKED(lockname)					\
 	(spinlock_t)	{	.raw_lock = __RAW_SPIN_LOCK_UNLOCKED,	\
---

Perhaps I should make the macros do something like:

  typecheck(spinlock_t, lockname)

And sweep the tree to make it compile again.


FWIW, I prefer the form: GFP_type | __GFP_modifiers

For instance: 'GFP_KERNEL | __GFP_DMA | __GFP_ZERO'



--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
v2 patch for Freescale DIU driver, York Sun, (Wed Mar 19, 2:50 pm)
Re: [PATCH 1/2 v2] Driver for Freescale 8610 and 5121 DIU, Andrew Morton, (Thu Mar 20, 6:27 pm)
Re: [PATCH 1/2 v2] Driver for Freescale 8610 and 5121 DIU, Andrew Morton, (Fri Mar 21, 2:12 pm)
Re: [PATCH 1/2 v2] Driver for Freescale 8610 and 5121 DIU, Andrew Morton, (Mon Mar 24, 2:47 pm)
Re: [PATCH 1/2 v2] Driver for Freescale 8610 and 5121 DIU, Peter Zijlstra, (Thu Mar 20, 7:02 pm)
Re: [PATCH 2/2 v2] Add DIU platform code for MPC8610HPCD, Andrew Morton, (Thu Mar 20, 6:33 pm)
Re: [PATCH 2/2 v2] Add DIU platform code for MPC8610HPCD, Andy Whitcroft, (Tue Mar 25, 8:43 am)
Re: [PATCH 2/2 v2] Add DIU platform code for MPC8610HPCD, Andrew Morton, (Tue Mar 25, 3:18 pm)
speck-geostationary