All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/18] backports: pending patches for Luis
@ 2013-04-10 11:35 Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 01/18] backports: enable DRM_NOUVEAU for 3.2 Luis R. Rodriguez
                   ` (17 more replies)
  0 siblings, 18 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Here's my dump as I worked towards the merge of our trees.

Tested with ckmake alone. I'll test ckmake --allyesconfig
in a bit with some two other new subsystem. We just might
make it in time to use this for the next release :)
I'm running i915 right now through this new tree.

1   2.6.24              [  OK  ]                                                
2   2.6.25              [  OK  ]                                                
3   2.6.26              [  OK  ]                                                
4   2.6.27              [  OK  ]                                                
5   2.6.28              [  OK  ]                                                
6   2.6.29              [  OK  ]                                                
7   2.6.30              [  OK  ]                                                
8   2.6.31              [  OK  ]                                                
9   2.6.32              [  OK  ]                                                
10  2.6.33              [  OK  ]                                                
11  2.6.34              [  OK  ]                                                
12  2.6.35              [  OK  ]                                                
13  2.6.36              [  OK  ]                                                
14  2.6.37              [  OK  ]                                                
15  2.6.38              [  OK  ]                                                
16  2.6.39              [  OK  ]                                                
17  3.0.65              [  OK  ]                                                
18  3.1.10              [  OK  ]                                                
19  3.2.38              [  OK  ]                                                
20  3.3.8               [  OK  ]                                                
21  3.4.32              [  OK  ]                                                
22  3.5.7               [  OK  ]                                                
23  3.6.11              [  OK  ]                                                
24  3.7.9               [  OK  ]                                                
25  3.8.0               [  OK  ]                                                
26  3.9-rc1             [  OK  ]               

Luis R. Rodriguez (18):
  backports: enable DRM_NOUVEAU for 3.2
  compat: backport dev_level_ratelimited()
  compat: backport __i2c_transfer()
  compat: backport devm_regmap_init()
  compat: backport GPIOF_OPEN_DRAIN definition
  compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  compat: backport devres_release()
  compat: backport dev_get_regmap()
  compat: backport devm_ioremap_resource()
  compat: backport module_platform_driver_probe()
  compat: add helpers to aid backport of generic DMA changes for v4l
  compat: backport dma_get_sgtable()
  backports: add blacklist module support
  backports: add support for module compression
  backports: add check_depmod to look for module search path
  backports: add udev rules if required for backported firmware_class
  backports: use depmod -a
  backports: add update-initramfs support

 backport/.blacklist.map                    |   10 ++
 backport/Makefile.real                     |   20 +--
 backport/compat/compat-3.4.c               |  232 ++++++++++++++++++++++++++++
 backport/compat/compat-3.5.c               |   34 ++++
 backport/compat/compat-3.6.c               |   52 +++++++
 backport/compat/compat-3.9.c               |   55 +++++++
 backport/include/linux/compat-3.4.h        |   42 +++++
 backport/include/linux/compat-3.5.h        |   51 ++++++
 backport/include/linux/compat-3.6.h        |   28 ++++
 backport/include/linux/compat-3.9.h        |   31 ++++
 backport/scripts/are_mods_compressed       |    8 +
 backport/scripts/backport_firmware_install |   21 +++
 backport/scripts/blacklist.sh              |   35 +++++
 backport/scripts/check_depmod              |   78 ++++++++++
 backport/scripts/mod_path                  |    8 +
 backport/scripts/update-initramfs          |   62 ++++++++
 backport/udev/50-compat_firmware.rules     |    4 +
 backport/udev/compat_firmware.sh           |   35 +++++
 backport/udev/ubuntu/compat_firmware.sh    |   29 ++++
 dependencies                               |    1 -
 gentree.py                                 |    1 +
 21 files changed, 827 insertions(+), 10 deletions(-)
 create mode 100644 backport/.blacklist.map
 create mode 100755 backport/scripts/are_mods_compressed
 create mode 100755 backport/scripts/backport_firmware_install
 create mode 100755 backport/scripts/blacklist.sh
 create mode 100755 backport/scripts/check_depmod
 create mode 100755 backport/scripts/mod_path
 create mode 100755 backport/scripts/update-initramfs
 create mode 100644 backport/udev/50-compat_firmware.rules
 create mode 100755 backport/udev/compat_firmware.sh
 create mode 100755 backport/udev/ubuntu/compat_firmware.sh

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 51+ messages in thread

* [PATCH 01/18] backports: enable DRM_NOUVEAU for 3.2
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:15   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 02/18] compat: backport dev_level_ratelimited() Luis R. Rodriguez
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 dependencies |    1 -
 1 file changed, 1 deletion(-)

diff --git a/dependencies b/dependencies
index e9aaa2e..44e23da 100644
--- a/dependencies
+++ b/dependencies
@@ -45,7 +45,6 @@ MWIFIEX 2.6.27
 HDMI 3.2
 DRM 3.2
 DRM_TTM 3.2
-DRM_NOUVEAU 3.3
 
 # This requires proc_create(), and that doesn't exist before 2.6.24
 LIBIPW_DEBUG 2.6.25
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 02/18] compat: backport dev_level_ratelimited()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 01/18] backports: enable DRM_NOUVEAU for 3.2 Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:16   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 03/18] compat: backport __i2c_transfer() Luis R. Rodriguez
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains 6ca04593
v3.5-rc1~147^2~7

This is only enabled for kernels where ratelimit.h was added.

commit 6ca045930338485a8cdef117e74372aa1678009d
Author: Hiroshi DOYU <hdoyu@nvidia.com>
Date:   Mon May 14 10:47:57 2012 +0300

    driver core: Add dev_*_ratelimited() family

    Add dev_*_ratelimited() family, dev_* version of pr_*_ratelimited().

    Using Joe Perches's proposal/implementation.

    Signed-off-by: Hiroshi DOYU <hdoyu@nvidia.com>
    Cc: Joe Perches <joe@perches.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/include/linux/compat-3.5.h |   36 +++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/backport/include/linux/compat-3.5.h b/backport/include/linux/compat-3.5.h
index 7e9e65a..dbf8f00 100644
--- a/backport/include/linux/compat-3.5.h
+++ b/backport/include/linux/compat-3.5.h
@@ -10,6 +10,42 @@
 
 #include <net/netlink.h>
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
+#include <linux/ratelimit.h>
+#define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	if (__ratelimit(&_rs))						\
+		dev_level(dev, fmt, ##__VA_ARGS__);			\
+} while (0)
+
+#define dev_emerg_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__)
+#define dev_alert_ratelimited(dev, fmt, ...)				\
+	dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__)
+
+
+#if defined(CONFIG_DYNAMIC_DEBUG) || defined(DEBUG)
+#define dev_dbg_ratelimited(dev, fmt, ...)				\
+do {									\
+	static DEFINE_RATELIMIT_STATE(_rs,				\
+				      DEFAULT_RATELIMIT_INTERVAL,	\
+				      DEFAULT_RATELIMIT_BURST);		\
+	DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt);			\
+	if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) &&	\
+	    __ratelimit(&_rs))						\
+		__dynamic_pr_debug(&descriptor, pr_fmt(fmt),		\
+				   ##__VA_ARGS__);			\
+} while (0)
+#else
+#define dev_dbg_ratelimited(dev, fmt, ...)			\
+	no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
+#endif
+
+#endif
+
 /*
  * This backports:
  * commit 569a8fc38367dfafd87454f27ac646c8e6b54bca
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 03/18] compat: backport __i2c_transfer()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 01/18] backports: enable DRM_NOUVEAU for 3.2 Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 02/18] compat: backport dev_level_ratelimited() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:20   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 04/18] compat: backport devm_regmap_init() Luis R. Rodriguez
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains b37d2a3a
v3.6-rc1~28^2~265

commit b37d2a3a75cb0e72e18c29336cb2095b63dabfc8
Author: Jean Delvare <khali@linux-fr.org>
Date:   Fri Jun 29 07:47:19 2012 -0300

    [media] i2c: Export an unlocked flavor of i2c_transfer

    Some drivers (in particular for TV cards) need exclusive access to
    their I2C buses for specific operations. Export an unlocked flavor
    of i2c_transfer to give them full control.

    The unlocked flavor has the following limitations:
    * Obviously, caller must hold the i2c adapter lock.
    * No debug messages are logged. We don't want to log messages while
      holding a rt_mutex.
    * No check is done on the existence of adap->algo->master_xfer. It
      is thus the caller's responsibility to ensure that the function is
      OK to call.

    Signed-off-by: Jean Delvare <khali@linux-fr.org>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/compat/compat-3.6.c        |   34 ++++++++++++++++++++++++++++++++++
 backport/include/linux/compat-3.6.h |    9 +++++++++
 2 files changed, 43 insertions(+)

diff --git a/backport/compat/compat-3.6.c b/backport/compat/compat-3.6.c
index a50fc98..05954d4 100644
--- a/backport/compat/compat-3.6.c
+++ b/backport/compat/compat-3.6.c
@@ -13,6 +13,40 @@
 #include <linux/export.h>
 #include <linux/bug.h>
 #include <linux/bitmap.h>
+#include <linux/i2c.h>
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+/**
+ * __i2c_transfer - unlocked flavor of i2c_transfer
+ * @adap: Handle to I2C bus
+ * @msgs: One or more messages to execute before STOP is issued to
+ *     terminate the operation; each message begins with a START.
+ * @num: Number of messages to be executed.
+ *
+ * Returns negative errno, else the number of messages executed.
+ *
+ * Adapter lock must be held when calling this function. No debug logging
+ * takes place. adap->algo->master_xfer existence isn't checked.
+ */
+int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
+{
+	unsigned long orig_jiffies;
+	int ret, try;
+
+	/* Retry automatically on arbitration loss */
+	orig_jiffies = jiffies;
+	for (ret = 0, try = 0; try <= adap->retries; try++) {
+		ret = adap->algo->master_xfer(adap, msgs, num);
+		if (ret != -EAGAIN)
+			break;
+		if (time_after(jiffies, orig_jiffies + adap->timeout))
+			break;
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL(__i2c_transfer);
+#endif
 
 /**
  * memweight - count the total number of bits set in memory area
diff --git a/backport/include/linux/compat-3.6.h b/backport/include/linux/compat-3.6.h
index bef0503..8fddd31 100644
--- a/backport/include/linux/compat-3.6.h
+++ b/backport/include/linux/compat-3.6.h
@@ -7,6 +7,15 @@
 
 #include <linux/scatterlist.h>
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+#include <linux/i2c.h>
+/* Unlocked flavor */
+#define __i2c_transfer LINUX_BACKPORT(__i2c_transfer)
+extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
+			  int num);
+#endif
+
+
 #define memweight LINUX_BACKPORT(memweight)
 extern size_t memweight(const void *ptr, size_t bytes);
 
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 04/18] compat: backport devm_regmap_init()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (2 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 03/18] compat: backport __i2c_transfer() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:19   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 05/18] compat: backport GPIOF_OPEN_DRAIN definition Luis R. Rodriguez
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Backport devm_regmap_init() for I2C and SPI.
Asynchronous I/O support was added as of 3.9 and
since the regmap is part the core we don't want
to deal with trying a full backport replacement
yet. Given that no one as of next-20130328 uses
regmap asynchronous we simply warn if its ever
used for now. The regmap callbacks were made
bus agnostic as of commit 0135bbcc added on on
3.5 and becuase of this we we just remove all
that from our port given that we do this port
for kernels < 3.4.

This works with the old core regmap implementation
added as of 3.1 given that static inlines were
used as wrapper for calls and the bus context
was only used by the internal code.

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains c0eb4676
v3.4-rc1~126^2~4^2

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains 0d509f2b
v3.9-rc2~19^2~6^2~5

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains 0135bbcc
v3.5-rc1~117^2~7^3~6

commit c0eb46766d395da8d62148bda2e59bad5e6ee2f2
Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date:   Mon Jan 30 19:56:52 2012 +0000

    regmap: Implement managed regmap_init()

    Save error handling and unwinding code in drivers by providing managed
    versions of the regmap init functions, simplifying usage.

    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit 0d509f2b112b21411712f0bf789b372987967e49
Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date:   Sun Jan 27 22:07:38 2013 +0800

    regmap: Add asynchronous I/O support

    Some use cases like firmware download can transfer a lot of data in quick
    succession. With high speed buses these use cases can benefit from having
    multiple transfers scheduled at once since this allows the bus to minimise
    the delay between transfers.

    Support this by adding regmap_raw_write_async(), allowing raw transfers to
    be scheduled, and regmap_async_complete() to wait for them to finish.

    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

commit 0135bbcc7a0cc056f0203ff839466236b8e3dc19
Author: Stephen Warren <swarren@nvidia.com>
Date:   Wed Apr 4 15:48:30 2012 -0600

    regmap: introduce explicit bus_context for bus callbacks

    The only context needed by I2C and SPI bus definitions is the device
    itself; this can be converted to an i2c_client or spi_device in order
    to perform IO on the device. However, other bus types may need more
    context in order to perform IO. Enable this by having regmap_init accept
    a bus_context parameter, and pass this to all bus callbacks. The
    existing callbacks simply pass the struct device here. Future bus types
    may pass something else.

    Signed-off-by: Stephen Warren <swarren@nvidia.com>
    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/compat/compat-3.4.c        |  232 +++++++++++++++++++++++++++++++++++
 backport/include/linux/compat-3.4.h |   40 ++++++
 2 files changed, 272 insertions(+)

diff --git a/backport/compat/compat-3.4.c b/backport/compat/compat-3.4.c
index f8512e4..eec311a 100644
--- a/backport/compat/compat-3.4.c
+++ b/backport/compat/compat-3.4.c
@@ -12,6 +12,238 @@
 #include <linux/module.h>
 #include <linux/wait.h>
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+#include <linux/regmap.h>
+#include <linux/i2c.h>
+#include <linux/spi/spi.h>
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
+
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+#if defined(CONFIG_REGMAP)
+static void devm_regmap_release(struct device *dev, void *res)
+{
+	regmap_exit(*(struct regmap **)res);
+}
+
+#if defined(CONFIG_REGMAP_I2C)
+static int regmap_i2c_write(
+			    struct device *dev,
+			    const void *data,
+			    size_t count)
+{
+	struct i2c_client *i2c = to_i2c_client(dev);
+	int ret;
+
+	ret = i2c_master_send(i2c, data, count);
+	if (ret == count)
+		return 0;
+	else if (ret < 0)
+		return ret;
+	else
+		return -EIO;
+}
+
+static int regmap_i2c_gather_write(
+				   struct device *dev,
+				   const void *reg, size_t reg_size,
+				   const void *val, size_t val_size)
+{
+	struct i2c_client *i2c = to_i2c_client(dev);
+	struct i2c_msg xfer[2];
+	int ret;
+
+	/* If the I2C controller can't do a gather tell the core, it
+	 * will substitute in a linear write for us.
+	 */
+	if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_NOSTART))
+		return -ENOTSUPP;
+
+	xfer[0].addr = i2c->addr;
+	xfer[0].flags = 0;
+	xfer[0].len = reg_size;
+	xfer[0].buf = (void *)reg;
+
+	xfer[1].addr = i2c->addr;
+	xfer[1].flags = I2C_M_NOSTART;
+	xfer[1].len = val_size;
+	xfer[1].buf = (void *)val;
+
+	ret = i2c_transfer(i2c->adapter, xfer, 2);
+	if (ret == 2)
+		return 0;
+	if (ret < 0)
+		return ret;
+	else
+		return -EIO;
+}
+
+static int regmap_i2c_read(
+			   struct device *dev,
+			   const void *reg, size_t reg_size,
+			   void *val, size_t val_size)
+{
+	struct i2c_client *i2c = to_i2c_client(dev);
+	struct i2c_msg xfer[2];
+	int ret;
+
+	xfer[0].addr = i2c->addr;
+	xfer[0].flags = 0;
+	xfer[0].len = reg_size;
+	xfer[0].buf = (void *)reg;
+
+	xfer[1].addr = i2c->addr;
+	xfer[1].flags = I2C_M_RD;
+	xfer[1].len = val_size;
+	xfer[1].buf = val;
+
+	ret = i2c_transfer(i2c->adapter, xfer, 2);
+	if (ret == 2)
+		return 0;
+	else if (ret < 0)
+		return ret;
+	else
+		return -EIO;
+}
+
+static struct regmap_bus regmap_i2c = {
+	.write = regmap_i2c_write,
+	.gather_write = regmap_i2c_gather_write,
+	.read = regmap_i2c_read,
+};
+#endif /* defined(CONFIG_REGMAP_I2C) */
+
+/**
+ * devm_regmap_init(): Initialise managed register map
+ *
+ * @dev: Device that will be interacted with
+ * @bus: Bus-specific callbacks to use with device
+ * @bus_context: Data passed to bus-specific callbacks
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer
+ * to a struct regmap.  This function should generally not be called
+ * directly, it should be called by bus-specific init functions.  The
+ * map will be automatically freed by the device management code.
+ */
+struct regmap *devm_regmap_init(struct device *dev,
+				const struct regmap_bus *bus,
+				const struct regmap_config *config)
+{
+	struct regmap **ptr, *regmap;
+
+	ptr = devres_alloc(devm_regmap_release, sizeof(*ptr), GFP_KERNEL);
+	if (!ptr)
+		return ERR_PTR(-ENOMEM);
+
+	regmap = regmap_init(dev,
+			     bus,
+			     config);
+	if (!IS_ERR(regmap)) {
+		*ptr = regmap;
+		devres_add(dev, ptr);
+	} else {
+		devres_free(ptr);
+	}
+
+	return regmap;
+}
+EXPORT_SYMBOL_GPL(devm_regmap_init);
+
+#if defined(CONFIG_REGMAP_I2C)
+/**
+ * devm_regmap_init_i2c(): Initialise managed register map
+ *
+ * @i2c: Device that will be interacted with
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer
+ * to a struct regmap.  The regmap will be automatically freed by the
+ * device management code.
+ */
+struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
+				    const struct regmap_config *config)
+{
+	return devm_regmap_init(&i2c->dev, &regmap_i2c, config);
+}
+EXPORT_SYMBOL_GPL(devm_regmap_init_i2c);
+#endif /* defined(CONFIG_REGMAP_I2C) */
+
+#if defined(CONFIG_REGMAP_SPI)
+static int regmap_spi_write(
+			    struct device *dev,
+			    const void *data, size_t count)
+{
+	struct spi_device *spi = to_spi_device(dev);
+
+	return spi_write(spi, data, count);
+}
+
+static int regmap_spi_gather_write(
+				   struct device *dev,
+				   const void *reg, size_t reg_len,
+				   const void *val, size_t val_len)
+{
+	struct spi_device *spi = to_spi_device(dev);
+	struct spi_message m;
+	struct spi_transfer t[2] = { { .tx_buf = reg, .len = reg_len, },
+				     { .tx_buf = val, .len = val_len, }, };
+
+	spi_message_init(&m);
+	spi_message_add_tail(&t[0], &m);
+	spi_message_add_tail(&t[1], &m);
+
+	return spi_sync(spi, &m);
+}
+
+static int regmap_spi_read(
+			   struct device *dev,
+			   const void *reg, size_t reg_size,
+			   void *val, size_t val_size)
+{
+	struct spi_device *spi = to_spi_device(dev);
+
+	return spi_write_then_read(spi, reg, reg_size, val, val_size);
+}
+
+static struct regmap_bus regmap_spi = {
+	.write = regmap_spi_write,
+	.gather_write = regmap_spi_gather_write,
+/*
+ * See commit 0d509f2b112b
+ * only 3.9 kernels have this we'll ignore it
+ * given I have not seen drivers use these we
+ * are backporting. We'll -EINVAL these.
+ */
+#if 0
+	.async_write = regmap_spi_async_write,
+	.async_alloc = regmap_spi_async_alloc,
+#endif
+	.read = regmap_spi_read,
+	.read_flag_mask = 0x80,
+
+};
+
+/**
+ * devm_regmap_init_spi(): Initialise register map
+ *
+ * @spi: Device that will be interacted with
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer
+ * to a struct regmap.  The map will be automatically freed by the
+ * device management code.
+ */
+struct regmap *devm_regmap_init_spi(struct spi_device *spi,
+				    const struct regmap_config *config)
+{
+	return devm_regmap_init(&spi->dev, &regmap_spi, config);
+}
+EXPORT_SYMBOL_GPL(devm_regmap_init_spi);
+#endif /* defined(CONFIG_REGMAP_SPI) */
+
+#endif /* defined(CONFIG_REGMAP) */
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
+
 /* __wake_up_common was declared as part of the wait.h until
  * 2.6.31 in which they made it private to the scheduler. Prefix it with
  * compat to avoid double declaration issues.
diff --git a/backport/include/linux/compat-3.4.h b/backport/include/linux/compat-3.4.h
index 01a72b7..a152d51 100644
--- a/backport/include/linux/compat-3.4.h
+++ b/backport/include/linux/compat-3.4.h
@@ -11,6 +11,46 @@
 #include <linux/kconfig.h>
 #endif
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+#if defined(CONFIG_REGMAP)
+#include <linux/regmap.h>
+#define devm_regmap_init LINUX_BACKPORT(devm_regmap_init)
+struct regmap *devm_regmap_init(struct device *dev,
+				const struct regmap_bus *bus,
+				const struct regmap_config *config);
+#if defined(CONFIG_REGMAP_I2C)
+#define devm_regmap_init_i2c LINUX_BACKPORT(devm_regmap_init_i2c)
+struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
+				    const struct regmap_config *config);
+#endif /* defined(CONFIG_REGMAP_I2C) */
+#if defined(CONFIG_REGMAP_SPI)
+#define devm_regmap_init_spi LINUX_BACKPORT(devm_regmap_init_spi)
+struct regmap *devm_regmap_init_spi(struct spi_device *dev,
+				    const struct regmap_config *config);
+#endif /* defined(CONFIG_REGMAP_SPI) */
+
+/*
+ * We can't backport these unless we try to backport
+ * the full regmap into core so warn if used.
+ * No drivers are using this yet anyway.
+ */
+#define regmap_raw_write_async LINUX_BACKPORT(regmap_raw_write_async)
+static inline int regmap_raw_write_async(struct regmap *map, unsigned int reg,
+					 const void *val, size_t val_len)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+	return -EINVAL;
+}
+
+#define regmap_async_complete LINUX_BACKPORT(regmap_async_complete)
+static inline void regmap_async_complete(struct regmap *map)
+{
+	WARN_ONCE(1, "regmap API is disabled");
+}
+
+#endif /* defined(CONFIG_REGMAP) */
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
+
 /*
  * defined here to allow things to compile but technically
  * using this for memory regions will yield in a no-op on newer
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 05/18] compat: backport GPIOF_OPEN_DRAIN definition
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (3 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 04/18] compat: backport devm_regmap_init() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:18   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE() Luis R. Rodriguez
                   ` (12 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

This functionality will just be ignored, later we'll
just port the full gpiolib.

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains  aca5ce14
v3.4-rc1~65^2~20

commit aca5ce14eb773a75e5d935968b2e390dc5bd29c3
Author: Laxman Dewangan <ldewangan@nvidia.com>
Date:   Fri Feb 17 20:26:21 2012 +0530

    gpio: gpiolib: Support for open drain/collector gpios

    Adding support for the open drain gpio on which client
    can specify the open drain property through GPIO flag
    GPIOF_OPEN_DRAIN at the time of gpio request.
    The open drain pins are normally pulled high and it
    cannot be driven to output with value of 1 and so
    when client request for setting the pin to HIGH, the
    gpio will be set to input direction to make pin in tristate
    and hence PULL-UP on pins will make the state to HIGH.
    The open drain pin can be driven to LOW by setting output
    with value of 0.

    Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
    Reviwed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Acked-by: Linus Walleij <linus.walleij@linaro.org>
    Signed-off-by: Grant Likely <grant.likely@secretlab.ca>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/include/linux/compat-3.4.h |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/backport/include/linux/compat-3.4.h b/backport/include/linux/compat-3.4.h
index a152d51..528ae09 100644
--- a/backport/include/linux/compat-3.4.h
+++ b/backport/include/linux/compat-3.4.h
@@ -11,6 +11,8 @@
 #include <linux/kconfig.h>
 #endif
 
+#define GPIOF_OPEN_DRAIN       (1 << 2)
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
 #if defined(CONFIG_REGMAP)
 #include <linux/regmap.h>
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (4 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 05/18] compat: backport GPIOF_OPEN_DRAIN definition Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:22   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 07/18] compat: backport devres_release() Luis R. Rodriguez
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

