[ofw] [Patches 8/26][Core] [Gutils]Adjust code to remove Prefast errors and warning

Smith, Stan stan.smith at intel.com
Wed Jun 22 11:06:16 PDT 2011


Why not just ntstrsafe.h without the NTDDI_WIN8?

+#ifdef NTDDI_WIN8
+#include <ntstrsafe.h>
+#else
+#include <strsafe.h>
+#endif
 
-#include <strsafe.h>

Is there a serialization issue w.r.t. IRQ when these macros are used in kernel drivers?
cl_spinlock_acquire() does not fiddle with IRQ?

-#define read_lock_irqsave					spin_lock_irqsave
-#define read_unlock_irqrestore				spin_unlock_irqrestore
+#define read_lock_irqsave(lock, flags) 		cl_spinlock_acquire(lock)
+#define read_unlock_irqrestore(lock, flags) cl_spinlock_release(lock)

Keep-it-simple: skip the conditional

+#ifndef NTDDI_WIN8
 #include <strsafe.h>
+#endif

Duplicate defines in l2w_spinlock.h and mt_spinlock.h ?

 l2w_spinlock.h
-#define read_lock_irqsave					spin_lock_irqsave
-#define read_unlock_irqrestore				spin_unlock_irqrestore
+#define read_lock_irqsave(lock, flags) 		cl_spinlock_acquire(lock)
+#define read_unlock_irqrestore(lock, flags) cl_spinlock_release(lock)
 #define write_lock_irq						spin_lock_irq
 #define write_unlock_irq					spin_unlock_irq
 mt_spinlock.h

+#define spin_lock_irqsave (lock, flags) cl_spinlock_acquire(lock)
+#define spin_unlock_irqrestore (lock, flags) cl_spinlock_release(lock)
 
+
 /* Windows doesn't support such kind of spinlocks so far, but may be tomorrow ... */
-#define rwlock_init						spin_lock_init
-#define read_lock_irqsave				spin_lock_irqsave
-#define read_unlock_irqrestore			spin_unlock_irqrestore
-#define write_lock_irq					spin_lock_irq
+#define rwlock_init							spin_lock_init
+#define read_lock_irqsave(lock, flags) 		cl_spinlock_acquire(lock)
+#define read_unlock_irqrestore(lock, flags) cl_spinlock_release(lock)
+#define write_lock_irq						spin_lock_irq



>-----Original Message-----
>From: Alex Naslednikov [mailto:xalex at mellanox.co.il]
>Sent: Sunday, June 19, 2011 5:27 AM
>To: Alex Naslednikov; ofw at lists.openfabrics.org; Smith, Stan
>Subject: [ofw] [Patches 8/26][Core] [Gutils]Adjust code to remove Prefast errors and warning
>
>Prefast: add driver directives
>
>
>
>
>Alexander (XaleX) Naslednikov
>SW Networking Team
>Mellanox Technologies




More information about the ofw mailing list