aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorWolfram Sang <wsa@the-dreams.de>2016-07-18 23:56:09 -0400
committerWolfram Sang <wsa@the-dreams.de>2016-07-18 23:57:38 -0400
commit5b40f121ced215544531dc00201ea4e8f68671c1 (patch)
tree6e8fa15eb5807239b2f8dbccc027f5d067ce4cff /drivers/i2c/i2c-core.c
parent38d0fc4662474c6219166505d0a68b45a583fcfb (diff)
Revert "i2c: core: Cleanup I2C ACPI namespace"
This reverts commit a7003b65801e17a19617a509b2dbae3442ddd709.There were too heavy merge conflicts and the driver code making use of this was not ready yet anyhow. So, we wait one cycle. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index abe41369eec1..b2b34a0a35a1 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -88,7 +88,7 @@ void i2c_transfer_trace_unreg(void)
88} 88}
89 89
90#if defined(CONFIG_ACPI) 90#if defined(CONFIG_ACPI)
91struct i2c_acpi_handler_data { 91struct acpi_i2c_handler_data {
92 struct acpi_connection_info info; 92 struct acpi_connection_info info;
93 struct i2c_adapter *adapter; 93 struct i2c_adapter *adapter;
94}; 94};
@@ -103,15 +103,15 @@ struct gsb_buffer {
103 }; 103 };
104} __packed; 104} __packed;
105 105
106struct i2c_acpi_lookup { 106struct acpi_i2c_lookup {
107 struct i2c_board_info *info; 107 struct i2c_board_info *info;
108 acpi_handle adapter_handle; 108 acpi_handle adapter_handle;
109 acpi_handle device_handle; 109 acpi_handle device_handle;
110}; 110};
111 111
112static int i2c_acpi_find_address(struct acpi_resource *ares, void *data) 112static int acpi_i2c_find_address(struct acpi_resource *ares, void *data)
113{ 113{
114 struct i2c_acpi_lookup *lookup = data; 114 struct acpi_i2c_lookup *lookup = data;
115 struct i2c_board_info *info = lookup->info; 115 struct i2c_board_info *info = lookup->info;
116 struct acpi_resource_i2c_serialbus *sb; 116 struct acpi_resource_i2c_serialbus *sb;
117 acpi_handle adapter_handle; 117 acpi_handle adapter_handle;
@@ -140,12 +140,12 @@ static int i2c_acpi_find_address(struct acpi_resource *ares, void *data)
140 return 1; 140 return 1;
141} 141}
142 142
143static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level, 143static acpi_status acpi_i2c_add_device(acpi_handle handle, u32 level,
144 void *data, void **return_value) 144 void *data, void **return_value)
145{ 145{
146 struct i2c_adapter *adapter = data; 146 struct i2c_adapter *adapter = data;
147 struct list_head resource_list; 147 struct list_head resource_list;
148 struct i2c_acpi_lookup lookup; 148 struct acpi_i2c_lookup lookup;
149 struct resource_entry *entry; 149 struct resource_entry *entry;
150 struct i2c_board_info info; 150 struct i2c_board_info info;
151 struct acpi_device *adev; 151 struct acpi_device *adev;
@@ -170,7 +170,7 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
170 */ 170 */
171 INIT_LIST_HEAD(&resource_list); 171 INIT_LIST_HEAD(&resource_list);
172 ret = acpi_dev_get_resources(adev, &resource_list, 172 ret = acpi_dev_get_resources(adev, &resource_list,
173 i2c_acpi_find_address, &lookup); 173 acpi_i2c_find_address, &lookup);
174 acpi_dev_free_resource_list(&resource_list); 174 acpi_dev_free_resource_list(&resource_list);
175 175
176 if (ret < 0 || !info.addr) 176 if (ret < 0 || !info.addr)
@@ -202,17 +202,17 @@ static acpi_status i2c_acpi_add_device(acpi_handle handle, u32 level,
202 return AE_OK; 202 return AE_OK;
203} 203}
204 204
205#define I2C_ACPI_MAX_SCAN_DEPTH 32 205#define ACPI_I2C_MAX_SCAN_DEPTH 32
206 206
207/** 207/**
208 * i2c_acpi_register_devices - enumerate I2C slave devices behind adapter 208 * acpi_i2c_register_devices - enumerate I2C slave devices behind adapter
209 * @adap: pointer to adapter 209 * @adap: pointer to adapter
210 * 210 *
211 * Enumerate all I2C slave devices behind this adapter by walking the ACPI 211 * Enumerate all I2C slave devices behind this adapter by walking the ACPI
212 * namespace. When a device is found it will be added to the Linux device 212 * namespace. When a device is found it will be added to the Linux device
213 * model and bound to the corresponding ACPI handle. 213 * model and bound to the corresponding ACPI handle.
214 */ 214 */
215static void i2c_acpi_register_devices(struct i2c_adapter *adap) 215static void acpi_i2c_register_devices(struct i2c_adapter *adap)
216{ 216{
217 acpi_status status; 217 acpi_status status;
218 218
@@ -220,15 +220,15 @@ static void i2c_acpi_register_devices(struct i2c_adapter *adap)
220 return; 220 return;
221 221
222 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 222 status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
223 I2C_ACPI_MAX_SCAN_DEPTH, 223 ACPI_I2C_MAX_SCAN_DEPTH,
224 i2c_acpi_add_device, NULL, 224 acpi_i2c_add_device, NULL,
225 adap, NULL); 225 adap, NULL);
226 if (ACPI_FAILURE(status)) 226 if (ACPI_FAILURE(status))
227 dev_warn(&adap->dev, "failed to enumerate I2C slaves\n"); 227 dev_warn(&adap->dev, "failed to enumerate I2C slaves\n");
228} 228}
229 229
230#else /* CONFIG_ACPI */ 230#else /* CONFIG_ACPI */
231static inline void i2c_acpi_register_devices(struct i2c_adapter *adap) { } 231static inline void acpi_i2c_register_devices(struct i2c_adapter *adap) { }
232#endif /* CONFIG_ACPI */ 232#endif /* CONFIG_ACPI */
233 233
234#ifdef CONFIG_ACPI_I2C_OPREGION 234#ifdef CONFIG_ACPI_I2C_OPREGION
@@ -293,12 +293,12 @@ static int acpi_gsb_i2c_write_bytes(struct i2c_client *client,
293} 293}
294 294
295static acpi_status 295static acpi_status
296i2c_acpi_space_handler(u32 function, acpi_physical_address command, 296acpi_i2c_space_handler(u32 function, acpi_physical_address command,
297 u32 bits, u64 *value64, 297 u32 bits, u64 *value64,
298 void *handler_context, void *region_context) 298 void *handler_context, void *region_context)
299{ 299{
300 struct gsb_buffer *gsb = (struct gsb_buffer *)value64; 300 struct gsb_buffer *gsb = (struct gsb_buffer *)value64;
301 struct i2c_acpi_handler_data *data = handler_context; 301 struct acpi_i2c_handler_data *data = handler_context;
302 struct acpi_connection_info *info = &data->info; 302 struct acpi_connection_info *info = &data->info;
303 struct acpi_resource_i2c_serialbus *sb; 303 struct acpi_resource_i2c_serialbus *sb;
304 struct i2c_adapter *adapter = data->adapter; 304 struct i2c_adapter *adapter = data->adapter;
@@ -417,10 +417,10 @@ i2c_acpi_space_handler(u32 function, acpi_physical_address command,
417} 417}
418 418
419 419
420static int i2c_acpi_install_space_handler(struct i2c_adapter *adapter) 420static int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
421{ 421{
422 acpi_handle handle; 422 acpi_handle handle;
423 struct i2c_acpi_handler_data *data; 423 struct acpi_i2c_handler_data *data;
424 acpi_status status; 424 acpi_status status;
425 425
426 if (!adapter->dev.parent) 426 if (!adapter->dev.parent)
@@ -431,7 +431,7 @@ static int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)
431 if (!handle) 431 if (!handle)
432 return -ENODEV; 432 return -ENODEV;
433 433
434 data = kzalloc(sizeof(struct i2c_acpi_handler_data), 434 data = kzalloc(sizeof(struct acpi_i2c_handler_data),
435 GFP_KERNEL); 435 GFP_KERNEL);
436 if (!data) 436 if (!data)
437 return -ENOMEM; 437 return -ENOMEM;
@@ -445,7 +445,7 @@ static int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)
445 445
446 status = acpi_install_address_space_handler(handle, 446 status = acpi_install_address_space_handler(handle,
447 ACPI_ADR_SPACE_GSBUS, 447 ACPI_ADR_SPACE_GSBUS,
448 &i2c_acpi_space_handler, 448 &acpi_i2c_space_handler,
449 NULL, 449 NULL,
450 data); 450 data);
451 if (ACPI_FAILURE(status)) { 451 if (ACPI_FAILURE(status)) {
@@ -459,10 +459,10 @@ static int i2c_acpi_install_space_handler(struct i2c_adapter *adapter)
459 return 0; 459 return 0;
460} 460}
461 461
462static void i2c_acpi_remove_space_handler(struct i2c_adapter *adapter) 462static void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
463{ 463{
464 acpi_handle handle; 464 acpi_handle handle;
465 struct i2c_acpi_handler_data *data; 465 struct acpi_i2c_handler_data *data;
466 acpi_status status; 466 acpi_status status;
467 467
468 if (!adapter->dev.parent) 468 if (!adapter->dev.parent)
@@ -475,7 +475,7 @@ static void i2c_acpi_remove_space_handler(struct i2c_adapter *adapter)
475 475
476 acpi_remove_address_space_handler(handle, 476 acpi_remove_address_space_handler(handle,
477 ACPI_ADR_SPACE_GSBUS, 477 ACPI_ADR_SPACE_GSBUS,
478 &i2c_acpi_space_handler); 478 &acpi_i2c_space_handler);
479 479
480 status = acpi_bus_get_private_data(handle, (void **)&data); 480 status = acpi_bus_get_private_data(handle, (void **)&data);
481 if (ACPI_SUCCESS(status)) 481 if (ACPI_SUCCESS(status))
@@ -484,10 +484,10 @@ static void i2c_acpi_remove_space_handler(struct i2c_adapter *adapter)
484 acpi_bus_detach_private_data(handle); 484 acpi_bus_detach_private_data(handle);
485} 485}
486#else /* CONFIG_ACPI_I2C_OPREGION */ 486#else /* CONFIG_ACPI_I2C_OPREGION */
487static inline void i2c_acpi_remove_space_handler(struct i2c_adapter *adapter) 487static inline void acpi_i2c_remove_space_handler(struct i2c_adapter *adapter)
488{ } 488{ }
489 489
490static inline int i2c_acpi_install_space_handler(struct i2c_adapter *adapter) 490static inline int acpi_i2c_install_space_handler(struct i2c_adapter *adapter)
491{ return 0; } 491{ return 0; }
492#endif /* CONFIG_ACPI_I2C_OPREGION */ 492#endif /* CONFIG_ACPI_I2C_OPREGION */
493 493
@@ -1657,8 +1657,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
1657 1657
1658 /* create pre-declared device nodes */ 1658 /* create pre-declared device nodes */
1659 of_i2c_register_devices(adap); 1659 of_i2c_register_devices(adap);
1660 i2c_acpi_register_devices(adap); 1660 acpi_i2c_register_devices(adap);
1661 i2c_acpi_install_space_handler(adap); 1661 acpi_i2c_install_space_handler(adap);
1662 1662
1663 if (adap->nr < __i2c_first_dynamic_bus_num) 1663 if (adap->nr < __i2c_first_dynamic_bus_num)
1664 i2c_scan_static_board_info(adap); 1664 i2c_scan_static_board_info(adap);
@@ -1830,7 +1830,7 @@ void i2c_del_adapter(struct i2c_adapter *adap)
1830 return; 1830 return;
1831 } 1831 }
1832 1832
1833 i2c_acpi_remove_space_handler(adap); 1833 acpi_i2c_remove_space_handler(adap);
1834 /* Tell drivers about this removal */ 1834 /* Tell drivers about this removal */
1835 mutex_lock(&core_lock); 1835 mutex_lock(&core_lock);
1836 bus_for_each_drv(&i2c_bus_type, NULL, adap, 1836 bus_for_each_drv(&i2c_bus_type, NULL, adap,