Skip to contentSkip to conversation

i2c: move ACPI helpers into the core

PATCH Applied Mika Westerberg 2 participants 2 messages Aug 21, 2013 – Aug 23, 2013

Subsystems (6)
lore
Share & tools
lore

Mika Westerberg

author maintainer
#0 lore raw

PATCH v2 1/1 i2c: move ACPI helpers into the core

This follows what has already been done for the DeviceTree helpers. Move the ACPI helpers from drivers/acpi/acpi_i2c.c to the I2C core and update documentation accordingly.

This also solves a problem reported by Jerry Snitselaar that we can't build the ACPI I2C helpers as a module.

---
This is rebased on top of Wolfram's V2 patch here:

	http://marc.info/?l=linux-acpi&m=137709287521491&w=2

Changed to use #if IS_ENABLED(CONFIG_ACPI) as is done in the DeviceTree version.

 Documentation/acpi/enumeration.txt          |  15 +---
 drivers/acpi/Kconfig                        |   6 --
 drivers/acpi/Makefile                       |   1 -
 drivers/acpi/acpi_i2c.c                     | 103 ----------------------------
 drivers/i2c/busses/i2c-designware-platdrv.c |   1 -
 drivers/i2c/i2c-core.c                      |  91 ++++++++++++++++++++++++
 include/linux/i2c.h                         |   6 --
 7 files changed, 94 insertions(+), 129 deletions(-)
 delete mode 100644 drivers/acpi/acpi_i2c.c
Documentation/acpi/enumeration.txt +3 -12
index 958266e..d977778 100644
@@ -228,18 +228,9 @@ ACPI handle like:
 I2C serial bus support
 ~~~~~~~~~~~~~~~~~~~~~~
 The slaves behind I2C bus controller only need to add the ACPI IDs like
-with the platform and SPI drivers. However the I2C bus controller driver
-needs to call acpi_i2c_register_devices() after it has added the adapter.
-
-An I2C bus (controller) driver does:
-
-	...
-	ret = i2c_add_numbered_adapter(adapter);
-	if (ret)
-		/* handle error */
-
-	/* Enumerate the slave devices behind this bus via ACPI */
-	acpi_i2c_register_devices(adapter);
+with the platform and SPI drivers. The I2C core automatically enumerates
+any slave devices behind the controller device once the adapter is
+registered.
 
 Below is an example of how to add ACPI support to the existing mpu3050
 input driver:
drivers/acpi/Kconfig +0 -6
index 100bd72..4e0162f 100644
@@ -180,12 +180,6 @@ config ACPI_DOCK
 	  This driver supports ACPI-controlled docking stations and removable
 	  drive bays such as the IBM Ultrabay and the Dell Module Bay.
 
-config ACPI_I2C
-	def_tristate I2C
-	depends on I2C
-	help
-	  ACPI I2C enumeration support.
-
 config ACPI_PROCESSOR
 	tristate "Processor"
 	select THERMAL
drivers/acpi/Makefile +0 -1
index 81dbeb8..cdaf68b 100644
@@ -73,7 +73,6 @@ obj-$(CONFIG_ACPI_HED)		+= hed.o
 obj-$(CONFIG_ACPI_EC_DEBUGFS)	+= ec_sys.o
 obj-$(CONFIG_ACPI_CUSTOM_METHOD)+= custom_method.o
 obj-$(CONFIG_ACPI_BGRT)		+= bgrt.o
-obj-$(CONFIG_ACPI_I2C)		+= acpi_i2c.o
 
 # processor has its own "processor." module_param namespace
 processor-y			:= processor_driver.o processor_throttling.o
drivers/acpi/acpi_i2c.c deleted +0 -103

103 lines not on this page · raw message

drivers/i2c/busses/i2c-designware-platdrv.c +0 -1
index 27ea436..1240fd6 100644
@@ -171,7 +171,6 @@ static int dw_i2c_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failure adding adapter\n");
 		return r;
 	}
-	acpi_i2c_register_devices(adap);
 
 	pm_runtime_set_autosuspend_delay(&pdev->dev, 1000);
 	pm_runtime_use_autosuspend(&pdev->dev);
drivers/i2c/i2c-core.c +91 -0

103 lines not on this page · raw message

include/linux/i2c.h +0 -6
index 2189189..7670d99 100644
@@ -562,10 +562,4 @@ static inline struct i2c_adapter *of_find_i2c_adapter_by_node(struct device_node
 }
 #endif /* CONFIG_OF */
 
-#if IS_ENABLED(CONFIG_ACPI_I2C)
-extern void acpi_i2c_register_devices(struct i2c_adapter *adap);
-#else
-static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) {}
-#endif
-
 #endif /* _LINUX_I2C_H */
Signature · 1 line
1.8.4.rc2
Applied
#1 lore raw
Quoted 9 lines · Mika Westerberg

This follows what has already been done for the DeviceTree helpers. Move the ACPI helpers from drivers/acpi/acpi_i2c.c to the I2C core and update documentation accordingly.

This also solves a problem reported by Jerry Snitselaar that we can't build the ACPI I2C helpers as a module.

Applied to for-next, thanks!