For older kernels this is simply a matter of using
LIST_HEAD.

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains 2955b47d
v3.6-rc1~103^2~4

commit 2955b47d2c1983998a8c5915cb96884e67f7cb53
Author: Dan Williams <dan.j.williams@intel.com>
Date:   Mon Jul 9 19:33:25 2012 -0700

    [SCSI] async: introduce 'async_domain' type

    This is in preparation for teaching async_synchronize_full() to sync all
    pending async work, and not just on the async_running domain.  This
    conversion is functionally equivalent, just embedding the existing list
    in a new async_domain type.

    The .registered attribute is used in a later patch to distinguish
    between domains that want to be flushed by async_synchronize_full()
    versus those that only expect async_synchronize_{full|cookie}_domain to
    be used for flushing.

    [jejb: add async.h to scsi_priv.h for struct async_domain]
    Signed-off-by: Dan Williams <dan.j.williams@intel.com>
    Acked-by: Arjan van de Ven <arjan@linux.intel.com>
    Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Tested-by: Eldad Zack <eldad@fogrefinery.com>
    Signed-off-by: James Bottomley <JBottomley@Parallels.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/include/linux/compat-3.6.h |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/backport/include/linux/compat-3.6.h b/backport/include/linux/compat-3.6.h
index 8fddd31..49f4d3b 100644
--- a/backport/include/linux/compat-3.6.h
+++ b/backport/include/linux/compat-3.6.h
@@ -9,6 +9,9 @@
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
 #include <linux/i2c.h>
