summaryrefslogtreecommitdiffstats
path: root/drivers/iio/humidity/hts221_spi.c
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo.bianconi@redhat.com>2017-12-30 00:33:04 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-01-08 16:03:43 +0100
commite1ca114100b2b1409193eacc83fd12992eb4be23 (patch)
tree5a4ed604ca0f0d4c21d5462a3000362b42a61bdb /drivers/iio/humidity/hts221_spi.c
parent2e419aec3b86aa76a34cb30ec4865060a6013366 (diff)
downloadblackbird-op-linux-e1ca114100b2b1409193eacc83fd12992eb4be23.tar.gz
blackbird-op-linux-e1ca114100b2b1409193eacc83fd12992eb4be23.zip
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>
Diffstat (limited to 'drivers/iio/humidity/hts221_spi.c')
-rw-r--r--drivers/iio/humidity/hts221_spi.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/drivers/iio/humidity/hts221_spi.c b/drivers/iio/humidity/hts221_spi.c
index 57cbc256771b..55b29b53b9d1 100644
--- a/drivers/iio/humidity/hts221_spi.c
+++ b/drivers/iio/humidity/hts221_spi.c
@@ -80,22 +80,8 @@ static const struct hts221_transfer_function hts221_transfer_fn = {
static int hts221_spi_probe(struct spi_device *spi)
{
- struct hts221_hw *hw;
- struct iio_dev *iio_dev;
-
- iio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*hw));
- if (!iio_dev)
- return -ENOMEM;
-
- spi_set_drvdata(spi, iio_dev);
-
- hw = iio_priv(iio_dev);
- hw->name = spi->modalias;
- hw->dev = &spi->dev;
- hw->irq = spi->irq;
- hw->tf = &hts221_transfer_fn;
-
- return hts221_probe(iio_dev);
+ return hts221_probe(&spi->dev, spi->irq,
+ spi->modalias, &hts221_transfer_fn);
}
static const struct of_device_id hts221_spi_of_match[] = {
OpenPOWER on IntegriCloud