]> git.openfabrics.org - ~emulex/for-vlad/old/compat.git/blobdiff - include/linux/compat-2.6.34.h
compat: backport PCMCIA_DEVICE_PROD_ID3
[~emulex/for-vlad/old/compat.git] / include / linux / compat-2.6.34.h
index 4229a22bfd0d52206dd2f96b5093654d7bf0ffb7..1cb3e06f94824c9772d884bf2ef93bdef6d94e23 100644 (file)
@@ -63,8 +63,105 @@ do {                                                                \
        0;                                                      \
 })
 #endif
+
+#if defined(VERBOSE_DEBUG)
+#define netdev_vdbg    netdev_dbg
+#else
+
+#define netdev_vdbg(dev, format, args...)                      \
+({                                                             \
+       if (0)                                                  \
+               netdev_printk(KERN_DEBUG, dev, format, ##args); \
+       0;                                                      \
+})
+#endif
+
+/*
+ * netdev_WARN() acts like dev_printk(), but with the key difference
+ * of using a WARN/WARN_ON to get the message out, including the
+ * file/line information and a backtrace.
+ */
+#define netdev_WARN(dev, format, args...)                      \
+       WARN(1, "netdevice: %s\n" format, netdev_name(dev), ##args);
+
+/* netif printk helpers, similar to netdev_printk */
+
+#define netif_printk(priv, type, level, dev, fmt, args...)     \
+do {                                                           \
+       if (netif_msg_##type(priv))                             \
+               netdev_printk(level, (dev), fmt, ##args);       \
+} while (0)
+
+#define netif_emerg(priv, type, dev, fmt, args...)             \
+       netif_printk(priv, type, KERN_EMERG, dev, fmt, ##args)
+#define netif_alert(priv, type, dev, fmt, args...)             \
+       netif_printk(priv, type, KERN_ALERT, dev, fmt, ##args)
+#define netif_crit(priv, type, dev, fmt, args...)              \
+       netif_printk(priv, type, KERN_CRIT, dev, fmt, ##args)
+#define netif_err(priv, type, dev, fmt, args...)               \
+       netif_printk(priv, type, KERN_ERR, dev, fmt, ##args)
+#define netif_warn(priv, type, dev, fmt, args...)              \
+       netif_printk(priv, type, KERN_WARNING, dev, fmt, ##args)
+#define netif_notice(priv, type, dev, fmt, args...)            \
+       netif_printk(priv, type, KERN_NOTICE, dev, fmt, ##args)
+#define netif_info(priv, type, dev, fmt, args...)              \
+       netif_printk(priv, type, KERN_INFO, (dev), fmt, ##args)
+
+#if defined(DEBUG)
+#define netif_dbg(priv, type, dev, format, args...)            \
+       netif_printk(priv, type, KERN_DEBUG, dev, format, ##args)
+#elif defined(CONFIG_DYNAMIC_DEBUG)
+#define netif_dbg(priv, type, netdev, format, args...)         \
+do {                                                           \
+       if (netif_msg_##type(priv))                             \
+               dynamic_dev_dbg((netdev)->dev.parent,           \
+                               "%s: " format,                  \
+                               netdev_name(netdev), ##args);   \
+} while (0)
+#else
+#define netif_dbg(priv, type, dev, format, args...)                    \
+({                                                                     \
+       if (0)                                                          \
+               netif_printk(priv, type, KERN_DEBUG, dev, format, ##args); \
+       0;                                                              \
+})
+#endif
+
+#if defined(VERBOSE_DEBUG)
+#define netif_vdbg     netdev_dbg
+#else
+#define netif_vdbg(priv, type, dev, format, args...)           \
+({                                                             \
+       if (0)                                                  \
+               netif_printk(KERN_DEBUG, dev, format, ##args);  \
+       0;                                                      \
+})
+#endif
 /* source: include/linux/netdevice.h */
 
+
+static inline void device_lock(struct device *dev)
+{
+       down(&dev->sem);
+}
+
+static inline int device_trylock(struct device *dev)
+{
+       return down_trylock(&dev->sem);
+}
+
+static inline void device_unlock(struct device *dev)
+{
+       up(&dev->sem);
+}
+
+#if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE)
+#define PCMCIA_DEVICE_PROD_ID3(v3, vh3) { \
+       .match_flags = PCMCIA_DEV_ID_MATCH_PROD_ID3, \
+       .prod_id = { NULL, NULL, (v3), NULL },  \
+       .prod_id_hash = { 0, 0, (vh3), 0 }, }
+#endif
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)) */
 
 #endif /* LINUX_26_34_COMPAT_H */