diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-22 22:47:40 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-22 22:47:40 +0300 |
commit | b852495908cd1b02ad47672a83f622ad4264801b (patch) | |
tree | 71d5c3b46098bd5bca165837f06c9f65db7d4678 /drivers/i2c/i2c-core.c | |
parent | 5266e5b12c8b73587130325f7074d2f49ef9e427 (diff) | |
parent | 886f6f8337dd506e9ae0e45ee13eef3a0ceebd03 (diff) | |
download | linux-b852495908cd1b02ad47672a83f622ad4264801b.tar.xz |
Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang:
"Mostly usual driver updates and improvements. The changelog should
give an idea. Standing out is the i2c-qup driver with lots of new
capabilities and we also have now an i2c-demuxer.
I'd especially like to welcome Peter Rosin as the i2c-mux maintainer.
He has an interesting series for muxes in the queue and agreed to look
after this part of the subsystem. Thank you, Peter, and welcome
again!
The octeon changes were applied pretty recently before the merge
window. I am aware. They are the first (and relatively simple)
patches of a larger overhaul to this driver. In case something goes
wrong with them, they are easy to fix (or revert). The advantage I
see is that they are out of the way, and I can concentrate on the next
block of patches. I really would like to apply the overhaul in
smaller batches to avoid regressions. And waiting a cycle for the
introductory patches seemed too much of a delay for me"
* 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (39 commits)
i2c: octeon: Support I2C_M_RECV_LEN
i2c: octeon: Cleanup resource allocation code
i2c: octeon: Cleanup i2c-octeon driver
MAINTAINERS: add Peter Rosin as i2c mux maintainer
dt-bindings: i2c: Spelling s/propoerty/property/
i2c: immediately mark ourselves as registered
i2c: i801: sort IDs alphabetically
MAINTAINERS: Mika and me are designated reviewers for I2C DESIGNWARE
i2c: octeon: Cleanup kerneldoc comments
i2c: do not use internal data from driver core
i2c: cadence: Fix the kernel-doc warnings
i2c: imx: remove extra spaces.
i2c: rcar: don't open code of_device_get_match_data()
i2c: qup: Fix fifo handling after adding V2 support
i2c: xiic: Implement power management
i2c: piix4: Pre-shift the port number
i2c: piix4: Always use the same type for port
i2c: piix4: Support alternative port selection register
i2c: tegra: don't open code of_device_get_match_data()
i2c: riic, sh_mobile, rcar: Use ARCH_RENESAS
...
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index ffe715d346d8..0f2f8484e8ec 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -28,32 +28,32 @@ */ #include <dt-bindings/i2c/i2c.h> -#include <linux/module.h> -#include <linux/kernel.h> +#include <asm/uaccess.h> +#include <linux/acpi.h> +#include <linux/clk/clk-conf.h> +#include <linux/completion.h> #include <linux/delay.h> +#include <linux/err.h> #include <linux/errno.h> #include <linux/gpio.h> -#include <linux/slab.h> +#include <linux/hardirq.h> #include <linux/i2c.h> -#include <linux/init.h> #include <linux/idr.h> +#include <linux/init.h> +#include <linux/irqflags.h> +#include <linux/jump_label.h> +#include <linux/kernel.h> +#include <linux/module.h> #include <linux/mutex.h> -#include <linux/of.h> #include <linux/of_device.h> +#include <linux/of.h> #include <linux/of_irq.h> -#include <linux/clk/clk-conf.h> -#include <linux/completion.h> -#include <linux/hardirq.h> -#include <linux/irqflags.h> -#include <linux/rwsem.h> -#include <linux/pm_runtime.h> #include <linux/pm_domain.h> +#include <linux/pm_runtime.h> #include <linux/pm_wakeirq.h> -#include <linux/acpi.h> -#include <linux/jump_label.h> -#include <asm/uaccess.h> -#include <linux/err.h> #include <linux/property.h> +#include <linux/rwsem.h> +#include <linux/slab.h> #include "i2c-core.h" @@ -73,6 +73,7 @@ static struct device_type i2c_client_type; static int i2c_detect(struct i2c_adapter *adapter, struct i2c_driver *driver); static struct static_key i2c_trace_msg = STATIC_KEY_INIT_FALSE; +static bool is_registered; void i2c_transfer_trace_reg(void) { @@ -1529,7 +1530,7 @@ static int i2c_register_adapter(struct i2c_adapter *adap) int res = 0; /* Can't register until after driver model init */ - if (unlikely(WARN_ON(!i2c_bus_type.p))) { + if (WARN_ON(!is_registered)) { res = -EAGAIN; goto out_list; } @@ -1926,7 +1927,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) int res; /* Can't register until after driver model init */ - if (unlikely(WARN_ON(!i2c_bus_type.p))) + if (WARN_ON(!is_registered)) return -EAGAIN; /* add the driver to the list of i2c drivers in the driver core */ @@ -2104,6 +2105,9 @@ static int __init i2c_init(void) retval = bus_register(&i2c_bus_type); if (retval) return retval; + + is_registered = true; + #ifdef CONFIG_I2C_COMPAT i2c_adapter_compat_class = class_compat_register("i2c-adapter"); if (!i2c_adapter_compat_class) { @@ -2125,6 +2129,7 @@ class_err: class_compat_unregister(i2c_adapter_compat_class); bus_err: #endif + is_registered = false; bus_unregister(&i2c_bus_type); return retval; } |