+
+#define ASYNC_DOMAIN_EXCLUSIVE(_domain) LIST_HEAD(_domain)
+
 /* Unlocked flavor */
 #define __i2c_transfer LINUX_BACKPORT(__i2c_transfer)
 extern int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 07/18] compat: backport devres_release()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (5 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 08/18] compat: backport dev_get_regmap() Luis R. Rodriguez
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

commit d926d0e4c74cfcb42a05e91d1cdf698b41e1e118
Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date:   Thu May 3 18:15:13 2012 +0100

    devres: Add devres_release()

    APIs using devres frequently want to implement a "remove and free the
    resource" operation so it seems sensible that they should be able to
    just have devres do the freeing for them since that's a big part of what
    devres is all about.

    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/compat/compat-3.5.c        |   34 ++++++++++++++++++++++++++++++++++
 backport/include/linux/compat-3.5.h |    6 ++++++
 2 files changed, 40 insertions(+)

diff --git a/backport/compat/compat-3.5.c b/backport/compat/compat-3.5.c
index d7f1c27..9cc8456 100644
--- a/backport/compat/compat-3.5.c
+++ b/backport/compat/compat-3.5.c
@@ -12,6 +12,40 @@
 #include <linux/highuid.h>
 #include <linux/ktime.h>
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+#include <linux/device.h>
+
+/**
+ * devres_release - Find a device resource and destroy it, calling release
+ * @dev: Device to find resource from
+ * @release: Look for resources associated with this release function
+ * @match: Match function (optional)
+ * @match_data: Data for the match function
+ *
+ * Find the latest devres of @dev associated with @release and for
+ * which @match returns 1.  If @match is NULL, it's considered to
+ * match all.  If found, the resource is removed atomically, the
+ * release function called and the resource freed.
+ *
+ * RETURNS:
+ * 0 if devres is found and freed, -ENOENT if not found.
+ */
+int devres_release(struct device *dev, dr_release_t release,
+		   dr_match_t match, void *match_data)
+{
+	void *res;
+
+	res = devres_remove(dev, release, match, match_data);
+	if (unlikely(!res))
+		return -ENOENT;
+
+	(*release)(dev, res);
+	devres_free(res);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(devres_release);
+#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0)) */
+
 /*
  * Commit 7a4e7408c5cadb240e068a662251754a562355e3
  * exported overflowuid and overflowgid for all
diff --git a/backport/include/linux/compat-3.5.h b/backport/include/linux/compat-3.5.h
index dbf8f00..1515a5b 100644
--- a/backport/include/linux/compat-3.5.h
+++ b/backport/include/linux/compat-3.5.h
@@ -10,6 +10,12 @@
 
 #include <net/netlink.h>
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+#define devres_release LINUX_BACKPORT(devres_release)
+extern int devres_release(struct device *dev, dr_release_t release,
+			  dr_match_t match, void *match_data);
+#endif
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
 #include <linux/ratelimit.h>
 #define dev_level_ratelimited(dev_level, dev, fmt, ...)			\
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 08/18] compat: backport dev_get_regmap()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (6 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 07/18] compat: backport devres_release() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 09/18] compat: backport devm_ioremap_resource() Luis R. Rodriguez
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

We can't backport dev_get_regmap() unless we backport regmap
fully onto compat, but users typically try to get the regmap in
other ways first:

        if (config->regmap)
                rdev->regmap = config->regmap;
        else if (dev_get_regmap(dev, NULL))
                rdev->regmap = dev_get_regmap(dev, NULL);
        else if (dev->parent)
                rdev->regmap = dev_get_regmap(dev->parent, NULL);

So this would option would just not be available for.

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains 72b39f6f
v3.5-rc1~117^2~7^3

commit 72b39f6f2b5a6b0beff14b80bed9756f151218a9
Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
Date:   Tue May 8 17:44:40 2012 +0100

    regmap: Implement dev_get_regmap()

    Use devres to implement dev_get_regmap(). This should mean that in almost
    all cases devices wishing to take advantage of framework features based on
    regmap shouldn't need to explicitly pass the regmap into the framework.
    This simplifies device setup a bit.

    Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/include/linux/compat-3.5.h |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/backport/include/linux/compat-3.5.h b/backport/include/linux/compat-3.5.h
index 1515a5b..e21048d 100644
--- a/backport/include/linux/compat-3.5.h
+++ b/backport/include/linux/compat-3.5.h
@@ -11,6 +11,15 @@
 #include <net/netlink.h>
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+#include <linux/regmap.h>
+
+#define dev_get_regmap LINUX_BACKPORT(dev_get_regmap)
+static inline
+struct regmap *dev_get_regmap(struct device *dev, const char *name)
+{
+	return NULL;
+}
+
 #define devres_release LINUX_BACKPORT(devres_release)
 extern int devres_release(struct device *dev, dr_release_t release,
 			  dr_match_t match, void *match_data);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 09/18] compat: backport devm_ioremap_resource()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (7 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 08/18] compat: backport dev_get_regmap() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 10/18] compat: backport module_platform_driver_probe() Luis R. Rodriguez
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

The new API gives more information to driver users but
the older kernels do not have any of these mechanisms
in place so just throw out ERR_PTR(-ENOMEM) in case
of failure.

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains 75096579
v3.9-rc1~128^2~63

commit 75096579c3ac39ddc2f8b0d9a8924eba31f4d920
Author: Thierry Reding <thierry.reding@avionic-design.de>
Date:   Mon Jan 21 11:08:54 2013 +0100

    lib: devres: Introduce devm_ioremap_resource()

    The devm_request_and_ioremap() function is very useful and helps avoid a
    whole lot of boilerplate. However, one issue that keeps popping up is
    its lack of a specific error code to determine which of the steps that
    it performs failed. Furthermore, while the function gives an example and
    suggests what error code to return on failure, a wide variety of error
    codes are used throughout the tree.

    In an attempt to fix these problems, this patch adds a new function that
    drivers can transition to. The devm_ioremap_resource() returns a pointer
    to the remapped I/O memory on success or an ERR_PTR() encoded error code
    on failure. Callers can check for failure using IS_ERR() and determine
    its cause by extracting the error code using PTR_ERR().

    devm_request_and_ioremap() is implemented as a wrapper around the new
    API and return NULL on failure as before. This ensures that backwards
    compatibility is maintained until all users have been converted to the
    new API, at which point the old devm_request_and_ioremap() function
    should be removed.

    A semantic patch is included which can be used to convert from the old
    devm_request_and_ioremap() API to the new devm_ioremap_resource() API.
    Some non-trivial cases may require manual intervention, though.

    Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/compat/compat-3.9.c        |   12 ++++++++++++
 backport/include/linux/compat-3.9.h |    4 ++++
 2 files changed, 16 insertions(+)

diff --git a/backport/compat/compat-3.9.c b/backport/compat/compat-3.9.c
index 1f24842..61a062a 100644
--- a/backport/compat/compat-3.9.c
+++ b/backport/compat/compat-3.9.c
@@ -10,6 +10,7 @@
 
 #include <linux/module.h>
 #include <linux/scatterlist.h>
+#include <linux/device.h>
 
 #ifdef __sg_page_iter_next
 
@@ -51,4 +52,15 @@ bool __sg_page_iter_next(struct sg_page_iter *piter)
 }
 EXPORT_SYMBOL_GPL(__sg_page_iter_next);
 
+void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res)
+{
+	void __iomem *dest_ptr;
+
+	dest_ptr = devm_ioremap_resource(dev, res);
+	if (!dest_ptr)
+		return ERR_PTR(-ENOMEM);
+	return dest_ptr;
+}
+EXPORT_SYMBOL_GPL(devm_ioremap_resource);
+
 #endif /* __sg_page_iter_next */
diff --git a/backport/include/linux/compat-3.9.h b/backport/include/linux/compat-3.9.h
index aed569c..a4362e2 100644
--- a/backport/include/linux/compat-3.9.h
+++ b/backport/include/linux/compat-3.9.h
@@ -15,6 +15,7 @@
 #include <linux/tty_flip.h>
 #include <linux/printk.h>
 #include <linux/scatterlist.h>
+#include <linux/device.h>
 
 /* include this before changing hlist_for_each_* to use the old versions. */
 #include <net/sch_generic.h>
@@ -207,6 +208,9 @@ static inline struct inode *file_inode(struct file *f)
 	return f->f_path.dentry->d_inode;
 }
 
+#define devm_ioremap_resource LINUX_BACKPORT(devm_ioremap_resource)
+void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(3,9,0)) */
 
 #endif /* LINUX_3_9_COMPAT_H */
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 10/18] compat: backport module_platform_driver_probe()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (8 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 09/18] compat: backport devm_ioremap_resource() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 11/18] compat: add helpers to aid backport of generic DMA changes for v4l Luis R. Rodriguez
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

This is just a helper.

commit bab734fcdf2c690371e6749ce484b17653b3cb0e
Author: Fabio Porcedda <fabio.porcedda@gmail.com>
Date:   Wed Jan 9 12:15:26 2013 +0100

    driver core: add helper macro for platform_driver_probe() boilerplate

    For simple modules that contain a single platform_driver without any
    additional setup code then ends up being a block of duplicated
    boilerplate.  This patch adds a new macro,
    module_platform_driver_probe(), which replaces the
    module_init()/module_exit() registrations with template functions.

    This macro use the same idea of module_platform_driver().

    This macro is useful to stop the misuse of module_platform_driver() for
    removing the platform_driver_probe() boilerplate.

    Signed-off-by: Fabio Porcedda <fabio.porcedda@gmail.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains bab734fc
v3.9-rc1~128^2~123

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/include/linux/compat-3.9.h |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/backport/include/linux/compat-3.9.h b/backport/include/linux/compat-3.9.h
index a4362e2..2a1f2da 100644
--- a/backport/include/linux/compat-3.9.h
+++ b/backport/include/linux/compat-3.9.h
@@ -16,6 +16,26 @@
 #include <linux/printk.h>
 #include <linux/scatterlist.h>
 #include <linux/device.h>
+#include <linux/platform_device.h>
+
+/* module_platform_driver_probe() - Helper macro for drivers that don't do
+ * anything special in module init/exit.  This eliminates a lot of
+ * boilerplate.  Each module may only use this macro once, and
+ * calling it replaces module_init() and module_exit()
+ */
+#define module_platform_driver_probe(__platform_driver, __platform_probe) \
+static int __init __platform_driver##_init(void) \
+{ \
+	return platform_driver_probe(&(__platform_driver), \
+				     __platform_probe);    \
+} \
+module_init(__platform_driver##_init); \
+static void __exit __platform_driver##_exit(void) \
+{ \
+	platform_driver_unregister(&(__platform_driver)); \
+} \
+module_exit(__platform_driver##_exit);
+
 
 /* include this before changing hlist_for_each_* to use the old versions. */
 #include <net/sch_generic.h>
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 11/18] compat: add helpers to aid backport of generic DMA changes for v4l
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (9 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 10/18] compat: backport module_platform_driver_probe() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 12/18] compat: backport dma_get_sgtable() Luis R. Rodriguez
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Commit c60520fa needs to be reverted for older kernels because
although we can backport some large changes to DMA that
ended up extending some core dma data structures, for
details see bca0fa5f as an example. To *aid* with the driver
changes required add a helper that lets us call what we used
to do, thus requiring a smaller delta on the upstream code.

We're only adding this for >= 3.2 as this is required only
for media which are also only supporting on >= 3.2.

commit c60520fa50cd86d64bc8ebb34300ddc4ca91393d
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Thu Jun 14 11:32:21 2012 -0300

    [media] v4l: vb2-dma-contig: let mmap method to use dma_mmap_coherent call

    Let mmap method to use dma_mmap_coherent call.  Moreover, this patch removes
    vb2_mmap_pfn_range from videobuf2 helpers as it was suggested by Laurent
    Pinchart.  The function is no longer used in vb2 code.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
    Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
    Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/compat/compat-3.9.c        |   43 +++++++++++++++++++++++++++++++++++
 backport/include/linux/compat-3.9.h |    7 ++++++
 2 files changed, 50 insertions(+)

