Search Linux Wireless

Re: [PATCH 2/3 v2] compat-2.6: Add some missing functions and macros

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Michael Bernhard <michael.bernhard@xxxxxx>
---
I'm sorry. The folowing two lines slipped through:

> +/* Undef BIT() which is defined in include/linux/bitops.h */
> +#undef BIT

Here is a new patch.

 compat/compat.h         |   28 ++++++++++++++++++++++++++++
 scripts/admin-update.sh |   10 ++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/compat/compat.h b/compat/compat.h
index 4ae26ac..0d940ab 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -30,6 +30,9 @@
 #include <linux/init.h>
 #include <linux/uaccess.h>
 
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+
 #include <net/arp.h>
 #include <net/neighbour.h>
 
@@ -403,6 +406,31 @@ static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
 	led_classdev_unregister(lcd);
 }
 
+/* From include/linux/device.h */
+static inline const char *dev_name(struct device *dev)
+{
+	/* will be changed into kobject_name(&dev->kobj) in the near future */
+	return dev->bus_id;
+}
+
+/* From include/linux/kernel.h */
+/**
+ * clamp_val - return a value clamped to a given range using val's type
+ * @val: current value
+ * @min: minimum allowable value
+ * @max: maximum allowable value
+ *
+ * This macro does no typechecking and uses temporary variables of whatever
+ * type the input argument 'val' is.  This is useful when val is an unsigned
+ * type and min and max are literals that will otherwise be assigned a signed
+ * integer type.
+ */
+#define clamp_val(val, min, max) ({		\
+	typeof(val) __val = (val);		\
+	typeof(val) __min = (min);		\
+	typeof(val) __max = (max);		\
+	__val = __val < __min ? __min: __val;	\
+	__val > __max ? __max: __val; })
 
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) */
 #endif /* LINUX_26_COMPAT_H */
diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh
index 555c1e8..55ef211 100755
--- a/scripts/admin-update.sh
+++ b/scripts/admin-update.sh
@@ -23,6 +23,9 @@ INCLUDE_LINUX="$INCLUDE_LINUX pci_ids.h bitops.h eeprom_93cx6.h pm_qos_params.h"
 # For rndis_wext
 INCLUDE_LINUX_USB="usbnet.h rndis_host.h"
 
+# Unaligned access
+INCLUDE_LINUX_UNALIGNED="access_ok.h generic.h"
+
 # Stuff that should die or be merged, only ipw uses it
 INCLUDE_NET_OLD="ieee80211.h ieee80211_crypt.h"
 # The good new yummy stuff
@@ -73,6 +76,7 @@ DRIVER_FILES="$DRIVER_FILES rndis_wlan.c"
 DRIVER_FILES="$DRIVER_FILES at76_usb.h at76_usb.c"
 
 mkdir -p include/linux/ include/net/ include/linux/usb \
+	include/linux/unaligned \
 	net/mac80211/ net/wireless/ net/ieee80211/ \
 	drivers/ssb/ \
 	drivers/net/usb/ \
@@ -100,6 +104,12 @@ for i in $INCLUDE_LINUX_USB; do
 	cp $GIT_TREE/$DIR/$i $DIR/
 done
 
+DIR="include/linux/unaligned"
+for i in $INCLUDE_LINUX_UNALIGNED; do
+	echo "Copying $GIT_TREE/$DIR/$i"
+	cp $GIT_TREE/$DIR/$i $DIR/
+done
+
 # net/wireless and net/mac80211
 for i in $NET_DIRS; do
 	echo "Copying $GIT_TREE/net/$i/*.[ch]"
-- 
1.5.2.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux