All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Ranostay <matt.ranostay@konsulko.com>
To: jic23@kernel.org, gupt21@gmail.com,
	benjamin.tissoires@redhat.com, jikos@kernel.org
Cc: linux-iio@vger.kernel.org, linux-input@vger.kernel.org,
	Matt Ranostay <matt.ranostay@konsulko.com>
Subject: [PATCH v6 2/3] HID: mcp2221: change 'select GPIOLIB' to imply
Date: Fri, 30 Sep 2022 17:52:07 -0700	[thread overview]
Message-ID: <20221001005208.8010-3-matt.ranostay@konsulko.com> (raw)
In-Reply-To: <20221001005208.8010-1-matt.ranostay@konsulko.com>

To avoid recursive dependencies on GPIOLIB when 'imply IIO' is requested
with other drivers we should switch GPIOLIB to an imply.

This isn't the most ideal solution but avoids modifiying the Kconfig for
other drivers, and only requires a singular IS_REACHABLE(CONFIG_GPIOLIB)
check.

Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
---
 drivers/hid/Kconfig       | 2 +-
 drivers/hid/hid-mcp2221.c | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index 185a077d59cd..745fc38794ad 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -1252,7 +1252,7 @@ config HID_ALPS
 config HID_MCP2221
 	tristate "Microchip MCP2221 HID USB-to-I2C/SMbus host support"
 	depends on USB_HID && I2C
-	depends on GPIOLIB
+	imply GPIOLIB
 	help
 	Provides I2C and SMBUS host adapter functionality over USB-HID
 	through MCP2221 device.
diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c
index 4d10a24e3e13..fb54f1c6fd9c 100644
--- a/drivers/hid/hid-mcp2221.c
+++ b/drivers/hid/hid-mcp2221.c
@@ -915,9 +915,11 @@ static int mcp2221_probe(struct hid_device *hdev,
 	mcp->gc->can_sleep = 1;
 	mcp->gc->parent = &hdev->dev;
 
+#if IS_REACHABLE(CONFIG_GPIOLIB)
 	ret = devm_gpiochip_add_data(&hdev->dev, mcp->gc, mcp);
 	if (ret)
 		return ret;
+#endif
 
 	return 0;
 }
-- 
2.37.2


  parent reply	other threads:[~2022-10-01  0:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-01  0:52 [PATCH v6 0/3] HID: mcp2221: iio support and device resource management Matt Ranostay
2022-10-01  0:52 ` [PATCH v6 1/3] HID: mcp2221: switch i2c registration to devm functions Matt Ranostay
2022-10-01  0:52 ` Matt Ranostay [this message]
2022-10-21 11:50   ` [PATCH v6 2/3] HID: mcp2221: change 'select GPIOLIB' to imply Benjamin Tissoires
2022-10-21 12:12     ` Jiri Kosina
2022-10-21 12:29       ` Benjamin Tissoires
2022-10-01  0:52 ` [PATCH v6 3/3] HID: mcp2221: add ADC/DAC support via iio subsystem Matt Ranostay
2022-10-02 13:50   ` Jonathan Cameron
2022-10-18 13:00     ` Jiri Kosina

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=20221001005208.8010-3-matt.ranostay@konsulko.com \
    --to=matt.ranostay@konsulko.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=gupt21@gmail.com \
    --cc=jic23@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    /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.