From: Linus Torvalds Date: Sun, 14 Dec 2014 20:54:40 +0000 (-0800) Subject: Merge branch 'i2c/for-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa... X-Git-Tag: v3.19-rc1~84 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=96895199c8648db475b38aac5fe6a04ec14a49c4;p=platform%2Fkernel%2Flinux-exynos.git Merge branch 'i2c/for-3.19' of git://git./linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "For 3.19, the I2C subsystem has to offer special candy this time. Right in time for Christmas :) - I2C slave framework: finally, a generic mechanism for Linux being an I2C slave (if the bus driver supports that). Docs are still missing but will come later this cycle, the code is good enough to go. - I2C muxes represent their topology in sysfs much more detailed. This will help users to navigate around much easier. - irq population of i2c clients is now done at probe time, not device creation time, to have better support for deferred probing. - new drivers for Imagination SCB, Amlogic Meson - DMA support added for Freescale IMX, Renesas SHMobile - slightly bigger driver updates to OMAP, i801, AT91, and rk3x (mostly quirk handling, timing updates, and using better kernel interfaces) - eeprom driver can now write with byte-access (very slow, but OK to have) - and the bunch of smaller fixes, cleanups, ID updates..." * 'i2c/for-3.19' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (56 commits) i2c: sh_mobile: remove unneeded DMA mask i2c: rcar: add slave support i2c: slave-eeprom: add eeprom simulator driver i2c: core changes for slave support MAINTAINERS: add I2C dt bindings also to I2C realm i2c: designware: Fix falling time bindings doc i2c: davinci: switch to use platform_get_irq Documentation: i2c: Use PM ops instead of legacy suspend/resume i2c: sh_mobile: optimize irq entry i2c: pxa: add support for SCCB devices omap: i2c: don't check bus state IP rev3.3 and earlier i2c: s3c2410: Handle i2c sys_cfg register in i2c driver i2c: rk3x: add Kconfig dependency on COMMON_CLK i2c: omap: add notes related to i2c multimaster mode i2c: omap: don't reset controller if Arbitration Lost detected i2c: omap: implement workaround for handling invalid BB-bit values i2c: omap: cleanup register definitions i2c: rk3x: handle dynamic clock rate changes correctly i2c: at91: enable probe deferring on dma channel request i2c: at91: remove legacy DMA support ... --- 96895199c8648db475b38aac5fe6a04ec14a49c4 diff --cc drivers/i2c/i2c-core.c index 229a89e,c09d06b..39d25a8 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@@ -1370,69 -1380,61 +1382,67 @@@ static void i2c_scan_static_board_info( /* OF support code */ #if IS_ENABLED(CONFIG_OF) -static void of_i2c_register_devices(struct i2c_adapter *adap) +static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, + struct device_node *node) { - void *result; - struct device_node *node; + struct i2c_client *result; + struct i2c_board_info info = {}; + struct dev_archdata dev_ad = {}; + const __be32 *addr; + int len; - /* Only register child devices if the adapter has a node pointer set */ - if (!adap->dev.of_node) - return; + dev_dbg(&adap->dev, "of_i2c: register %s\n", node->full_name); - dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); + if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) { + dev_err(&adap->dev, "of_i2c: modalias failure on %s\n", + node->full_name); + return ERR_PTR(-EINVAL); + } - for_each_available_child_of_node(adap->dev.of_node, node) { - struct i2c_board_info info = {}; - struct dev_archdata dev_ad = {}; - const __be32 *addr; - int len; + addr = of_get_property(node, "reg", &len); + if (!addr || (len < sizeof(int))) { + dev_err(&adap->dev, "of_i2c: invalid reg on %s\n", + node->full_name); + return ERR_PTR(-EINVAL); + } - dev_dbg(&adap->dev, "of_i2c: register %s\n", node->full_name); + info.addr = be32_to_cpup(addr); + if (info.addr > (1 << 10) - 1) { + dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n", + info.addr, node->full_name); + return ERR_PTR(-EINVAL); + } - info.irq = irq_of_parse_and_map(node, 0); - if (of_modalias_node(node, info.type, sizeof(info.type)) < 0) { - dev_err(&adap->dev, "of_i2c: modalias failure on %s\n", - node->full_name); - continue; - } + info.of_node = of_node_get(node); + info.archdata = &dev_ad; - addr = of_get_property(node, "reg", &len); - if (!addr || (len < sizeof(int))) { - dev_err(&adap->dev, "of_i2c: invalid reg on %s\n", - node->full_name); - continue; - } + if (of_get_property(node, "wakeup-source", NULL)) + info.flags |= I2C_CLIENT_WAKE; - info.addr = be32_to_cpup(addr); - if (info.addr > (1 << 10) - 1) { - dev_err(&adap->dev, "of_i2c: invalid addr=%x on %s\n", - info.addr, node->full_name); - continue; - } + request_module("%s%s", I2C_MODULE_PREFIX, info.type); - info.of_node = of_node_get(node); - info.archdata = &dev_ad; + result = i2c_new_device(adap, &info); + if (result == NULL) { + dev_err(&adap->dev, "of_i2c: Failure registering %s\n", + node->full_name); + of_node_put(node); - irq_dispose_mapping(info.irq); + return ERR_PTR(-EINVAL); + } + return result; +} - if (of_get_property(node, "wakeup-source", NULL)) - info.flags |= I2C_CLIENT_WAKE; +static void of_i2c_register_devices(struct i2c_adapter *adap) +{ + struct device_node *node; - request_module("%s%s", I2C_MODULE_PREFIX, info.type); + /* Only register child devices if the adapter has a node pointer set */ + if (!adap->dev.of_node) + return; - result = i2c_new_device(adap, &info); - if (result == NULL) { - dev_err(&adap->dev, "of_i2c: Failure registering %s\n", - node->full_name); - of_node_put(node); - continue; - } - } + dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); + + for_each_available_child_of_node(adap->dev.of_node, node) + of_i2c_register_device(adap, node); } static int of_dev_node_match(struct device *dev, void *data)