mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-29 02:24:04 +00:00
i2c: Drop redundant i2c_adapter.list
i2c_adapter.list is superfluous, this list duplicates the one maintained by the driver core. Drop it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: David Brownell <dbrownell@users.sourceforge.net>
This commit is contained in:
parent
e48d33193d
commit
87c6c22945
3 changed files with 10 additions and 24 deletions
|
@ -191,15 +191,6 @@ Who: Kay Sievers <kay.sievers@suse.de>
|
||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
What: i2c_adapter.list
|
|
||||||
When: July 2007
|
|
||||||
Why: Superfluous, this list duplicates the one maintained by the driver
|
|
||||||
core.
|
|
||||||
Who: Jean Delvare <khali@linux-fr.org>,
|
|
||||||
David Brownell <dbrownell@users.sourceforge.net>
|
|
||||||
|
|
||||||
---------------------------
|
|
||||||
|
|
||||||
What: ACPI procfs interface
|
What: ACPI procfs interface
|
||||||
When: July 2008
|
When: July 2008
|
||||||
Why: ACPI sysfs conversion should be finished by January 2008.
|
Why: ACPI sysfs conversion should be finished by January 2008.
|
||||||
|
|
|
@ -34,11 +34,11 @@
|
||||||
#include <linux/mutex.h>
|
#include <linux/mutex.h>
|
||||||
#include <linux/completion.h>
|
#include <linux/completion.h>
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
#include <asm/semaphore.h>
|
||||||
|
|
||||||
#include "i2c-core.h"
|
#include "i2c-core.h"
|
||||||
|
|
||||||
|
|
||||||
static LIST_HEAD(adapters);
|
|
||||||
static LIST_HEAD(drivers);
|
static LIST_HEAD(drivers);
|
||||||
static DEFINE_MUTEX(core_lists);
|
static DEFINE_MUTEX(core_lists);
|
||||||
static DEFINE_IDR(i2c_adapter_idr);
|
static DEFINE_IDR(i2c_adapter_idr);
|
||||||
|
@ -331,7 +331,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
|
||||||
INIT_LIST_HEAD(&adap->clients);
|
INIT_LIST_HEAD(&adap->clients);
|
||||||
|
|
||||||
mutex_lock(&core_lists);
|
mutex_lock(&core_lists);
|
||||||
list_add_tail(&adap->list, &adapters);
|
|
||||||
|
|
||||||
/* Add the adapter to the driver core.
|
/* Add the adapter to the driver core.
|
||||||
* If the parent pointer is not set up,
|
* If the parent pointer is not set up,
|
||||||
|
@ -368,7 +367,6 @@ out_unlock:
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
out_list:
|
out_list:
|
||||||
list_del(&adap->list);
|
|
||||||
idr_remove(&i2c_adapter_idr, adap->nr);
|
idr_remove(&i2c_adapter_idr, adap->nr);
|
||||||
goto out_unlock;
|
goto out_unlock;
|
||||||
}
|
}
|
||||||
|
@ -473,7 +471,6 @@ EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter);
|
||||||
int i2c_del_adapter(struct i2c_adapter *adap)
|
int i2c_del_adapter(struct i2c_adapter *adap)
|
||||||
{
|
{
|
||||||
struct list_head *item, *_n;
|
struct list_head *item, *_n;
|
||||||
struct i2c_adapter *adap_from_list;
|
|
||||||
struct i2c_driver *driver;
|
struct i2c_driver *driver;
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
int res = 0;
|
int res = 0;
|
||||||
|
@ -481,11 +478,7 @@ int i2c_del_adapter(struct i2c_adapter *adap)
|
||||||
mutex_lock(&core_lists);
|
mutex_lock(&core_lists);
|
||||||
|
|
||||||
/* First make sure that this adapter was ever added */
|
/* First make sure that this adapter was ever added */
|
||||||
list_for_each_entry(adap_from_list, &adapters, list) {
|
if (idr_find(&i2c_adapter_idr, adap->nr) != adap) {
|
||||||
if (adap_from_list == adap)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (adap_from_list != adap) {
|
|
||||||
pr_debug("i2c-core: attempting to delete unregistered "
|
pr_debug("i2c-core: attempting to delete unregistered "
|
||||||
"adapter [%s]\n", adap->name);
|
"adapter [%s]\n", adap->name);
|
||||||
res = -EINVAL;
|
res = -EINVAL;
|
||||||
|
@ -529,7 +522,6 @@ int i2c_del_adapter(struct i2c_adapter *adap)
|
||||||
/* clean up the sysfs representation */
|
/* clean up the sysfs representation */
|
||||||
init_completion(&adap->dev_released);
|
init_completion(&adap->dev_released);
|
||||||
device_unregister(&adap->dev);
|
device_unregister(&adap->dev);
|
||||||
list_del(&adap->list);
|
|
||||||
|
|
||||||
/* wait for sysfs to drop all references */
|
/* wait for sysfs to drop all references */
|
||||||
wait_for_completion(&adap->dev_released);
|
wait_for_completion(&adap->dev_released);
|
||||||
|
@ -592,9 +584,12 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
|
||||||
if (driver->attach_adapter) {
|
if (driver->attach_adapter) {
|
||||||
struct i2c_adapter *adapter;
|
struct i2c_adapter *adapter;
|
||||||
|
|
||||||
list_for_each_entry(adapter, &adapters, list) {
|
down(&i2c_adapter_class.sem);
|
||||||
|
list_for_each_entry(adapter, &i2c_adapter_class.devices,
|
||||||
|
dev.node) {
|
||||||
driver->attach_adapter(adapter);
|
driver->attach_adapter(adapter);
|
||||||
}
|
}
|
||||||
|
up(&i2c_adapter_class.sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_unlock(&core_lists);
|
mutex_unlock(&core_lists);
|
||||||
|
@ -609,7 +604,7 @@ EXPORT_SYMBOL(i2c_register_driver);
|
||||||
*/
|
*/
|
||||||
void i2c_del_driver(struct i2c_driver *driver)
|
void i2c_del_driver(struct i2c_driver *driver)
|
||||||
{
|
{
|
||||||
struct list_head *item1, *item2, *_n;
|
struct list_head *item2, *_n;
|
||||||
struct i2c_client *client;
|
struct i2c_client *client;
|
||||||
struct i2c_adapter *adap;
|
struct i2c_adapter *adap;
|
||||||
|
|
||||||
|
@ -623,8 +618,8 @@ void i2c_del_driver(struct i2c_driver *driver)
|
||||||
* attached. If so, detach them to be able to kill the driver
|
* attached. If so, detach them to be able to kill the driver
|
||||||
* afterwards.
|
* afterwards.
|
||||||
*/
|
*/
|
||||||
list_for_each(item1,&adapters) {
|
down(&i2c_adapter_class.sem);
|
||||||
adap = list_entry(item1, struct i2c_adapter, list);
|
list_for_each_entry(adap, &i2c_adapter_class.devices, dev.node) {
|
||||||
if (driver->detach_adapter) {
|
if (driver->detach_adapter) {
|
||||||
if (driver->detach_adapter(adap)) {
|
if (driver->detach_adapter(adap)) {
|
||||||
dev_err(&adap->dev, "detach_adapter failed "
|
dev_err(&adap->dev, "detach_adapter failed "
|
||||||
|
@ -648,6 +643,7 @@ void i2c_del_driver(struct i2c_driver *driver)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
up(&i2c_adapter_class.sem);
|
||||||
|
|
||||||
unregister:
|
unregister:
|
||||||
driver_unregister(&driver->driver);
|
driver_unregister(&driver->driver);
|
||||||
|
|
|
@ -317,7 +317,6 @@ struct i2c_adapter {
|
||||||
|
|
||||||
int nr;
|
int nr;
|
||||||
struct list_head clients;
|
struct list_head clients;
|
||||||
struct list_head list;
|
|
||||||
char name[48];
|
char name[48];
|
||||||
struct completion dev_released;
|
struct completion dev_released;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue