backports: enable DRM_NOUVEAU for 3.2
PATCH 1/9 backports: enable DRM_NOUVEAU for 3.2
From: "Luis R. Rodriguez" <[email protected]>
--- dependencies | 1 - 1 file changed, 1 deletion(-)
dependencies +0 -1
@@ -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
Signature · 1 line
1.7.10.4
PATCH 2/9 compat: backport dev_level_ratelimited()
From: "Luis R. Rodriguez" <[email protected]>
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 <[email protected]> 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.
--- backport/include/linux/compat-3.5.h | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
backport/include/linux/compat-3.5.h +36 -0
@@ -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
Signature · 1 line
1.7.10.4
PATCH 3/9 compat: backport __i2c_transfer()
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains b37d2a3a v3.6-rc1~28^2~265
commit b37d2a3a75cb0e72e18c29336cb2095b63dabfc8
Author: Jean Delvare <[email protected]> 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.
--- backport/compat/compat-3.6.c | 34 ++++++++++++++++++++++++++++++++++ backport/include/linux/compat-3.6.h | 9 +++++++++ 2 files changed, 43 insertions(+)
backport/compat/compat-3.6.c +34 -0
@@ -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
backport/include/linux/compat-3.6.h +9 -0
@@ -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);
Signature · 1 line
1.7.10.4
PATCH 4/9 compat: backport EPROBE_DEFER value
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
Grant added the ability to the driver core to return EPROBE_DEFER at device driver probe time and for that to trigger a later deferred probe through a workqueue. It seems we could in theory backport this functionality but that requires quite a bit of work. For now just pass on the EPROBE_DEFER definition safely and for older kernels than 3.4 the EPROBE_DEFER would be treated as a regular probe error.
mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains d1c3414c v3.4-rc1~187^2~10
commit d1c3414c2a9d10ef7f0f7665f5d2947cd088c093
Author: Grant Likely <[email protected]> Date: Mon Mar 5 08:47:41 2012 -0700
drivercore: Add driver probe deferral mechanism
Allow drivers to report at probe time that they cannot get all the resources required by the device, and should be retried at a later time.
This should completely solve the problem of getting devices initialized in the right order. Right now this is mostly handled by mucking about with initcall ordering which is a complete hack, and doesn't even remotely handle the case where device drivers are in modules. This approach completely sidesteps the issues by allowing driver registration to occur in any order, and any driver can request to be retried after a few more other drivers get probed.
v4: - Integrate Manjunath's addition of a separate workqueue
- Change -EAGAIN to -EPROBE_DEFER for drivers to trigger deferral
- Update comment blocks to reflect how the code really works
v3: - Hold off workqueue scheduling until late_initcall so that the bulk
of driver probes are complete before we start retrying deferred devices.
- Tested with simple use cases. Still needs more testing though. Using it to get rid of the gpio early_initcall madness, or to replace the ASoC internal probe deferral code would be ideal.
v2: - added locking so it should no longer be utterly broken in that regard
- remove device from deferred list at device_del time.
- Still completely untested with any real use case, but has been boot tested.
--- backport/include/linux/compat-3.4.h | 2 ++ 1 file changed, 2 insertions(+)
backport/include/linux/compat-3.4.h +2 -0
@@ -11,6 +11,8 @@#include <linux/kconfig.h> #endif +#define EPROBE_DEFER 517/* Driver requests probe retry */ +/* * defined here to allow things to compile but technically * using this for memory regions will yield in a no-op on newer
Signature · 1 line
1.7.10.4
Re: [PATCH 4/9] compat: backport EPROBE_DEFER value
Quoted 11 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
Grant added the ability to the driver core to return
EPROBE_DEFERat device driver probe time and for that to trigger a later deferred probe through a workqueue. It seems we could in theory backport this functionality but that requires quite a bit of work. For now just pass on theEPROBE_DEFERdefinition safely and for older kernels than 3.4 theEPROBE_DEFERwould be treated as a regular probe error.
Quoted 1 line
+#define
EPROBE_DEFER517 /* Driver requests probe retry */
I'm not convinced this is useful, particularly not with that error number?
If a driver returns -EPROBE_DEFER it will not work correctly, so why not just require it to be disabled (via the dependencies list) for kernels before 3.4?
Also, if you return -517 userspace might get somewhat confused?
johannes
Re: [PATCH 4/9] compat: backport EPROBE_DEFER value
Quoted 14 lines · Johannes Berg
Quoted 11 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
Grant added the ability to the driver core to return
EPROBE_DEFERat device driver probe time and for that to trigger a later deferred probe through a workqueue. It seems we could in theory backport this functionality but that requires quite a bit of work. For now just pass on theEPROBE_DEFERdefinition safely and for older kernels than 3.4 theEPROBE_DEFERwould be treated as a regular probe error.Quoted 1 line
+#define
EPROBE_DEFER517 /* Driver requests probe retry */
Quoted 8 lines
I'm not convinced this is useful, particularly not with that error number?
If a driver returns -EPROBE_DEFER it will not work correctly, so why not just require it to be disabled (via the dependencies list) for kernels before 3.4?
Also, if you return -517 userspace might get somewhat confused?
Sure.
Luis
PATCH 5/9 compat: backport devm_regmap_init()
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
Backport devm_regmap_init() for I2C and SPI.
mcgrof@frijol ~/linux-stable (git::master)$ git describe --contains c0eb4676 v3.4-rc1~126^2~4^2
commit c0eb46766d395da8d62148bda2e59bad5e6ee2f2
Author: Mark Brown <[email protected]> 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.
--- backport/compat/compat-3.4.c | 95 +++++++++++++++++++++++++++++++++++ backport/include/linux/compat-3.4.h | 15 ++++++ 2 files changed, 110 insertions(+)
backport/compat/compat-3.4.c +95 -0
@@ -12,6 +12,101 @@#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); +} + +/** +* 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, +void *bus_context, +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, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0)) + bus_context, +#endif /* see commit 0135bbcc */ + 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, ®map_i2c, config); +} +EXPORT_SYMBOL_GPL (devm_regmap_init_i2c); +#endif /* defined(CONFIG_REGMAP_I2C) */ + +#if defined(CONFIG_REGMAP_I2C ) +/** +* 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, ®map_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.
backport/include/linux/compat-3.4.h +15 -0
@@ -13,6 +13,21 @@#define EPROBE_DEFER 517/* Driver requests probe retry */ +#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 )) +#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, +void *bus_context, +const struct regmap_config *config); +#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); +#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 /* (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
Signature · 1 line
1.7.10.4
PATCH 6/9 compat: backport GPIOF_OPEN_DRAIN definition
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
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 <[email protected]> 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.
--- backport/include/linux/compat-3.4.h | 1 + 1 file changed, 1 insertion(+)
backport/include/linux/compat-3.4.h +1 -0
@@ -12,6 +12,7 @@#endif #define EPROBE_DEFER 517/* Driver requests probe retry */ +#define GPIOF_OPEN_DRAIN (1 << 2)#if (LINUX_VERSION_CODE >=KERNEL_VERSION (3 ,2 ,0 ))#include <linux/regmap.h>
Signature · 1 line
1.7.10.4
PATCH 7/9 compat: backport ASYNC_DOMAIN_EXCLUSIVE()
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
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 <[email protected]> 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.
--- backport/include/linux/compat-3.6.h | 3 +++ 1 file changed, 3 insertions(+)
backport/include/linux/compat-3.6.h +3 -0
@@ -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,
Signature · 1 line
1.7.10.4
PATCH 8/9 compat: backport devres_release()
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
commit d926d0e4c74cfcb42a05e91d1cdf698b41e1e118
Author: Mark Brown <[email protected]> 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.
--- backport/compat/compat-3.5.c | 34 ++++++++++++++++++++++++++++++++++ backport/include/linux/compat-3.5.h | 6 ++++++ 2 files changed, 40 insertions(+)
backport/compat/compat-3.5.c +34 -0
@@ -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
backport/include/linux/compat-3.5.h +6 -0
@@ -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, ...) \
Signature · 1 line
1.7.10.4
PATCH 9/9 compat: backport dev_get_regmap()
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
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 <[email protected]> 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.
--- backport/include/linux/compat-3.5.h | 9 +++++++++ 1 file changed, 9 insertions(+)
backport/include/linux/compat-3.5.h +9 -0
@@ -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);
Signature · 1 line
1.7.10.4