diff --git a/backport/compat/compat-3.9.c b/backport/compat/compat-3.9.c
index 61a062a..56c40d3 100644
--- a/backport/compat/compat-3.9.c
+++ b/backport/compat/compat-3.9.c
@@ -12,6 +12,49 @@
 #include <linux/scatterlist.h>
 #include <linux/device.h>
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+/**
+ * vb2_mmap_pfn_range() - map physical pages to userspace
+ * @vma:	virtual memory region for the mapping
+ * @paddr:	starting physical address of the memory to be mapped
+ * @size:	size of the memory to be mapped
+ * @vm_ops:	vm operations to be assigned to the created area
+ * @priv:	private data to be associated with the area
+ *
+ * Returns 0 on success.
+ */
+int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
+				unsigned long size,
+				const struct vm_operations_struct *vm_ops,
+				void *priv)
+{
+	int ret;
+
+	size = min_t(unsigned long, vma->vm_end - vma->vm_start, size);
+
+	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+	ret = remap_pfn_range(vma, vma->vm_start, paddr >> PAGE_SHIFT,
+				size, vma->vm_page_prot);
+	if (ret) {
+		printk(KERN_ERR "Remapping memory failed, error: %d\n", ret);
+		return ret;
+	}
+
+	vma->vm_flags		|= VM_DONTEXPAND | VM_DONTDUMP;
+	vma->vm_private_data	= priv;
+	vma->vm_ops		= vm_ops;
+
+	vma->vm_ops->open(vma);
+
+	pr_debug("%s: mapped paddr 0x%08lx at 0x%08lx, size %ld\n",
+			__func__, paddr, vma->vm_start, size);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(vb2_mmap_pfn_range);
+#endif
+
+
 #ifdef __sg_page_iter_next
 
 void __sg_page_iter_start(struct sg_page_iter *piter,
diff --git a/backport/include/linux/compat-3.9.h b/backport/include/linux/compat-3.9.h
index 2a1f2da..a939e0b 100644
--- a/backport/include/linux/compat-3.9.h
+++ b/backport/include/linux/compat-3.9.h
@@ -18,6 +18,13 @@
 #include <linux/device.h>
 #include <linux/platform_device.h>
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+int vb2_mmap_pfn_range(struct vm_area_struct *vma, unsigned long paddr,
+				unsigned long size,
+				const struct vm_operations_struct *vm_ops,
+				void *priv);
+#endif
+
 /* module_platform_driver_probe() - Helper macro for drivers that don't do
  * anything special in module init/exit.  This eliminates a lot of
  * boilerplate.  Each module may only use this macro once, and
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 12/18] compat: backport dma_get_sgtable()
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (10 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 11/18] compat: add helpers to aid backport of generic DMA changes for v4l Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:26   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 13/18] backports: add blacklist module support Luis R. Rodriguez
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

No architectures yet have their own dma_map_sg ops so we just
use the commonly developed one for all archs in this
implementation. We enable this only for 3.2 given that
this is only needed for dma-buf ops implementations and
we only port that down to 3.2 so far as well.

mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains d2b7428e
v3.6-rc1~57^2~3

commit d2b7428eb0caa7c66e34b6ac869a43915b294123
Author: Marek Szyprowski <m.szyprowski@samsung.com>
Date:   Wed Jun 13 10:05:52 2012 +0200

    common: dma-mapping: introduce dma_get_sgtable() function

    This patch adds dma_get_sgtable() function which is required to let
    drivers to share the buffers allocated by DMA-mapping subsystem. Right
    now the driver gets a dma address of the allocated buffer and the kernel
    virtual mapping for it. If it wants to share it with other device (= map
    into its dma address space) it usually hacks around kernel virtual
    addresses to get pointers to pages or assumes that both devices share
    the DMA address space. Both solutions are just hacks for the special
    cases, which should be avoided in the final version of buffer sharing.

    To solve this issue in a generic way, a new call to DMA mapping has been
    introduced - dma_get_sgtable(). It allocates a scatter-list which
    describes the allocated buffer and lets the driver(s) to use it with
    other device(s) by calling dma_map_sg() on it.

    This patch provides a generic implementation based on virt_to_page()
    call. Architectures which require more sophisticated translation might
    provide their own get_sgtable() methods.

    Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
    Reviewed-by: Kyungmin Park <kyungmin.park@samsung.com>
    Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

ckmake (only for compat)

1   2.6.24              [  OK  ]
2   2.6.25              [  OK  ]
3   2.6.26              [  OK  ]
4   2.6.27              [  OK  ]
5   2.6.28              [  OK  ]
6   2.6.29              [  OK  ]
7   2.6.30              [  OK  ]
8   2.6.31              [  OK  ]
9   2.6.32              [  OK  ]
10  2.6.33              [  OK  ]
11  2.6.34              [  OK  ]
12  2.6.35              [  OK  ]
13  2.6.36              [  OK  ]
14  2.6.37              [  OK  ]
15  2.6.38              [  OK  ]
16  2.6.39              [  OK  ]
17  3.0.65              [  OK  ]
18  3.1.10              [  OK  ]
19  3.2.38              [  OK  ]
20  3.3.8               [  OK  ]
21  3.4.32              [  OK  ]
22  3.5.7               [  OK  ]
23  3.6.11              [  OK  ]
24  3.7.9               [  OK  ]
25  3.8.0               [  OK  ]
26  3.9-rc1             [  OK  ]

real    2m39.638s
user    24m55.205s
sys     12m59.349s

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/compat/compat-3.6.c        |   18 ++++++++++++++++++
 backport/include/linux/compat-3.6.h |   16 ++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/backport/compat/compat-3.6.c b/backport/compat/compat-3.6.c
index 05954d4..5355cd2 100644
--- a/backport/compat/compat-3.6.c
+++ b/backport/compat/compat-3.6.c
@@ -16,6 +16,24 @@
 #include <linux/i2c.h>
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,2,0))
+/*
+ * Create scatter-list for the already allocated DMA buffer.
+ */
+int dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
+		 void *cpu_addr, dma_addr_t handle, size_t size)
+{
+	struct page *page = virt_to_page(cpu_addr);
+	int ret;
+
+	ret = sg_alloc_table(sgt, 1, GFP_KERNEL);
+	if (unlikely(ret))
+		return ret;
+
+	sg_set_page(sgt->sgl, page, PAGE_ALIGN(size), 0);
+	return 0;
+}
+EXPORT_SYMBOL_GPL(dma_common_get_sgtable);
+
 /**
  * __i2c_transfer - unlocked flavor of i2c_transfer
  * @adap: Handle to I2C bus
diff --git a/backport/include/linux/compat-3.6.h b/backport/include/linux/compat-3.6.h
index 49f4d3b..24954d6 100644
--- a/backport/include/linux/compat-3.6.h
+++ b/backport/include/linux/compat-3.6.h
@@ -29,6 +29,22 @@ int sg_alloc_table_from_pages(struct sg_table *sgt,
 			      unsigned long offset, unsigned long size,
 			      gfp_t gfp_mask);
 
+#define dma_common_get_sgtable LINUX_BACKPORT(dma_common_get_sgtable)
+int
+dma_common_get_sgtable(struct device *dev, struct sg_table *sgt,
+		       void *cpu_addr, dma_addr_t dma_addr, size_t size);
+
+#define dma_get_sgtable_attrs LINUX_BACKPORT(dma_get_sgtable_attrs)
+static inline int
+dma_get_sgtable_attrs(struct device *dev, struct sg_table *sgt, void *cpu_addr,
+		      dma_addr_t dma_addr, size_t size, struct dma_attrs *attrs)
+{
+	return dma_common_get_sgtable(dev, sgt, cpu_addr, dma_addr, size);
+}
+
+#define dma_get_sgtable(d, t, v, h, s) dma_get_sgtable_attrs(d, t, v, h, s, NULL)
+
+
 /**
  * Backports
  *
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 13/18] backports: add blacklist module support
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (11 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 12/18] compat: backport dma_get_sgtable() Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:35   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 14/18] backports: add support for module compression Luis R. Rodriguez
                   ` (4 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

This lets us provide a simple map of new drivers and old
drivers that it replaces at install time. This generates
a blacklist via the file:

/etc/modprobe.d/backports.conf

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/.blacklist.map       |   10 ++++++++++
 backport/Makefile.real        |    3 +--
 backport/scripts/blacklist.sh |   35 +++++++++++++++++++++++++++++++++++
 gentree.py                    |    1 +
 4 files changed, 47 insertions(+), 2 deletions(-)
 create mode 100644 backport/.blacklist.map
 create mode 100755 backport/scripts/blacklist.sh

diff --git a/backport/.blacklist.map b/backport/.blacklist.map
new file mode 100644
index 0000000..a96d03e
--- /dev/null
+++ b/backport/.blacklist.map
@@ -0,0 +1,10 @@
+# Update this map when a driver gets renamed or
+# symbols from old drivers get moved to a newer
+# driver. If you have the driver on the right
+# hand side it will be blacklisted upon installation
+# only if you actually installed the driver on the
+# left.
+
+# new-driver	old-driver
+iwlagn		iwlwifi
+iwlagn		iwl4965
diff --git a/backport/Makefile.real b/backport/Makefile.real
index 40668c2..032a8d7 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -87,6 +87,7 @@ install: modules
 	@$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD)			\
 		INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG)		\
 		modules_install
+	@./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR)
 	@/sbin/depmod -ae
 	@echo
 	@echo Your backported driver modules should be installed now.
@@ -95,7 +96,5 @@ install: modules
 # FIXME:
 #	compress modules
 #	check depmod
-#	iwlwifi vs. iwlagn
-#	iwl4965 vs. iwlagn
 #	install/load/unload/... scripts?
 #	compat firmware class udev stuff
diff --git a/backport/scripts/blacklist.sh b/backport/scripts/blacklist.sh
new file mode 100755
index 0000000..921585f
--- /dev/null
+++ b/backport/scripts/blacklist.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+BLACKLIST_CONF="/etc/modprobe.d/backports.conf"
+BLACKLIST_MAP=".blacklist.map"
+
+MODULE_DIR=$1
+MODULE_UPDATES=$2
+
+if [[ ! -d $MODULE_DIR ]]; then
+	exit
+fi
+
+if [[ ! -d $MODULE_UPDATES ]]; then
+	exit
+fi
+
+mkdir -p $(dirname $BLACKLIST_CONF)
+rm -f $BLACKLIST_CONF
+
+echo "# To be used when using backported drivers" >> $BLACKLIST_CONF
+
+for i in $(grep -v ^# $BLACKLIST_MAP | cut -f 2); do
+	MODULE="${i}.ko"
+	MODULE_UPDATE="$(grep -v ^# $BLACKLIST_MAP | grep $i | cut -f 1 | head -1).ko"
+
+	COUNT=$(find $MODULE_DIR -type f -name ${MODULE} -or -name ${MODULE}.gz | wc -l)
+	COUNT_REPLACE=$(find $MODULE_UPDATES -type f -name ${MODULE_UPDATE} -or -name ${MODULE_UPDATE}.gz | wc -l)
+
+	if [ $COUNT -ne 0 ]; then
+		if [ $COUNT_REPLACE -ne 0 ]; then
+			echo "Blacklisting $MODULE ..."
+			echo blacklist $i >> $BLACKLIST_CONF
+		fi
+	fi
+done
diff --git a/gentree.py b/gentree.py
index adef899..3f875c7 100755
--- a/gentree.py
+++ b/gentree.py
@@ -324,6 +324,7 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
     backport_files = [(x, x) for x in [
         'Kconfig', 'Makefile', 'Makefile.build', 'Makefile.kernel', '.gitignore',
         'Makefile.real', 'compat/', 'include/', 'kconfig/', 'defconfigs/',
+	'scripts/', '.blacklist.map',
     ]]
     if not args.git_revision:
         logwrite('Copy original source files ...')
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 14/18] backports: add support for module compression
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (12 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 13/18] backports: add blacklist module support Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:40   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 15/18] backports: add check_depmod to look for module search path Luis R. Rodriguez
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Some Linux distributions like to compress their modules.
Add support to detect this in a modutils / modprobe agnostic
way.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/Makefile.real               |    6 +++++-
 backport/scripts/are_mods_compressed |    8 ++++++++
 backport/scripts/mod_path            |    8 ++++++++
 3 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100755 backport/scripts/are_mods_compressed
 create mode 100755 backport/scripts/mod_path

diff --git a/backport/Makefile.real b/backport/Makefile.real
index 032a8d7..250676d 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -88,13 +88,17 @@ install: modules
 		INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG)		\
 		modules_install
 	@./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR)
+	@./scripts/are_mods_compressed || (				\
+        for driver in $$(find $(KLIB)/$(KMODDIR) 			\
+			-type f -name *.ko); do        			\
+			gzip -9 $$driver				;\
+	done )
 	@/sbin/depmod -ae
 	@echo
 	@echo Your backported driver modules should be installed now.
 	@echo Try loading them with modprobe.
 	@echo
 # FIXME:
-#	compress modules
 #	check depmod
 #	install/load/unload/... scripts?
 #	compat firmware class udev stuff
diff --git a/backport/scripts/are_mods_compressed b/backport/scripts/are_mods_compressed
new file mode 100755
index 0000000..989da2f
--- /dev/null
+++ b/backport/scripts/are_mods_compressed
@@ -0,0 +1,8 @@
+#!/bin/bash
+MODULE=$(./scripts/mod_path mac80211)
+MODULE=${MODULE##*/}
+if [ "$MODULE" = "mac80211.ko.gz" ]; then
+	COMPRESSION_FOUND="y"
+	exit 1
+fi
+exit 0
diff --git a/backport/scripts/mod_path b/backport/scripts/mod_path
new file mode 100755
index 0000000..f37321f
--- /dev/null
+++ b/backport/scripts/mod_path
@@ -0,0 +1,8 @@
+#!/bin/bash
+which modinfo > /dev/null 2>&1
+if [[ $? -eq 0 ]]; then
+	MOD_QUERY="modinfo -F filename"
+else
+	MOD_QUERY="modprobe -l"
+fi
+$MOD_QUERY $1 | tail -1
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 15/18] backports: add check_depmod to look for module search path
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (13 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 14/18] backports: add support for module compression Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:43   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 16/18] backports: add udev rules if required for backported firmware_class Luis R. Rodriguez
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

