iio: humidity: hts221: move common code in hts221_core
Move duplicated i2c/spi probe code in hts221_probe() Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
2e419aec3b
commit
e1ca114100
@@ -66,22 +66,8 @@ static const struct hts221_transfer_function hts221_transfer_fn = {
|
||||
static int hts221_i2c_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *id)
|
||||
{
|
||||
struct hts221_hw *hw;
|
||||
struct iio_dev *iio_dev;
|
||||
|
||||
iio_dev = devm_iio_device_alloc(&client->dev, sizeof(*hw));
|
||||
if (!iio_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
i2c_set_clientdata(client, iio_dev);
|
||||
|
||||
hw = iio_priv(iio_dev);
|
||||
hw->name = client->name;
|
||||
hw->dev = &client->dev;
|
||||
hw->irq = client->irq;
|
||||
hw->tf = &hts221_transfer_fn;
|
||||
|
||||
return hts221_probe(iio_dev);
|
||||
return hts221_probe(&client->dev, client->irq,
|
||||
client->name, &hts221_transfer_fn);
|
||||
}
|
||||
|
||||
static const struct acpi_device_id hts221_acpi_match[] = {
|
||||
|
Reference in New Issue
Block a user