Commit 6b658c31 authored by Alexandru Ardelean's avatar Alexandru Ardelean Committed by Jonathan Cameron
Browse files

iio: st_sensors: remove all driver remove functions



At this point all ST driver remove functions do iio_device_unregister().
This change removes them from them and replaces all iio_device_register()
with devm_iio_device_register().

This can be done in a single change relatively easy, since all these remove
functions are define in st_sensors.h.

Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: default avatarAlexandru Ardelean <aardelean@deviqon.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210823112204.243255-5-aardelean@deviqon.com


Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 5363c6c1
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -1335,6 +1335,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
{
	struct st_sensor_data *adata = iio_priv(indio_dev);
	struct st_sensors_platform_data *pdata = dev_get_platdata(adata->dev);
	struct device *parent = indio_dev->dev.parent;
	int err;

	indio_dev->modes = INDIO_DIRECT_MODE;
@@ -1380,16 +1381,10 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
			return err;
	}

	return iio_device_register(indio_dev);
	return devm_iio_device_register(parent, indio_dev);
}
EXPORT_SYMBOL(st_accel_common_probe);

void st_accel_common_remove(struct iio_dev *indio_dev)
{
	iio_device_unregister(indio_dev);
}
EXPORT_SYMBOL(st_accel_common_remove);

MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
MODULE_DESCRIPTION("STMicroelectronics accelerometers driver");
MODULE_LICENSE("GPL v2");
+0 −10
Original line number Diff line number Diff line
@@ -180,15 +180,6 @@ static int st_accel_i2c_probe(struct i2c_client *client)
	return st_accel_common_probe(indio_dev);
}

static int st_accel_i2c_remove(struct i2c_client *client)
{
	struct iio_dev *indio_dev = i2c_get_clientdata(client);

	st_accel_common_remove(indio_dev);

	return 0;
}

static struct i2c_driver st_accel_driver = {
	.driver = {
		.name = "st-accel-i2c",
@@ -196,7 +187,6 @@ static struct i2c_driver st_accel_driver = {
		.acpi_match_table = ACPI_PTR(st_accel_acpi_match),
	},
	.probe_new = st_accel_i2c_probe,
	.remove = st_accel_i2c_remove,
	.id_table = st_accel_id_table,
};
module_i2c_driver(st_accel_driver);
+0 −10
Original line number Diff line number Diff line
@@ -130,15 +130,6 @@ static int st_accel_spi_probe(struct spi_device *spi)
	return st_accel_common_probe(indio_dev);
}

static int st_accel_spi_remove(struct spi_device *spi)
{
	struct iio_dev *indio_dev = spi_get_drvdata(spi);

	st_accel_common_remove(indio_dev);

	return 0;
}

static const struct spi_device_id st_accel_id_table[] = {
	{ LIS3DH_ACCEL_DEV_NAME },
	{ LSM330D_ACCEL_DEV_NAME },
@@ -166,7 +157,6 @@ static struct spi_driver st_accel_driver = {
		.of_match_table = st_accel_of_match,
	},
	.probe = st_accel_spi_probe,
	.remove = st_accel_spi_remove,
	.id_table = st_accel_id_table,
};
module_spi_driver(st_accel_driver);
+2 −7
Original line number Diff line number Diff line
@@ -478,6 +478,7 @@ int st_gyro_common_probe(struct iio_dev *indio_dev)
{
	struct st_sensor_data *gdata = iio_priv(indio_dev);
	struct st_sensors_platform_data *pdata;
	struct device *parent = indio_dev->dev.parent;
	int err;

	indio_dev->modes = INDIO_DIRECT_MODE;
@@ -515,16 +516,10 @@ int st_gyro_common_probe(struct iio_dev *indio_dev)
			return err;
	}

	return iio_device_register(indio_dev);
	return devm_iio_device_register(parent, indio_dev);
}
EXPORT_SYMBOL(st_gyro_common_probe);

void st_gyro_common_remove(struct iio_dev *indio_dev)
{
	iio_device_unregister(indio_dev);
}
EXPORT_SYMBOL(st_gyro_common_remove);

MODULE_AUTHOR("Denis Ciocca <denis.ciocca@st.com>");
MODULE_DESCRIPTION("STMicroelectronics gyroscopes driver");
MODULE_LICENSE("GPL v2");
+0 −10
Original line number Diff line number Diff line
@@ -93,15 +93,6 @@ static int st_gyro_i2c_probe(struct i2c_client *client,
	return st_gyro_common_probe(indio_dev);
}

static int st_gyro_i2c_remove(struct i2c_client *client)
{
	struct iio_dev *indio_dev = i2c_get_clientdata(client);

	st_gyro_common_remove(indio_dev);

	return 0;
}

static const struct i2c_device_id st_gyro_id_table[] = {
	{ L3G4200D_GYRO_DEV_NAME },
	{ LSM330D_GYRO_DEV_NAME },
@@ -122,7 +113,6 @@ static struct i2c_driver st_gyro_driver = {
		.of_match_table = st_gyro_of_match,
	},
	.probe = st_gyro_i2c_probe,
	.remove = st_gyro_i2c_remove,
	.id_table = st_gyro_id_table,
};
module_i2c_driver(st_gyro_driver);
Loading