All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shreeya Patel <shreeya.patel23498@gmail.com>
To: jic23@kernel.org
Cc: lars@metafoo.de, Michael.Hennerich@analog.com, knaack.h@gmx.de,
	pmeerw@pmeerw.net, gregkh@linuxfoundation.org,
	linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org, jeremyfertic@gmail.com,
	shreeya.patel23498@gmail.com
Subject: [PATCH v3 1/3] Staging: iio: adt7316: Remove irq from bus structure
Date: Sun, 20 Jan 2019 21:06:31 +0530	[thread overview]
Message-ID: <20190120153633.18231-2-shreeya.patel23498@gmail.com> (raw)
In-Reply-To: <20190120153633.18231-1-shreeya.patel23498@gmail.com>

interrupt request is not needed to be present in the bus
structure. It is a good option to pass it as a parameter
in the probe function instead of having it in the bus structure.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
---
 drivers/staging/iio/addac/adt7316-i2c.c |  3 +--
 drivers/staging/iio/addac/adt7316-spi.c |  4 ++--
 drivers/staging/iio/addac/adt7316.c     | 15 +++++++--------
 drivers/staging/iio/addac/adt7316.h     |  3 +--
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316-i2c.c b/drivers/staging/iio/addac/adt7316-i2c.c
index 2d51bd425662..b6571db2e8d8 100644
--- a/drivers/staging/iio/addac/adt7316-i2c.c
+++ b/drivers/staging/iio/addac/adt7316-i2c.c
@@ -99,14 +99,13 @@ static int adt7316_i2c_probe(struct i2c_client *client,
 {
 	struct adt7316_bus bus = {
 		.client = client,
-		.irq = client->irq,
 		.read = adt7316_i2c_read,
 		.write = adt7316_i2c_write,
 		.multi_read = adt7316_i2c_multi_read,
 		.multi_write = adt7316_i2c_multi_write,
 	};
 
-	return adt7316_probe(&client->dev, &bus, id->name);
+	return adt7316_probe(&client->dev, &bus, id->name, client->irq);
 }
 
 static const struct i2c_device_id adt7316_i2c_id[] = {
diff --git a/drivers/staging/iio/addac/adt7316-spi.c b/drivers/staging/iio/addac/adt7316-spi.c
index e75827e326a6..adaaa3eecd04 100644
--- a/drivers/staging/iio/addac/adt7316-spi.c
+++ b/drivers/staging/iio/addac/adt7316-spi.c
@@ -93,7 +93,6 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
 {
 	struct adt7316_bus bus = {
 		.client = spi_dev,
-		.irq = spi_dev->irq,
 		.read = adt7316_spi_read,
 		.write = adt7316_spi_write,
 		.multi_read = adt7316_spi_multi_read,
@@ -112,7 +111,8 @@ static int adt7316_spi_probe(struct spi_device *spi_dev)
 	adt7316_spi_write(spi_dev, 0, 0);
 	adt7316_spi_write(spi_dev, 0, 0);
 
-	return adt7316_probe(&spi_dev->dev, &bus, spi_dev->modalias);
+	return adt7316_probe(&spi_dev->dev, &bus, spi_dev->modalias,
+			     spi_dev->irq);
 }
 
 static const struct spi_device_id adt7316_spi_id[] = {
diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index 8cf3ff25eb62..30808a897fc2 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -1809,12 +1809,12 @@ static irqreturn_t adt7316_event_handler(int irq, void *private)
 	return IRQ_HANDLED;
 }
 
-static int adt7316_setup_irq(struct iio_dev *indio_dev)
+static int adt7316_setup_irq(struct iio_dev *indio_dev, int irq)
 {
 	struct adt7316_chip_info *chip = iio_priv(indio_dev);
 	int irq_type, ret;
 
-	irq_type = irqd_get_trigger_type(irq_get_irq_data(chip->bus.irq));
+	irq_type = irqd_get_trigger_type(irq_get_irq_data(irq));
 
 	switch (irq_type) {
 	case IRQF_TRIGGER_HIGH:
@@ -1830,13 +1830,12 @@ static int adt7316_setup_irq(struct iio_dev *indio_dev)
 		break;
 	}
 
-	ret = devm_request_threaded_irq(&indio_dev->dev, chip->bus.irq,
+	ret = devm_request_threaded_irq(&indio_dev->dev, irq,
 					NULL, adt7316_event_handler,
 					irq_type | IRQF_ONESHOT,
 					indio_dev->name, indio_dev);
 	if (ret) {
-		dev_err(&indio_dev->dev, "failed to request irq %d\n",
-			chip->bus.irq);
+		dev_err(&indio_dev->dev, "failed to request irq %d\n", irq);
 		return ret;
 	}
 
@@ -2136,7 +2135,7 @@ static const struct iio_info adt7516_info = {
  * device probe and remove
  */
 int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
-		  const char *name)
+		  const char *name, int irq)
 {
 	struct adt7316_chip_info *chip;
 	struct iio_dev *indio_dev;
@@ -2182,8 +2181,8 @@ int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
 	indio_dev->name = name;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
-	if (chip->bus.irq > 0) {
-		ret = adt7316_setup_irq(indio_dev);
+	if (irq > 0) {
+		ret = adt7316_setup_irq(indio_dev, irq);
 		if (ret)
 			return ret;
 	}
diff --git a/drivers/staging/iio/addac/adt7316.h b/drivers/staging/iio/addac/adt7316.h
index 84ca4f6c88f5..03d5300a98cd 100644
--- a/drivers/staging/iio/addac/adt7316.h
+++ b/drivers/staging/iio/addac/adt7316.h
@@ -16,7 +16,6 @@
 
 struct adt7316_bus {
 	void *client;
-	int irq;
 	int (*read)(void *client, u8 reg, u8 *data);
 	int (*write)(void *client, u8 reg, u8 val);
 	int (*multi_read)(void *client, u8 first_reg, u8 count, u8 *data);
@@ -30,6 +29,6 @@ extern const struct dev_pm_ops adt7316_pm_ops;
 #define ADT7316_PM_OPS NULL
 #endif
 int adt7316_probe(struct device *dev, struct adt7316_bus *bus,
-		  const char *name);
+		  const char *name, int irq);
 
 #endif
-- 
2.17.1


  reply	other threads:[~2019-01-20 15:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-20 15:36 [PATCH v3 0/3] adt7316 regmap implementation Shreeya Patel
2019-01-20 15:36 ` Shreeya Patel [this message]
2019-01-20 15:36 ` [PATCH v3 2/3] Staging: iio: adt7316: Remove multi read and write functions Shreeya Patel
2019-01-20 15:36 ` [PATCH v3 3/3] Staging: iio: adt7316: Add regmap support Shreeya Patel
2019-01-26  1:22 ` [PATCH v3 0/3] adt7316 regmap implementation Jeremy Fertic
2019-01-26  5:12   ` Shreeya Patel
2019-01-26  6:18     ` Shreeya Patel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190120153633.18231-2-shreeya.patel23498@gmail.com \
    --to=shreeya.patel23498@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jeremyfertic@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.