Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19baba4c authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Wolfram Sang
Browse files

i2c: Remove detach_adapter



The detach_adapter callback has been deprecated for quite some time and has no
user left. Keeping it alive blocks other cleanups, so remove it.

Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Reviewed-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent 600abead
Loading
Loading
Loading
Loading
+10 −23
Original line number Original line Diff line number Diff line
@@ -49,7 +49,7 @@


/* core_lock protects i2c_adapter_idr, and guarantees
/* core_lock protects i2c_adapter_idr, and guarantees
   that device detection, deletion of detected devices, and attach_adapter
   that device detection, deletion of detected devices, and attach_adapter
   and detach_adapter calls are serialized */
   calls are serialized */
static DEFINE_MUTEX(core_lock);
static DEFINE_MUTEX(core_lock);
static DEFINE_IDR(i2c_adapter_idr);
static DEFINE_IDR(i2c_adapter_idr);


@@ -1172,11 +1172,10 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adap)
}
}
EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter);
EXPORT_SYMBOL_GPL(i2c_add_numbered_adapter);


static int i2c_do_del_adapter(struct i2c_driver *driver,
static void i2c_do_del_adapter(struct i2c_driver *driver,
			      struct i2c_adapter *adapter)
			      struct i2c_adapter *adapter)
{
{
	struct i2c_client *client, *_n;
	struct i2c_client *client, *_n;
	int res;


	/* Remove the devices we created ourselves as the result of hardware
	/* Remove the devices we created ourselves as the result of hardware
	 * probing (using a driver's detect method) */
	 * probing (using a driver's detect method) */
@@ -1188,16 +1187,6 @@ static int i2c_do_del_adapter(struct i2c_driver *driver,
			i2c_unregister_device(client);
			i2c_unregister_device(client);
		}
		}
	}
	}

	if (!driver->detach_adapter)
		return 0;
	dev_warn(&adapter->dev, "%s: detach_adapter method is deprecated\n",
		 driver->driver.name);
	res = driver->detach_adapter(adapter);
	if (res)
		dev_err(&adapter->dev, "detach_adapter failed (%d) "
			"for driver [%s]\n", res, driver->driver.name);
	return res;
}
}


static int __unregister_client(struct device *dev, void *dummy)
static int __unregister_client(struct device *dev, void *dummy)
@@ -1218,7 +1207,8 @@ static int __unregister_dummy(struct device *dev, void *dummy)


static int __process_removed_adapter(struct device_driver *d, void *data)
static int __process_removed_adapter(struct device_driver *d, void *data)
{
{
	return i2c_do_del_adapter(to_i2c_driver(d), data);
	i2c_do_del_adapter(to_i2c_driver(d), data);
	return 0;
}
}


/**
/**
@@ -1231,7 +1221,6 @@ static int __process_removed_adapter(struct device_driver *d, void *data)
 */
 */
int i2c_del_adapter(struct i2c_adapter *adap)
int i2c_del_adapter(struct i2c_adapter *adap)
{
{
	int res = 0;
	struct i2c_adapter *found;
	struct i2c_adapter *found;
	struct i2c_client *client, *next;
	struct i2c_client *client, *next;


@@ -1247,11 +1236,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)


	/* Tell drivers about this removal */
	/* Tell drivers about this removal */
	mutex_lock(&core_lock);
	mutex_lock(&core_lock);
	res = bus_for_each_drv(&i2c_bus_type, NULL, adap,
	bus_for_each_drv(&i2c_bus_type, NULL, adap,
			       __process_removed_adapter);
			       __process_removed_adapter);
	mutex_unlock(&core_lock);
	mutex_unlock(&core_lock);
	if (res)
		return res;


	/* Remove devices instantiated from sysfs */
	/* Remove devices instantiated from sysfs */
	mutex_lock_nested(&adap->userspace_clients_lock,
	mutex_lock_nested(&adap->userspace_clients_lock,
@@ -1270,8 +1257,8 @@ int i2c_del_adapter(struct i2c_adapter *adap)
	 * we can't remove the dummy devices during the first pass: they
	 * we can't remove the dummy devices during the first pass: they
	 * could have been instantiated by real devices wishing to clean
	 * could have been instantiated by real devices wishing to clean
	 * them up properly, so we give them a chance to do that first. */
	 * them up properly, so we give them a chance to do that first. */
	res = device_for_each_child(&adap->dev, NULL, __unregister_client);
	device_for_each_child(&adap->dev, NULL, __unregister_client);
	res = device_for_each_child(&adap->dev, NULL, __unregister_dummy);
	device_for_each_child(&adap->dev, NULL, __unregister_dummy);


#ifdef CONFIG_I2C_COMPAT
#ifdef CONFIG_I2C_COMPAT
	class_compat_remove_link(i2c_adapter_compat_class, &adap->dev,
	class_compat_remove_link(i2c_adapter_compat_class, &adap->dev,
@@ -1367,9 +1354,9 @@ EXPORT_SYMBOL(i2c_register_driver);


static int __process_removed_driver(struct device *dev, void *data)
static int __process_removed_driver(struct device *dev, void *data)
{
{
	if (dev->type != &i2c_adapter_type)
	if (dev->type == &i2c_adapter_type)
		i2c_do_del_adapter(data, to_i2c_adapter(dev));
	return 0;
	return 0;
	return i2c_do_del_adapter(data, to_i2c_adapter(dev));
}
}


/**
/**
+2 −5
Original line number Original line Diff line number Diff line
@@ -125,7 +125,6 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
 * struct i2c_driver - represent an I2C device driver
 * struct i2c_driver - represent an I2C device driver
 * @class: What kind of i2c device we instantiate (for detect)
 * @class: What kind of i2c device we instantiate (for detect)
 * @attach_adapter: Callback for bus addition (deprecated)
 * @attach_adapter: Callback for bus addition (deprecated)
 * @detach_adapter: Callback for bus removal (deprecated)
 * @probe: Callback for device binding
 * @probe: Callback for device binding
 * @remove: Callback for device unbinding
 * @remove: Callback for device unbinding
 * @shutdown: Callback for device shutdown
 * @shutdown: Callback for device shutdown
@@ -162,12 +161,10 @@ extern s32 i2c_smbus_write_i2c_block_data(const struct i2c_client *client,
struct i2c_driver {
struct i2c_driver {
	unsigned int class;
	unsigned int class;


	/* Notifies the driver that a new bus has appeared or is about to be
	/* Notifies the driver that a new bus has appeared. You should avoid
	 * removed. You should avoid using this, it will be removed in a
	 * using this, it will be removed in a near future.
	 * near future.
	 */
	 */
	int (*attach_adapter)(struct i2c_adapter *) __deprecated;
	int (*attach_adapter)(struct i2c_adapter *) __deprecated;
	int (*detach_adapter)(struct i2c_adapter *) __deprecated;


	/* Standard driver model interfaces */
	/* Standard driver model interfaces */
	int (*probe)(struct i2c_client *, const struct i2c_device_id *);
	int (*probe)(struct i2c_client *, const struct i2c_device_id *);