This backports project relies on you being able to update
your Linux distribution modules by looking at an updates
search path, if one is not found we update depmod to look
for the new path for you.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/Makefile.real        |    2 +-
 backport/scripts/check_depmod |   78 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 1 deletion(-)
 create mode 100755 backport/scripts/check_depmod

diff --git a/backport/Makefile.real b/backport/Makefile.real
index 250676d..f70932e 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -93,12 +93,12 @@ install: modules
 			-type f -name *.ko); do        			\
 			gzip -9 $$driver				;\
 	done )
+	@./scripts/check_depmod
 	@/sbin/depmod -ae
 	@echo
 	@echo Your backported driver modules should be installed now.
 	@echo Try loading them with modprobe.
 	@echo
 # FIXME:
-#	check depmod
 #	install/load/unload/... scripts?
 #	compat firmware class udev stuff
diff --git a/backport/scripts/check_depmod b/backport/scripts/check_depmod
new file mode 100755
index 0000000..6123894
--- /dev/null
+++ b/backport/scripts/check_depmod
@@ -0,0 +1,78 @@
+#!/bin/bash
+# Copyright 2009-2013	Luis R. Rodriguez <mcgrof@do-not-panic.com>
+#
+# Ensures your distribution likes to prefer updates/ over the kernel/
+# search updates built-in
+
+# Seems Mandriva has an $DEPMOD_DIR but it doesn't have any files,
+# so lets deal with those distributions.
+DEPMOD_CONF="/etc/depmod.conf"
+DEPMOD_CONF_TMP="$DEPMOD_CONF.backports.old"
+DEPMOD_DIR="/etc/depmod.d/"
+BACKPORT_DEPMOD_FILE="backports.conf"
+GREP_REGEX_UPDATES="^[[:space:]]*search.*[[:space:]]updates\([[:space:]]\|$\)"
+GREP_REGEX_SEARCH="^[[:space:]]*search[[:space:]].\+$"
+DEPMOD_CMD="depmod"
+
+function add_compat_depmod_conf {
+	echo "NOTE: Your distribution lacks an $DEPMOD_DIR directory with "
+	echo "updates/ directory being prioritized for modules, we're adding "
+	echo "one for you."
+	mkdir -p $DEPMOD_DIR
+	FIRST_FILE=$(ls $DEPMOD_DIR|head -1)
+	[ -n "$FIRST_FILE" ] && while [[ $FIRST_FILE < $BACKPORT_DEPMOD_FILE ]]; do
+		BACKPORT_DEPMOD_FILE="0$BACKPORT_DEPMOD_FILE"
+	done
+	echo "search updates" > $DEPMOD_DIR/$BACKPORT_DEPMOD_FILE
+}
+
+function add_global_depmod_conf {
+	echo "NOTE: Your distribution lacks updates/ directory being"
+	echo "prioritized for modules, we're adding it to $DEPMOD_CONF."
+	rm -f $DEPMOD_CONF_TMP
+	[ -f $DEPMOD_CONF ] && cp -f $DEPMOD_CONF $DEPMOD_CONF_TMP
+	echo "search updates" > $DEPMOD_CONF
+	[ -f $DEPMOD_CONF_TMP ] && cat $DEPMOD_CONF_TMP >> $DEPMOD_CONF
+}
+
+function depmod_updates_ok {
+	echo "depmod will prefer updates/ over kernel/ -- OK!"
+}
+
+function add_depmod_conf {
+	if [ -f "$DEPMOD_CONF" ]; then
+		add_global_depmod_conf
+	else
+		DEPMOD_VERSION=$($DEPMOD_CMD --version | cut -d" " -f2 | sed "s/\.//")
+		if [[ $DEPMOD_VERSION -gt 36 ]]; then
+			add_compat_depmod_conf
+		else
+			add_global_depmod_conf
+		fi
+	fi
+}
+
+GREP_FILES=""
+[ -f $DEPMOD_CONF ] && GREP_FILES="$DEPMOD_CONF"
+if [ -d $DEPMOD_DIR ]; then
+	DEPMOD_FILE_COUNT=$(ls $DEPMOD_DIR | wc -l)
+	[[ $DEPMOD_FILE_COUNT -gt 0 ]] && GREP_FILES="$GREP_FILES $DEPMOD_DIR/*"
+fi
+
+if [ -n "$GREP_FILES" ]; then
+	grep -q "$GREP_REGEX_SEARCH" $GREP_FILES
+	if [[ $? -eq 0 ]]; then
+		grep -q "$GREP_REGEX_UPDATES" $GREP_FILES
+		if [[ $? -eq 0 ]]; then
+			depmod_updates_ok
+		else
+			add_depmod_conf
+		fi
+	else
+		depmod_updates_ok
+	fi
+else
+	depmod_updates_ok
+fi
+
+exit 0
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 16/18] backports: add udev rules if required for backported firmware_class
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (14 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 15/18] backports: add check_depmod to look for module search path Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:45   ` Johannes Berg
  2013-04-10 13:47   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 17/18] backports: use depmod -a Luis R. Rodriguez
  2013-04-10 11:35 ` [PATCH 18/18] backports: add update-initramfs support Luis R. Rodriguez
  17 siblings, 2 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/Makefile.real                     |    2 +-
 backport/scripts/backport_firmware_install |   21 +++++++++++++++++
 backport/udev/50-compat_firmware.rules     |    4 ++++
 backport/udev/compat_firmware.sh           |   35 ++++++++++++++++++++++++++++
 backport/udev/ubuntu/compat_firmware.sh    |   29 +++++++++++++++++++++++
 gentree.py                                 |    2 +-
 6 files changed, 91 insertions(+), 2 deletions(-)
 create mode 100755 backport/scripts/backport_firmware_install
 create mode 100644 backport/udev/50-compat_firmware.rules
 create mode 100755 backport/udev/compat_firmware.sh
 create mode 100755 backport/udev/ubuntu/compat_firmware.sh

diff --git a/backport/Makefile.real b/backport/Makefile.real
index f70932e..3eb92a7 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -94,6 +94,7 @@ install: modules
 			gzip -9 $$driver				;\
 	done )
 	@./scripts/check_depmod
+	@./scripts/backport_firmware_install
 	@/sbin/depmod -ae
 	@echo
 	@echo Your backported driver modules should be installed now.
@@ -101,4 +102,3 @@ install: modules
 	@echo
 # FIXME:
 #	install/load/unload/... scripts?
-#	compat firmware class udev stuff
diff --git a/backport/scripts/backport_firmware_install b/backport/scripts/backport_firmware_install
new file mode 100755
index 0000000..e4b9fb0
--- /dev/null
+++ b/backport/scripts/backport_firmware_install
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+if [ -f /usr/bin/lsb_release ]; then
+	LSB_RED_ID=$(/usr/bin/lsb_release -i -s)
+else
+	LSB_RED_ID="Unknown"
+fi
+
+case $LSB_RED_ID in
+"Ubuntu")
+	mkdir -p /lib/udev/ /lib/udev/rules.d/
+	cp udev/ubuntu/compat_firmware.sh /lib/udev/
+	cp udev/50-compat_firmware.rules /lib/udev/rules.d/
+        ;;
+*)
+	mkdir -p /lib/udev/ /lib/udev/rules.d/
+	cp udev/compat_firmware.sh /lib/udev/
+	cp udev/50-compat_firmware.rules /lib/udev/rules.d/
+        ;;
+esac
+
diff --git a/backport/udev/50-compat_firmware.rules b/backport/udev/50-compat_firmware.rules
new file mode 100644
index 0000000..6473788
--- /dev/null
+++ b/backport/udev/50-compat_firmware.rules
@@ -0,0 +1,4 @@
+# do not edit this file, it will be overwritten on update
+
+# compat_firmware-class requests, copies files into the kernel
+SUBSYSTEM=="compat_firmware", ACTION=="add", RUN+="compat_firmware.sh"
diff --git a/backport/udev/compat_firmware.sh b/backport/udev/compat_firmware.sh
new file mode 100755
index 0000000..ef609e7
--- /dev/null
+++ b/backport/udev/compat_firmware.sh
@@ -0,0 +1,35 @@
+#!/bin/sh -e
+
+# This is ported from Ubuntu but ubuntu uses these directories which
+# other distributions don't care about:
+# FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \
+#               /lib/firmware/$(uname -r) /lib/firmware"
+# If your distribution looks for firmware in other directories
+# feel free to extend this and add your own directory here.
+#
+FIRMWARE_DIRS="/lib/firmware"
+
+err() {
+	echo "$@" >&2
+	logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true
+}
+
+if [ ! -e /sys$DEVPATH/loading ]; then
+	err "udev firmware loader misses sysfs directory"
+	exit 1
+fi
+
+for DIR in $FIRMWARE_DIRS; do
+	[ -e "$DIR/$FIRMWARE" ] || continue
+	echo 1 > /sys$DEVPATH/loading
+	cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
+	echo 0 > /sys$DEVPATH/loading
+	exit 0
+done
+
+echo -1 > /sys$DEVPATH/loading
+err "Cannot find  firmware file '$FIRMWARE'"
+mkdir -p /dev/.udev/firmware-missing
+file=$(echo "$FIRMWARE" | sed 's:/:\\x2f:g')
+ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file
+exit 1
diff --git a/backport/udev/ubuntu/compat_firmware.sh b/backport/udev/ubuntu/compat_firmware.sh
new file mode 100755
index 0000000..9d4659a
--- /dev/null
+++ b/backport/udev/ubuntu/compat_firmware.sh
@@ -0,0 +1,29 @@
+#!/bin/sh -e
+
+FIRMWARE_DIRS="/lib/firmware/updates/$(uname -r) /lib/firmware/updates \
+               /lib/firmware/$(uname -r) /lib/firmware"
+
+err() {
+	echo "$@" >&2
+	logger -t "${0##*/}[$$]" "$@" 2>/dev/null || true
+}
+
+if [ ! -e /sys$DEVPATH/loading ]; then
+	err "udev firmware loader misses sysfs directory"
+	exit 1
+fi
+
+for DIR in $FIRMWARE_DIRS; do
+	[ -e "$DIR/$FIRMWARE" ] || continue
+	echo 1 > /sys$DEVPATH/loading
+	cat "$DIR/$FIRMWARE" > /sys$DEVPATH/data
+	echo 0 > /sys$DEVPATH/loading
+	exit 0
+done
+
+echo -1 > /sys$DEVPATH/loading
+err "Cannot find  firmware file '$FIRMWARE'"
+mkdir -p /dev/.udev/firmware-missing
+file=$(echo "$FIRMWARE" | sed 's:/:\\x2f:g')
+ln -s -f "$DEVPATH" /dev/.udev/firmware-missing/$file
+exit 1
diff --git a/gentree.py b/gentree.py
index 3f875c7..dc54e4b 100755
--- a/gentree.py
+++ b/gentree.py
@@ -324,7 +324,7 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None,
     backport_files = [(x, x) for x in [
         'Kconfig', 'Makefile', 'Makefile.build', 'Makefile.kernel', '.gitignore',
         'Makefile.real', 'compat/', 'include/', 'kconfig/', 'defconfigs/',
-	'scripts/', '.blacklist.map',
+	'scripts/', '.blacklist.map', 'udev/',
     ]]
     if not args.git_revision:
         logwrite('Copy original source files ...')
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 17/18] backports: use depmod -a
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (15 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 16/18] backports: add udev rules if required for backported firmware_class Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:46   ` Johannes Berg
  2013-04-10 11:35 ` [PATCH 18/18] backports: add update-initramfs support Luis R. Rodriguez
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

Use only depmod -a and at the same time tell the
user to reboot, we no longer support unloading /
loading for them given that we backport too many
modules.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/Makefile.real |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/backport/Makefile.real b/backport/Makefile.real
index 3eb92a7..f2b5b56 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -95,10 +95,8 @@ install: modules
 	done )
 	@./scripts/check_depmod
 	@./scripts/backport_firmware_install
-	@/sbin/depmod -ae
+	@/sbin/depmod -a
 	@echo
 	@echo Your backported driver modules should be installed now.
-	@echo Try loading them with modprobe.
+	@echo Reboot.
 	@echo
-# FIXME:
-#	install/load/unload/... scripts?
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* [PATCH 18/18] backports: add update-initramfs support
  2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
                   ` (16 preceding siblings ...)
  2013-04-10 11:35 ` [PATCH 17/18] backports: use depmod -a Luis R. Rodriguez
@ 2013-04-10 11:35 ` Luis R. Rodriguez
  2013-04-10 13:48   ` Johannes Berg
  17 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 11:35 UTC (permalink / raw)
  To: johannes; +Cc: backports, Luis R. Rodriguez

From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>

