]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: Fix build errors on older kernels.
authorGreg Kroah-Hartman <greg@kroah.com>
Thu, 11 Sep 2014 15:22:06 +0000 (08:22 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Thu, 11 Sep 2014 15:22:06 +0000 (08:22 -0700)
Thanks to Marti for pointing out the code didn't build properly on 3.10.
Added kernel_ver.h to handle any api mis-matches between the code and
older kernel versions.

drivers/staging/greybus/gpio-gb.c
drivers/staging/greybus/kernel_ver.h [new file with mode: 0644]
drivers/staging/greybus/sysfs.c

index 3428220c5158599d417e202426110fa862a82633..bcf65087e8e5d293c866d98c982ca43853dccd70 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/gpio.h>
-#include <linux/gpio/driver.h>
+#include <linux/gpio.h>
 #include "greybus.h"
 
 struct gb_gpio_device {
@@ -90,10 +90,11 @@ int gb_gpio_probe(struct greybus_device *gdev,
 void gb_gpio_disconnect(struct greybus_device *gdev)
 {
        struct gb_gpio_device *gb_gpio_dev;
+       int retval;
 
        gb_gpio_dev = gdev->gb_gpio_dev;
 
-       gpiochip_remove(&gb_gpio_dev->chip);
+       retval = gpiochip_remove(&gb_gpio_dev->chip);
        kfree(gb_gpio_dev);
 }
 
diff --git a/drivers/staging/greybus/kernel_ver.h b/drivers/staging/greybus/kernel_ver.h
new file mode 100644 (file)
index 0000000..40cc2e8
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ * Greybus kernel "version" glue logic.
+ *
+ * Copyright 2014 Google Inc.
+ *
+ * Released under the GPLv2 only.
+ *
+ * Backports of newer kernel apis to allow the code to build properly on older
+ * kernel versions.  Remove this file when merging to upstream, it should not be
+ * needed at all
+ */
+
+#ifndef __GREYBUS_KERNEL_VER_H
+#define __GREYBUS_KERNEL_VER_H
+
+#ifndef DEVICE_ATTR_RO
+#define DEVICE_ATTR_RO(_name) \
+       struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
+#endif
+
+
+#endif /* __GREYBUS_KERNEL_VER_H */
index 2393a6a0b678c430f351e1a403540693fe65b2bc..c02ca552c1a0723620c18cea70f55ad42c483496 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "greybus.h"
 
+#include "kernel_ver.h"
+
 /* Function fields */
 #define greybus_function_attr(field)                                   \
 static ssize_t function_##field##_show(struct device *dev,             \