mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
i2c: move OF helpers into the core
I2C of helpers used to live in of_i2c.c but experience (from SPI) shows that it is much cleaner to have this in the core. This also removes a circular dependency between the helpers and the core, and so we can finally register child nodes in the core instead of doing this manually in each driver. So, fix the drivers and documentation, too. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
This commit is contained in:
@@ -238,7 +238,6 @@ An I2C bus (controller) driver does:
|
||||
if (ret)
|
||||
/* handle error */
|
||||
|
||||
of_i2c_register_devices(adapter);
|
||||
/* Enumerate the slave devices behind this bus via ACPI */
|
||||
acpi_i2c_register_devices(adapter);
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/export.h>
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/pinctrl/pinmux.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
#include <drm/drm_encoder_slave.h>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/pinctrl/pinmux.h>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/i2c.h>
|
||||
|
||||
#include "drm.h"
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/platform_data/dma-atmel.h>
|
||||
@@ -775,8 +774,6 @@ static int at91_twi_probe(struct platform_device *pdev)
|
||||
return rc;
|
||||
}
|
||||
|
||||
of_i2c_register_devices(&dev->adapter);
|
||||
|
||||
dev_info(dev->dev, "AT91 i2c bus driver.\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <sysdev/fsl_soc.h>
|
||||
#include <asm/cpm.h>
|
||||
|
||||
@@ -681,11 +680,6 @@ static int cpm_i2c_probe(struct platform_device *ofdev)
|
||||
dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
|
||||
cpm->adap.name);
|
||||
|
||||
/*
|
||||
* register OF I2C devices
|
||||
*/
|
||||
of_i2c_register_devices(&cpm->adap);
|
||||
|
||||
return 0;
|
||||
out_shut:
|
||||
cpm_i2c_shutdown(cpm);
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_data/i2c-davinci.h>
|
||||
|
||||
@@ -726,7 +725,6 @@ static int davinci_i2c_probe(struct platform_device *pdev)
|
||||
dev_err(&pdev->dev, "failure adding adapter\n");
|
||||
goto err_unuse_clocks;
|
||||
}
|
||||
of_i2c_register_devices(adap);
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include <linux/err.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
@@ -172,7 +171,6 @@ static int dw_i2c_probe(struct platform_device *pdev)
|
||||
dev_err(&pdev->dev, "failure adding adapter\n");
|
||||
return r;
|
||||
}
|
||||
of_i2c_register_devices(adap);
|
||||
acpi_i2c_register_devices(adap);
|
||||
|
||||
pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/of_i2c.h>
|
||||
|
||||
struct i2c_gpio_private_data {
|
||||
struct i2c_adapter adap;
|
||||
@@ -224,8 +223,6 @@ static int i2c_gpio_probe(struct platform_device *pdev)
|
||||
if (ret)
|
||||
goto err_add_bus;
|
||||
|
||||
of_i2c_register_devices(adap);
|
||||
|
||||
platform_set_drvdata(pdev, priv);
|
||||
|
||||
dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
|
||||
|
||||
@@ -87,7 +87,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/of_i2c.h>
|
||||
|
||||
#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
|
||||
defined CONFIG_DMI
|
||||
@@ -1230,7 +1229,6 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
|
||||
goto exit_free_irq;
|
||||
}
|
||||
|
||||
of_i2c_register_devices(&priv->adapter);
|
||||
i801_probe_optional_slaves(priv);
|
||||
/* We ignore errors - multiplexing is optional */
|
||||
i801_add_mux(priv);
|
||||
|
||||
@@ -42,7 +42,6 @@
|
||||
#include <linux/io.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_i2c.h>
|
||||
|
||||
#include "i2c-ibm_iic.h"
|
||||
|
||||
@@ -759,9 +758,6 @@ static int iic_probe(struct platform_device *ofdev)
|
||||
dev_info(&ofdev->dev, "using %s mode\n",
|
||||
dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
|
||||
|
||||
/* Now register all the child nodes */
|
||||
of_i2c_register_devices(adap);
|
||||
|
||||
return 0;
|
||||
|
||||
error_cleanup:
|
||||
|
||||
@@ -52,7 +52,6 @@
|
||||
#include <linux/slab.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/platform_data/i2c-imx.h>
|
||||
|
||||
/** Defines ********************************************************************
|
||||
@@ -682,8 +681,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
of_i2c_register_devices(&i2c_imx->adapter);
|
||||
|
||||
/* Set up platform driver data */
|
||||
platform_set_drvdata(pdev, i2c_imx);
|
||||
clk_disable_unprepare(i2c_imx->clk);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <linux/sched.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include <linux/io.h>
|
||||
@@ -694,7 +693,6 @@ static int fsl_i2c_probe(struct platform_device *op)
|
||||
dev_err(i2c->dev, "failed to add adapter\n");
|
||||
goto fail_add;
|
||||
}
|
||||
of_i2c_register_devices(&i2c->adap);
|
||||
|
||||
return result;
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_irq.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/delay.h>
|
||||
@@ -871,8 +870,6 @@ mv64xxx_i2c_probe(struct platform_device *pd)
|
||||
goto exit_free_irq;
|
||||
}
|
||||
|
||||
of_i2c_register_devices(&drv_data->adapter);
|
||||
|
||||
return 0;
|
||||
|
||||
exit_free_irq:
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include <linux/stmp_device.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/dmaengine.h>
|
||||
|
||||
@@ -752,8 +751,6 @@ static int mxs_i2c_probe(struct platform_device *pdev)
|
||||
return err;
|
||||
}
|
||||
|
||||
of_i2c_register_devices(adap);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/platform_data/i2c-nomadik.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/pinctrl/consumer.h>
|
||||
|
||||
#define DRIVER_NAME "nmk-i2c"
|
||||
@@ -1045,8 +1044,6 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
|
||||
goto err_add_adap;
|
||||
}
|
||||
|
||||
of_i2c_register_devices(adap);
|
||||
|
||||
pm_runtime_put(&adev->dev);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include <linux/i2c-ocores.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/log2.h>
|
||||
|
||||
struct ocores_i2c {
|
||||
@@ -432,8 +431,6 @@ static int ocores_i2c_probe(struct platform_device *pdev)
|
||||
if (pdata) {
|
||||
for (i = 0; i < pdata->num_devices; i++)
|
||||
i2c_new_device(&i2c->adap, pdata->devices + i);
|
||||
} else {
|
||||
of_i2c_register_devices(&i2c->adap);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/sched.h>
|
||||
#include <linux/slab.h>
|
||||
@@ -599,8 +598,6 @@ static int octeon_i2c_probe(struct platform_device *pdev)
|
||||
}
|
||||
dev_info(i2c->dev, "version %s\n", DRV_VERSION);
|
||||
|
||||
of_i2c_register_devices(&i2c->adap);
|
||||
|
||||
return 0;
|
||||
|
||||
out:
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_i2c.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/i2c-omap.h>
|
||||
@@ -1231,8 +1230,6 @@ omap_i2c_probe(struct platform_device *pdev)
|
||||
dev_info(dev->dev, "bus %d rev%d.%d at %d kHz\n", adap->nr,
|
||||
major, minor, dev->speed);
|
||||
|
||||
of_i2c_register_devices(adap);
|
||||
|
||||
pm_runtime_mark_last_busy(dev->dev);
|
||||
pm_runtime_put_autosuspend(dev->dev);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user