You'll need to update your initramfs for for a few modules.
This is very distribution specific.

Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com>
---
 backport/Makefile.real            |    1 +
 backport/scripts/update-initramfs |   62 +++++++++++++++++++++++++++++++++++++
 2 files changed, 63 insertions(+)
 create mode 100755 backport/scripts/update-initramfs

diff --git a/backport/Makefile.real b/backport/Makefile.real
index f2b5b56..c788f89 100644
--- a/backport/Makefile.real
+++ b/backport/Makefile.real
@@ -96,6 +96,7 @@ install: modules
 	@./scripts/check_depmod
 	@./scripts/backport_firmware_install
 	@/sbin/depmod -a
+	@./scripts/update-initramfs $(KLIB)
 	@echo
 	@echo Your backported driver modules should be installed now.
 	@echo Reboot.
diff --git a/backport/scripts/update-initramfs b/backport/scripts/update-initramfs
new file mode 100755
index 0000000..9396cb3
--- /dev/null
+++ b/backport/scripts/update-initramfs
@@ -0,0 +1,62 @@
+#!/bin/bash
+# Copyright 2009-2013        Luis R. Rodriguez <mcgrof@do-not-panic.com>
+#
+# Since we provide ssb, ethernet modules and most importantly
+# DRM drivers, people may want to update the initramfs image
+# of their distribution. This can also help people who may
+# want to wireless-boot their systems.
+
+KLIB=1
+ver=$(echo $KLIB | awk -F "/lib/modules/" '{print $2}' | awk -F"/" '{print $1}')
+dir=/boot/
+
+LSB_RED_ID=$(/usr/bin/lsb_release -i -s &> /dev/null)
+
+if [[ -z $LSB_RED_ID && -f "/etc/os-release" ]]; then
+	# Let's try with os-release. Fedora doesn't have
+	# lsb_release anymore.
+	LSB_RED_ID=$(sed -n '/^NAME/ s/^NAME=\(.*\)$/\1/p' /etc/os-release)
+fi
+
+case $LSB_RED_ID in
+"Ubuntu")
+	echo "Updating ${LSB_RED_ID}'s initramfs for $ver under $dir ..."
+	mkinitramfs -o $dir/initrd.img-$ver $ver
+	echo "Will now run update-grub to ensure grub will find the new initramfs ..."
+	update-grub
+	;;
+"Debian")
+	echo "Updating ${LSB_RED_ID}'s initramfs for $ver under $dir ..."
+	mkinitramfs -o $dir/initrd.img-$ver $ver
+	echo "Will now run update-grub to ensure grub will find the new initramfs ..."
+	update-grub
+	;;
+"Fedora")
+	# This adds a -compat-drivers suffixed initramfs with a new grub2
+	# entry to not override distribution's default stuff.
+	INITRAMFS=${dir}initramfs-$ver-compat-drivers.img
+	KERNEL=${dir}vmlinuz-$ver
+	GRUB_TITLE="Fedora ($ver) with compat-drivers"
+
+	echo "Updating ${LSB_RED_ID}'s initramfs for $ver under $dir ..."
+	mkinitrd --force $INITRAMFS $ver
+
+	# If a previous compat-drivers entry for the same kernel exists
+	# do not add it again.
+	grep -q "${GRUB_TITLE}" /etc/grub2.cfg &> /dev/null
+	if [[ "$?" == "1" ]]; then
+		echo "Will now run grubby to add a new kernel entry ..."
+		# Add a new kernel entry
+		grubby --grub2 --copy-default --add-kernel="$KERNEL" --initrd="$INITRAMFS" --title="$GRUB_TITLE"
+	fi
+	;;
+*)
+	echo "Warning:"
+	echo "You may or may not need to update your initramfs, you should if"
+	echo "any of the modules installed are part of your initramfs. To add"
+	echo "support for your distribution to do this automatically send a"
+	echo "patch against $0. If your distribution does not require this"
+	echo "send a patch against the '/usr/bin/lsb_release -i -s': $LSB_RED_ID"
+	echo "tag for your distribution to avoid this warning."
+        ;;
+esac
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 51+ messages in thread

* Re: [PATCH 01/18] backports: enable DRM_NOUVEAU for 3.2
  2013-04-10 11:35 ` [PATCH 01/18] backports: enable DRM_NOUVEAU for 3.2 Luis R. Rodriguez
@ 2013-04-10 13:15   ` Johannes Berg
  0 siblings, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:15 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

Applied.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 02/18] compat: backport dev_level_ratelimited()
  2013-04-10 11:35 ` [PATCH 02/18] compat: backport dev_level_ratelimited() Luis R. Rodriguez
@ 2013-04-10 13:16   ` Johannes Berg
  2013-04-10 17:07     ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:16 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:

Applied.

> +++ b/backport/include/linux/compat-3.5.h
> @@ -10,6 +10,42 @@
>  
>  #include <net/netlink.h>
>  
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
> +#include <linux/ratelimit.h>

I think, however, that it would be easier to understand if we started
putting less stuff into compat-xyz.h and more into linux/feature.h?
Needs more discussion though I guess.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 05/18] compat: backport GPIOF_OPEN_DRAIN definition
  2013-04-10 11:35 ` [PATCH 05/18] compat: backport GPIOF_OPEN_DRAIN definition Luis R. Rodriguez
@ 2013-04-10 13:18   ` Johannes Berg
  2013-04-10 17:10     ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:18 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
> 
> This functionality will just be ignored, later we'll
> just port the full gpiolib.

That seems a bit dangerous? If the driver expects to be able to set the
pin this way, do we really want to stop it?

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 04/18] compat: backport devm_regmap_init()
  2013-04-10 11:35 ` [PATCH 04/18] compat: backport devm_regmap_init() Luis R. Rodriguez
@ 2013-04-10 13:19   ` Johannes Berg
  0 siblings, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:19 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
[...]

Applied.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 03/18] compat: backport __i2c_transfer()
  2013-04-10 11:35 ` [PATCH 03/18] compat: backport __i2c_transfer() Luis R. Rodriguez
@ 2013-04-10 13:20   ` Johannes Berg
  0 siblings, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:20 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

Applied.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 11:35 ` [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE() Luis R. Rodriguez
@ 2013-04-10 13:22   ` Johannes Berg
  2013-04-10 17:13     ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:22 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
> 
> For older kernels this is simply a matter of using
> LIST_HEAD.

Hmm, how is that useful if it will not have any effect?

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 12/18] compat: backport dma_get_sgtable()
  2013-04-10 11:35 ` [PATCH 12/18] compat: backport dma_get_sgtable() Luis R. Rodriguez
@ 2013-04-10 13:26   ` Johannes Berg
  0 siblings, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:26 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

Applied 7-12.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 13/18] backports: add blacklist module support
  2013-04-10 11:35 ` [PATCH 13/18] backports: add blacklist module support Luis R. Rodriguez
@ 2013-04-10 13:35   ` Johannes Berg
  2013-04-10 19:57     ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:35 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:

> --- /dev/null
> +++ b/backport/.blacklist.map
> @@ -0,0 +1,10 @@
> +# Update this map when a driver gets renamed or
> +# symbols from old drivers get moved to a newer
> +# driver. If you have the driver on the right
> +# hand side it will be blacklisted upon installation
> +# only if you actually installed the driver on the
> +# left.
> +
> +# new-driver	old-driver
> +iwlagn		iwlwifi
> +iwlagn		iwl4965

Seems that's really

# old-driver	new-driver

no?

> +rm -f $BLACKLIST_CONF
> +
> +echo "# To be used when using backported drivers" >> $BLACKLIST_CONF

Or you could just use > instead of >> on this first line ;-)

> +for i in $(grep -v ^# $BLACKLIST_MAP | cut -f 2); do

What happens if the blacklist map contains empty lines? Might want to
allow that.

> +	MODULE="${i}.ko"
> +	MODULE_UPDATE="$(grep -v ^# $BLACKLIST_MAP | grep $i | cut -f 1 | head -1).ko"
> +
> +	COUNT=$(find $MODULE_DIR -type f -name ${MODULE} -or -name ${MODULE}.gz | wc -l)
> +	COUNT_REPLACE=$(find $MODULE_UPDATES -type f -name ${MODULE_UPDATE} -or -name ${MODULE_UPDATE}.gz | wc -l)
> +
> +	if [ $COUNT -ne 0 ]; then
> +		if [ $COUNT_REPLACE -ne 0 ]; then
> +			echo "Blacklisting $MODULE ..."
> +			echo blacklist $i >> $BLACKLIST_CONF
> +		fi

So you do mean "# new-driver old-driver", but then shouldn't the iwlwifi
lines be reversed?

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 14/18] backports: add support for module compression
  2013-04-10 11:35 ` [PATCH 14/18] backports: add support for module compression Luis R. Rodriguez
@ 2013-04-10 13:40   ` Johannes Berg
  0 siblings, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:40 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:

> +++ b/backport/scripts/are_mods_compressed
> @@ -0,0 +1,8 @@
> +#!/bin/bash
> +MODULE=$(./scripts/mod_path mac80211)
> +MODULE=${MODULE##*/}
> +if [ "$MODULE" = "mac80211.ko.gz" ]; then
> +	COMPRESSION_FOUND="y"

That variable seems useless?

Also is there much value in splitting this across two scripts? Seems a
bit small to do that?

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 15/18] backports: add check_depmod to look for module search path
  2013-04-10 11:35 ` [PATCH 15/18] backports: add check_depmod to look for module search path Luis R. Rodriguez
@ 2013-04-10 13:43   ` Johannes Berg
  0 siblings, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:43 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
> 
> This backports project relies on you being able to update
> your Linux distribution modules by looking at an updates
> search path, if one is not found we update depmod to look
> for the new path for you.

Looks good, but I guess it's not going to apply by itself without the
previosu patches.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 16/18] backports: add udev rules if required for backported firmware_class
  2013-04-10 11:35 ` [PATCH 16/18] backports: add udev rules if required for backported firmware_class Luis R. Rodriguez
@ 2013-04-10 13:45   ` Johannes Berg
  2013-04-10 13:47   ` Johannes Berg
  1 sibling, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:45 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:

> +err "Cannot find  firmware file '$FIRMWARE'"

nitpick: need only one space :)

Other than that this looks like voodoo to me, so I guess it's good :)

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 17/18] backports: use depmod -a
  2013-04-10 11:35 ` [PATCH 17/18] backports: use depmod -a Luis R. Rodriguez
@ 2013-04-10 13:46   ` Johannes Berg
  0 siblings, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:46 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
> 
> Use only depmod -a and at the same time tell the
> user to reboot, we no longer support unloading /
> loading for them given that we backport too many
> modules.

Heh, fine with me.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 16/18] backports: add udev rules if required for backported firmware_class
  2013-04-10 11:35 ` [PATCH 16/18] backports: add udev rules if required for backported firmware_class Luis R. Rodriguez
  2013-04-10 13:45   ` Johannes Berg
@ 2013-04-10 13:47   ` Johannes Berg
  2013-04-10 20:12     ` Luis R. Rodriguez
  1 sibling, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:47 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

Oh, I wonder if there's a way to know this isn't needed on newer
kernels? But I guess it doesn't really hurt anyway.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 18/18] backports: add update-initramfs support
  2013-04-10 11:35 ` [PATCH 18/18] backports: add update-initramfs support Luis R. Rodriguez
@ 2013-04-10 13:48   ` Johannes Berg
  2013-04-10 20:12     ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 13:48 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:

> +KLIB=1

pretty sure that should be "$1" or at least just $1 ?

johannes



^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 02/18] compat: backport dev_level_ratelimited()
  2013-04-10 13:16   ` Johannes Berg
@ 2013-04-10 17:07     ` Luis R. Rodriguez
  2013-04-10 17:15       ` Johannes Berg
  0 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 17:07 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports

On Wed, Apr 10, 2013 at 6:16 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
>
> Applied.
>
>> +++ b/backport/include/linux/compat-3.5.h
>> @@ -10,6 +10,42 @@
>>
>>  #include <net/netlink.h>
>>
>> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,27))
>> +#include <linux/ratelimit.h>
>
> I think, however, that it would be easier to understand if we started
> putting less stuff into compat-xyz.h and more into linux/feature.h?
> Needs more discussion though I guess.

Sure, lets what's the idea or do you want to do that on another thread?

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 05/18] compat: backport GPIOF_OPEN_DRAIN definition
  2013-04-10 13:18   ` Johannes Berg
@ 2013-04-10 17:10     ` Luis R. Rodriguez
  0 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 17:10 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports

On Wed, Apr 10, 2013 at 6:18 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
>> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
>>
>> This functionality will just be ignored, later we'll
>> just port the full gpiolib.
>
> That seems a bit dangerous? If the driver expects to be able to set the
> pin this way, do we really want to stop it?

Yes, thanks I forgot to drop this. Thanks for the review.

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 13:22   ` Johannes Berg
@ 2013-04-10 17:13     ` Luis R. Rodriguez
  2013-04-10 17:20       ` Johannes Berg
  0 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 17:13 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports

On Wed, Apr 10, 2013 at 6:22 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
>> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
>>
>> For older kernels this is simply a matter of using
>> LIST_HEAD.
>
> Hmm, how is that useful if it will not have any effect?

The core of the handling is done in the internal asynch code and
that's kept hidden from the users of this -- so far.

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 02/18] compat: backport dev_level_ratelimited()
  2013-04-10 17:07     ` Luis R. Rodriguez
@ 2013-04-10 17:15       ` Johannes Berg
  2013-04-11 14:44         ` taking backports out of compat-*.h (was: [PATCH 02/18] compat: backport dev_level_ratelimited()) Johannes Berg
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 17:15 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 10:07 -0700, Luis R. Rodriguez wrote:

> > I think, however, that it would be easier to understand if we started
> > putting less stuff into compat-xyz.h and more into linux/feature.h?
> > Needs more discussion though I guess.
> 
> Sure, lets what's the idea or do you want to do that on another thread?

It's kinda half-baked and I'm not completely sure it's a good idea
(because we may have to follow header file renames, though they happen
rarely), but I was basically thinking this:

Say there's

void my_foo_function(struct foo *f);

that we want to backport. Let's also say it's defined in <linux/foo.h>,
and that it was usually present starting from kernel 3.0, but for now
let's assume the "foo" subsystem always existed (i.e. <linux/foo.h>)

Typically, we'd therefore add it to <linux/compat-3.0.h> and declare it
there, maybe with the LINUX_BACKPORT() wrapper, and then define it in
compat/compat-3.0.c.

What I'm thinking is that we should maybe declare it in compat in
include/linux/foo.h instead, maybe like this:

#ifndef __BACKPORT_FOO
#define __BACKPORT_FOO
#include_next <linux/foo.h>

#if LINUX_VERSION < 3.0
#define my_foo_function LINUX_BACKPORT(my_foo_function)

void my_foo_function(struct foo *f);
#endif

#endif /* __BACKPORT_FOO */



I'm a bit undecided. On the one hand I think it's nice that we can spot
in one place what's backported where in all the
include/linux/compat-xyz.h files, but on the other hand it's kinda
becoming a messy jumble of features across different subsystems, and
hard to determine what you have already and might need for a given
header file?

Anyway it's probably not even half-baked yet :)

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 17:13     ` Luis R. Rodriguez
@ 2013-04-10 17:20       ` Johannes Berg
  2013-04-10 17:26         ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 17:20 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 10:13 -0700, Luis R. Rodriguez wrote:
> On Wed, Apr 10, 2013 at 6:22 AM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
> >> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
> >>
> >> For older kernels this is simply a matter of using
> >> LIST_HEAD.
> >
> > Hmm, how is that useful if it will not have any effect?
> 
> The core of the handling is done in the internal asynch code and
> that's kept hidden from the users of this -- so far.

I guess I'd have to review the async API, but now this wouldn't do
anything? What's the use of just this when you don't have things like
async_schedule_domain() and async_synchronize_full_domain(), regulator
stuff wouldn't compile I think?

I guess I'm a bit confused what kind of effect this has.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 17:20       ` Johannes Berg
@ 2013-04-10 17:26         ` Luis R. Rodriguez
  2013-04-10 18:20           ` Johannes Berg
  0 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 17:26 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports, Dan Williams, linux-kernel

On Wed, Apr 10, 2013 at 10:20 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 10:13 -0700, Luis R. Rodriguez wrote:
>> On Wed, Apr 10, 2013 at 6:22 AM, Johannes Berg
>> <johannes@sipsolutions.net> wrote:
>> > On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
>> >> From: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
>> >>
>> >> For older kernels this is simply a matter of using
>> >> LIST_HEAD.
>> >
>> > Hmm, how is that useful if it will not have any effect?
>>
>> The core of the handling is done in the internal asynch code and
>> that's kept hidden from the users of this -- so far.
>
> I guess I'd have to review the async API,

Yeap, reviewing the commit noted would help too.

> but now this wouldn't do
> anything?

Nope.

> What's the use of just this when you don't have things like
> async_schedule_domain() and async_synchronize_full_domain(), regulator
> stuff wouldn't compile I think?

You mean is not having the full asynch that deals with all registered
domains likely to have an issue on the useres of
async_synchronize_full_domain() ? Lets better ask Dan.

> I guess I'm a bit confused what kind of effect this has.

Nothing, really. If we had a user of it in other ways we'd fail
compiling anyway but right now its a simple direct replacement.

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 17:26         ` Luis R. Rodriguez
@ 2013-04-10 18:20           ` Johannes Berg
  2013-04-10 19:19             ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 18:20 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports, Dan Williams, linux-kernel

On Wed, 2013-04-10 at 10:26 -0700, Luis R. Rodriguez wrote:

> > I guess I'd have to review the async API,
> 
> Yeap, reviewing the commit noted would help too.

Yeah ... :)

> > What's the use of just this when you don't have things like
> > async_schedule_domain() and async_synchronize_full_domain(), regulator
> > stuff wouldn't compile I think?
> 
> You mean is not having the full asynch that deals with all registered
> domains likely to have an issue on the useres of
> async_synchronize_full_domain() ? Lets better ask Dan.

I don't know. However it seems that in order to have an ASYNC_DOMAIN()
or ASYNC_DOMAIN_EXCLUSIVE() you always need to *do* something with it,
so for that you'd also need the functions async_schedule_domain() and
async_synchronize_full_domain() or similar, at least, no?

The point here seems to be making boot faster by starting a bunch of
async probing inside a domain, and then you wait for the entire domain,
so everything that's in that domain can be done in parallel.

Say for example you have 20 SCSI drives. If you look at them serially
then you'd waste much time waiting for the drives. The point here
appears to be that you create a domain (using this macro), then add all
the drives to the domain and then wait for the domain to finish.

However, it seems entirely pointless to backport just a small part of
the API?

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 18:20           ` Johannes Berg
@ 2013-04-10 19:19             ` Luis R. Rodriguez
  2013-04-10 19:27               ` Johannes Berg
  0 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 19:19 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports, Dan Williams, linux-kernel

On Wed, Apr 10, 2013 at 11:20 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 10:26 -0700, Luis R. Rodriguez wrote:
>
>> > I guess I'd have to review the async API,
>>
>> Yeap, reviewing the commit noted would help too.
>
> Yeah ... :)
>
>> > What's the use of just this when you don't have things like
>> > async_schedule_domain() and async_synchronize_full_domain(), regulator
>> > stuff wouldn't compile I think?
>>
>> You mean is not having the full asynch that deals with all registered
>> domains likely to have an issue on the useres of
>> async_synchronize_full_domain() ? Lets better ask Dan.
>
> I don't know. However it seems that in order to have an ASYNC_DOMAIN()
> or ASYNC_DOMAIN_EXCLUSIVE() you always need to *do* something with it,
> so for that you'd also need the functions async_schedule_domain() and
> async_synchronize_full_domain() or similar, at least, no?
>
> The point here seems to be making boot faster by starting a bunch of
> async probing inside a domain, and then you wait for the entire domain,
> so everything that's in that domain can be done in parallel.
>
> Say for example you have 20 SCSI drives. If you look at them serially
> then you'd waste much time waiting for the drives. The point here
> appears to be that you create a domain (using this macro), then add all
> the drives to the domain and then wait for the domain to finish.
>
> However, it seems entirely pointless to backport just a small part of
> the API?

Oh I agree don't get me wrong, however porting kernel/async.c seems
like a rather separate effort worth considering. As-is though I have
not seen any negative impact though to keep older subsystems from
compiling, ie its a no-op for older kernels as I see it.

 Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 19:19             ` Luis R. Rodriguez
@ 2013-04-10 19:27               ` Johannes Berg
  2013-04-10 19:32                 ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 19:27 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports, Dan Williams, linux-kernel

On Wed, 2013-04-10 at 12:19 -0700, Luis R. Rodriguez wrote:

> > However, it seems entirely pointless to backport just a small part of
> > the API?
> 
> Oh I agree don't get me wrong, however porting kernel/async.c seems
> like a rather separate effort worth considering. As-is though I have
> not seen any negative impact though to keep older subsystems from
> compiling, ie its a no-op for older kernels as I see it.

I guess that's what I don't understand -- I don't see usages of
ASYNC_DOMAIN_EXCLUSIVE in any header files, and in e.g. regulator/core.c
you'd also need the functions async_schedule_domain() etc. So where does
this help even compiling?

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 19:27               ` Johannes Berg
@ 2013-04-10 19:32                 ` Luis R. Rodriguez
  2013-04-10 19:39                   ` Johannes Berg
  0 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 19:32 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports, Dan Williams, linux-kernel

On Wed, Apr 10, 2013 at 12:27 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 12:19 -0700, Luis R. Rodriguez wrote:
>
>> > However, it seems entirely pointless to backport just a small part of
>> > the API?
>>
>> Oh I agree don't get me wrong, however porting kernel/async.c seems
>> like a rather separate effort worth considering. As-is though I have
>> not seen any negative impact though to keep older subsystems from
>> compiling, ie its a no-op for older kernels as I see it.
>
> I guess that's what I don't understand -- I don't see usages of
> ASYNC_DOMAIN_EXCLUSIVE in any header files, and in e.g. regulator/core.c
> you'd also need the functions async_schedule_domain() etc. So where does
> this help even compiling?

You know what, sorry this was left over from when I tried to backport
the regulatory to the core of compat, and since I decided to not even
go there given that it relies on init sections on the vmlinux we can
safely discard this patch (although what I said still hold, just not
needed).

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 19:32                 ` Luis R. Rodriguez
@ 2013-04-10 19:39                   ` Johannes Berg
  2013-04-10 19:40                     ` Luis R. Rodriguez
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 19:39 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports, Dan Williams, linux-kernel

On Wed, 2013-04-10 at 12:32 -0700, Luis R. Rodriguez wrote:

> >> Oh I agree don't get me wrong, however porting kernel/async.c seems
> >> like a rather separate effort worth considering. As-is though I have
> >> not seen any negative impact though to keep older subsystems from
> >> compiling, ie its a no-op for older kernels as I see it.
> >
> > I guess that's what I don't understand -- I don't see usages of
> > ASYNC_DOMAIN_EXCLUSIVE in any header files, and in e.g. regulator/core.c
> > you'd also need the functions async_schedule_domain() etc. So where does
> > this help even compiling?
> 
> You know what, sorry this was left over from when I tried to backport
> the regulatory to the core of compat, and since I decided to not even
> go there given that it relies on init sections on the vmlinux we can
> safely discard this patch (although what I said still hold, just not
> needed).

Ok. Yeah after looking at the users I actually do agree this won't
really hurt, but it seemed it doesn't help anything at all hence my
confusion... :)

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE()
  2013-04-10 19:39                   ` Johannes Berg
@ 2013-04-10 19:40                     ` Luis R. Rodriguez
  0 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 19:40 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports, Dan Williams, linux-kernel

On Wed, Apr 10, 2013 at 12:39 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 12:32 -0700, Luis R. Rodriguez wrote:
>
>> >> Oh I agree don't get me wrong, however porting kernel/async.c seems
>> >> like a rather separate effort worth considering. As-is though I have
>> >> not seen any negative impact though to keep older subsystems from
>> >> compiling, ie its a no-op for older kernels as I see it.
>> >
>> > I guess that's what I don't understand -- I don't see usages of
>> > ASYNC_DOMAIN_EXCLUSIVE in any header files, and in e.g. regulator/core.c
>> > you'd also need the functions async_schedule_domain() etc. So where does
>> > this help even compiling?
>>
>> You know what, sorry this was left over from when I tried to backport
>> the regulatory to the core of compat, and since I decided to not even
>> go there given that it relies on init sections on the vmlinux we can
>> safely discard this patch (although what I said still hold, just not
>> needed).
>
> Ok. Yeah after looking at the users I actually do agree this won't
> really hurt, but it seemed it doesn't help anything at all hence my
> confusion... :)

Yea its fine to drop for now.

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 13/18] backports: add blacklist module support
  2013-04-10 13:35   ` Johannes Berg
@ 2013-04-10 19:57     ` Luis R. Rodriguez
  2013-04-10 20:00       ` Johannes Berg
  0 siblings, 1 reply; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 19:57 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports

On Wed, Apr 10, 2013 at 6:35 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
>> +rm -f $BLACKLIST_CONF
>> +
>> +echo "# To be used when using backported drivers" >> $BLACKLIST_CONF
>
> Or you could just use > instead of >> on this first line ;-)

Doh, yes.

>> +for i in $(grep -v ^# $BLACKLIST_MAP | cut -f 2); do
>
> What happens if the blacklist map contains empty lines? Might want to
> allow that.

That's magically taken care of, I tested even with a line with just
just empty lines but also spaces. For some reason awk works more
reliably for the field cutting so I'll switch it.

>> +     MODULE="${i}.ko"
>> +     MODULE_UPDATE="$(grep -v ^# $BLACKLIST_MAP | grep $i | cut -f 1 | head -1).ko"
>> +
>> +     COUNT=$(find $MODULE_DIR -type f -name ${MODULE} -or -name ${MODULE}.gz | wc -l)
>> +     COUNT_REPLACE=$(find $MODULE_UPDATES -type f -name ${MODULE_UPDATE} -or -name ${MODULE_UPDATE}.gz | wc -l)
>> +
>> +     if [ $COUNT -ne 0 ]; then
>> +             if [ $COUNT_REPLACE -ne 0 ]; then
>> +                     echo "Blacklisting $MODULE ..."
>> +                     echo blacklist $i >> $BLACKLIST_CONF
>> +             fi
>
> So you do mean "# new-driver old-driver", but then shouldn't the iwlwifi
> lines be reversed?

You would know better, sorry I thought iwlagn replaces those, I'll swap.

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 13/18] backports: add blacklist module support
  2013-04-10 19:57     ` Luis R. Rodriguez
@ 2013-04-10 20:00       ` Johannes Berg
  0 siblings, 0 replies; 51+ messages in thread
From: Johannes Berg @ 2013-04-10 20:00 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 12:57 -0700, Luis R. Rodriguez wrote:

> > So you do mean "# new-driver old-driver", but then shouldn't the iwlwifi
> > lines be reversed?
> 
> You would know better, sorry I thought iwlagn replaces those, I'll swap.

Well it's a bit complicated and it changed a few times, but now there's
only iwlegacy and iwlwifi (with iwldvm/iwlmvm), so iwlagn no longer
exists. It did inbetween at some point, and I think iwlwifi even existed
before already, but that doesn't really matter since a new iwlwifi would
override an existing iwlwifi. So yeah I think they should be switched.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 16/18] backports: add udev rules if required for backported firmware_class
  2013-04-10 13:47   ` Johannes Berg
@ 2013-04-10 20:12     ` Luis R. Rodriguez
  0 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 20:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports

On Wed, Apr 10, 2013 at 6:47 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> Oh, I wonder if there's a way to know this isn't needed on newer
> kernels? But I guess it doesn't really hurt anyway.

Its where we left off on compat-drivers so I welcome evolutions :)

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: [PATCH 18/18] backports: add update-initramfs support
  2013-04-10 13:48   ` Johannes Berg
@ 2013-04-10 20:12     ` Luis R. Rodriguez
  0 siblings, 0 replies; 51+ messages in thread
From: Luis R. Rodriguez @ 2013-04-10 20:12 UTC (permalink / raw)
  To: Johannes Berg; +Cc: backports

On Wed, Apr 10, 2013 at 6:48 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Wed, 2013-04-10 at 04:35 -0700, Luis R. Rodriguez wrote:
>
>> +KLIB=1
>
> pretty sure that should be "$1" or at least just $1 ?

Fuck sorry yes.

  Luis

^ permalink raw reply	[flat|nested] 51+ messages in thread

* taking backports out of compat-*.h (was: [PATCH 02/18] compat: backport dev_level_ratelimited())
  2013-04-10 17:15       ` Johannes Berg
@ 2013-04-11 14:44         ` Johannes Berg
  2013-04-11 14:56           ` taking backports out of compat-*.h Hauke Mehrtens
  0 siblings, 1 reply; 51+ messages in thread
From: Johannes Berg @ 2013-04-11 14:44 UTC (permalink / raw)
  To: Luis R. Rodriguez; +Cc: backports

On Wed, 2013-04-10 at 19:15 +0200, Johannes Berg wrote:

> > Sure, lets what's the idea or do you want to do that on another thread?

Let me give it a different subject :-)

> It's kinda half-baked and I'm not completely sure it's a good idea
> (because we may have to follow header file renames, though they happen
> rarely), but I was basically thinking this:
> 
> Say there's
> 
> void my_foo_function(struct foo *f);
> 
> that we want to backport. Let's also say it's defined in <linux/foo.h>,
> and that it was usually present starting from kernel 3.0, but for now
> let's assume the "foo" subsystem always existed (i.e. <linux/foo.h>)
> 
> Typically, we'd therefore add it to <linux/compat-3.0.h> and declare it
> there, maybe with the LINUX_BACKPORT() wrapper, and then define it in
> compat/compat-3.0.c.
> 
> What I'm thinking is that we should maybe declare it in compat in
> include/linux/foo.h instead, maybe like this:
> 
> #ifndef __BACKPORT_FOO
> #define __BACKPORT_FOO
> #include_next <linux/foo.h>
> 
> #if LINUX_VERSION < 3.0
> #define my_foo_function LINUX_BACKPORT(my_foo_function)
> 
> void my_foo_function(struct foo *f);
> #endif
> 
> #endif /* __BACKPORT_FOO */
> 
> 
> 
> I'm a bit undecided. On the one hand I think it's nice that we can spot
> in one place what's backported where in all the
> include/linux/compat-xyz.h files, but on the other hand it's kinda
> becoming a messy jumble of features across different subsystems, and
> hard to determine what you have already and might need for a given
> header file?

In addition to what I said, I just realized that we should probably do
this, and do it consistently even for old things. That way, we can get
rid of all the pr_fmt patches.

The reason for the pr_fmt patches is that typically, a source file would
have

#define pr_fmt(fmt)           KBUILD_MODNAME ": " fmt
#include <whatever, including somehow getting printk.h>

Now that we force them to include compat-2.6.h at the very beginning of
the file, printk.h already gets included in some way through
compat-2.6.h (there are of course MANY MANY paths to it.)

To avoid redefine warnings, we thus patch everything to be

#undef pr_fmt
#define pr_fmt
...

which of course works, but it's pretty ugly (we have >1000 patchlines
for this!)


If we were able to get rid of compat-2.6.h and put all the backports
into their appropriate headers (linux/foo.h) we could only force an
include of compat_autoconf.h (which doesn't include printk.h of course)
and then we'd be able to get rid of all these patches.

johannes


^ permalink raw reply	[flat|nested] 51+ messages in thread

* Re: taking backports out of compat-*.h
  2013-04-11 14:44         ` taking backports out of compat-*.h (was: [PATCH 02/18] compat: backport dev_level_ratelimited()) Johannes Berg
@ 2013-04-11 14:56           ` Hauke Mehrtens
  0 siblings, 0 replies; 51+ messages in thread
From: Hauke Mehrtens @ 2013-04-11 14:56 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Luis R. Rodriguez, backports

On 04/11/2013 04:44 PM, Johannes Berg wrote:
> On Wed, 2013-04-10 at 19:15 +0200, Johannes Berg wrote:
> 
>>> Sure, lets what's the idea or do you want to do that on another thread?
> 
> Let me give it a different subject :-)
> 
>> It's kinda half-baked and I'm not completely sure it's a good idea
>> (because we may have to follow header file renames, though they happen
>> rarely), but I was basically thinking this:
>>
>> Say there's
>>
>> void my_foo_function(struct foo *f);
>>
>> that we want to backport. Let's also say it's defined in <linux/foo.h>,
>> and that it was usually present starting from kernel 3.0, but for now
>> let's assume the "foo" subsystem always existed (i.e. <linux/foo.h>)
>>
>> Typically, we'd therefore add it to <linux/compat-3.0.h> and declare it
>> there, maybe with the LINUX_BACKPORT() wrapper, and then define it in
>> compat/compat-3.0.c.
>>
>> What I'm thinking is that we should maybe declare it in compat in
>> include/linux/foo.h instead, maybe like this:
>>
>> #ifndef __BACKPORT_FOO
>> #define __BACKPORT_FOO
>> #include_next <linux/foo.h>
>>
>> #if LINUX_VERSION < 3.0
>> #define my_foo_function LINUX_BACKPORT(my_foo_function)
>>
>> void my_foo_function(struct foo *f);
>> #endif
>>
>> #endif /* __BACKPORT_FOO */
>>
>>
>>
>> I'm a bit undecided. On the one hand I think it's nice that we can spot
>> in one place what's backported where in all the
>> include/linux/compat-xyz.h files, but on the other hand it's kinda
>> becoming a messy jumble of features across different subsystems, and
>> hard to determine what you have already and might need for a given
>> header file?
> 
> In addition to what I said, I just realized that we should probably do
> this, and do it consistently even for old things. That way, we can get
> rid of all the pr_fmt patches.
> 
> The reason for the pr_fmt patches is that typically, a source file would
> have
> 
> #define pr_fmt(fmt)           KBUILD_MODNAME ": " fmt
> #include <whatever, including somehow getting printk.h>
> 
> Now that we force them to include compat-2.6.h at the very beginning of
> the file, printk.h already gets included in some way through
> compat-2.6.h (there are of course MANY MANY paths to it.)
> 
> To avoid redefine warnings, we thus patch everything to be
> 
> #undef pr_fmt
> #define pr_fmt
> ...
> 
> which of course works, but it's pretty ugly (we have >1000 patchlines
> for this!)
> 
> 
> If we were able to get rid of compat-2.6.h and put all the backports
> into their appropriate headers (linux/foo.h) we could only force an
> include of compat_autoconf.h (which doesn't include printk.h of course)
> and then we'd be able to get rid of all these patches.

I had a similar same idea a year ago, but haven't found the time to
complete it, see [0]. I am still for this solution.

If linux/foo.h does not exist in recent kernel versions we have to add
it anyway, because the new code references it, so this is not a problem.

With this solution we would clean up the includes used when compiling
and we do not need the pr_fmt patch any more and hopefully some more.

Hauke

[0]:
https://lists.linuxfoundation.org/pipermail/lf_driver_backport/2012-April/000972.html

^ permalink raw reply	[flat|nested] 51+ messages in thread

end of thread, other threads:[~2013-04-11 14:56 UTC | newest]

Thread overview: 51+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10 11:35 [PATCH 00/18] backports: pending patches for Luis Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 01/18] backports: enable DRM_NOUVEAU for 3.2 Luis R. Rodriguez
2013-04-10 13:15   ` Johannes Berg
2013-04-10 11:35 ` [PATCH 02/18] compat: backport dev_level_ratelimited() Luis R. Rodriguez
2013-04-10 13:16   ` Johannes Berg
2013-04-10 17:07     ` Luis R. Rodriguez
2013-04-10 17:15       ` Johannes Berg
2013-04-11 14:44         ` taking backports out of compat-*.h (was: [PATCH 02/18] compat: backport dev_level_ratelimited()) Johannes Berg
2013-04-11 14:56           ` taking backports out of compat-*.h Hauke Mehrtens
2013-04-10 11:35 ` [PATCH 03/18] compat: backport __i2c_transfer() Luis R. Rodriguez
2013-04-10 13:20   ` Johannes Berg
2013-04-10 11:35 ` [PATCH 04/18] compat: backport devm_regmap_init() Luis R. Rodriguez
2013-04-10 13:19   ` Johannes Berg
2013-04-10 11:35 ` [PATCH 05/18] compat: backport GPIOF_OPEN_DRAIN definition Luis R. Rodriguez
2013-04-10 13:18   ` Johannes Berg
2013-04-10 17:10     ` Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 06/18] compat: backport ASYNC_DOMAIN_EXCLUSIVE() Luis R. Rodriguez
2013-04-10 13:22   ` Johannes Berg
2013-04-10 17:13     ` Luis R. Rodriguez
2013-04-10 17:20       ` Johannes Berg
2013-04-10 17:26         ` Luis R. Rodriguez
2013-04-10 18:20           ` Johannes Berg
2013-04-10 19:19             ` Luis R. Rodriguez
2013-04-10 19:27               ` Johannes Berg
2013-04-10 19:32                 ` Luis R. Rodriguez
2013-04-10 19:39                   ` Johannes Berg
2013-04-10 19:40                     ` Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 07/18] compat: backport devres_release() Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 08/18] compat: backport dev_get_regmap() Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 09/18] compat: backport devm_ioremap_resource() Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 10/18] compat: backport module_platform_driver_probe() Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 11/18] compat: add helpers to aid backport of generic DMA changes for v4l Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 12/18] compat: backport dma_get_sgtable() Luis R. Rodriguez
2013-04-10 13:26   ` Johannes Berg
2013-04-10 11:35 ` [PATCH 13/18] backports: add blacklist module support Luis R. Rodriguez
2013-04-10 13:35   ` Johannes Berg
2013-04-10 19:57     ` Luis R. Rodriguez
2013-04-10 20:00       ` Johannes Berg
2013-04-10 11:35 ` [PATCH 14/18] backports: add support for module compression Luis R. Rodriguez
2013-04-10 13:40   ` Johannes Berg
2013-04-10 11:35 ` [PATCH 15/18] backports: add check_depmod to look for module search path Luis R. Rodriguez
2013-04-10 13:43   ` Johannes Berg
2013-04-10 11:35 ` [PATCH 16/18] backports: add udev rules if required for backported firmware_class Luis R. Rodriguez
2013-04-10 13:45   ` Johannes Berg
2013-04-10 13:47   ` Johannes Berg
2013-04-10 20:12     ` Luis R. Rodriguez
2013-04-10 11:35 ` [PATCH 17/18] backports: use depmod -a Luis R. Rodriguez
2013-04-10 13:46   ` Johannes Berg
2013-04-10 11:35 ` [PATCH 18/18] backports: add update-initramfs support Luis R. Rodriguez
2013-04-10 13:48   ` Johannes Berg
2013-04-10 20:12     ` Luis R. Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.