mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2 0/2] i2c: i2c-gpio: Support buses with shared SDA
@ 2026-12-02 13:15 Anatoliy Oleinikov via B4 Relay
  2026-12-02 13:15 ` [PATCH v2 1/2] i2c: i2c-gpio: Release a shared SCL before it can be requested again Anatoliy Oleinikov via B4 Relay
  2026-12-02 13:15 ` [PATCH v2 2/2] i2c: i2c-gpio: Enhance driver for buses with shared SDA Anatoliy Oleinikov via B4 Relay
  0 siblings, 2 replies; 3+ messages in thread
From: Anatoliy Oleinikov via B4 Relay @ 2026-12-02 13:15 UTC (permalink / raw)
  To: Andi Shyti, linux-i2c
  Cc: Wolfram Sang, Markus Stockhausen, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-kernel,
	Anatoliy Oleinikov

Some Realtek based switches share the data line instead of the clock
line among the I2C buses of their SFP cages: the Acorid GLS7700-24F8G-4X
has an SCL per cage and an SDA per four cages. The second patch extends
the shared SCL support of i2c-gpio to SDA. The first one fixes a race in
the release of a shared SCL that the second would make more likely.

---
Changes in v2:
- New patch 1: Release a shared SCL before it can be requested again,
  found by the Sashiko review of v1.
- Patch 2: release a shared line the same way.
- Link to v1: https://patch.msgid.link/20261202-i2c-gpio-shared-sda-v1-1-8b411d498d14@wizle.tech

---
Anatoliy Oleinikov (2):
      i2c: i2c-gpio: Release a shared SCL before it can be requested again
      i2c: i2c-gpio: Enhance driver for buses with shared SDA

 drivers/i2c/busses/i2c-gpio.c | 190 +++++++++++++++++++++++++-----------------
 1 file changed, 113 insertions(+), 77 deletions(-)
---
base-commit: 177501be260dae21d8b095a4ec4c98714a4d9c68
change-id: 20261202-i2c-gpio-shared-sda-afbd172a9c74

Best regards,
--  
Anatoliy Oleinikov <admin@wizle.tech>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 1/2] i2c: i2c-gpio: Release a shared SCL before it can be requested again
  2026-12-02 13:15 [PATCH v2 0/2] i2c: i2c-gpio: Support buses with shared SDA Anatoliy Oleinikov via B4 Relay
@ 2026-12-02 13:15 ` Anatoliy Oleinikov via B4 Relay
  2026-12-02 13:15 ` [PATCH v2 2/2] i2c: i2c-gpio: Enhance driver for buses with shared SDA Anatoliy Oleinikov via B4 Relay
  1 sibling, 0 replies; 3+ messages in thread
From: Anatoliy Oleinikov via B4 Relay @ 2026-12-02 13:15 UTC (permalink / raw)
  To: Andi Shyti, linux-i2c
  Cc: Wolfram Sang, Markus Stockhausen, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-kernel,
	Anatoliy Oleinikov

From: Anatoliy Oleinikov <admin@wizle.tech>

Releasing the last reference to a shared SCL removes it from the list
and drops the list lock before it releases the GPIO. An adapter sharing
the pin that probes in between finds no entry and requests the GPIO,
which is still held, so its probe fails with -EBUSY instead of deferring.

Release the GPIO while the list lock is still held.

Fixes: 645c3d7d07fa ("i2c: i2c-gpio: Enhance driver for buses with shared SCL")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Anatoliy Oleinikov <admin@wizle.tech>
---
 drivers/i2c/busses/i2c-gpio.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 56d6847cbf6d..552fcbb1eaed 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -512,8 +512,9 @@ static void i2c_gpio_cleanup_scl(struct i2c_gpio_scl_data *scl)
 		return;
 
 	list_del(&scl->list);
-	mutex_unlock(&i2c_gpio_scl_list_lock);
+	/* An adapter that finds no entry requests the pin, so it must be free by then */
 	gpiod_put(scl->gpio);
+	mutex_unlock(&i2c_gpio_scl_list_lock);
 	i2c_gpio_free_scl(scl);
 }
 

-- 
Git-157)



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2 2/2] i2c: i2c-gpio: Enhance driver for buses with shared SDA
  2026-12-02 13:15 [PATCH v2 0/2] i2c: i2c-gpio: Support buses with shared SDA Anatoliy Oleinikov via B4 Relay
  2026-12-02 13:15 ` [PATCH v2 1/2] i2c: i2c-gpio: Release a shared SCL before it can be requested again Anatoliy Oleinikov via B4 Relay
@ 2026-12-02 13:15 ` Anatoliy Oleinikov via B4 Relay
  1 sibling, 0 replies; 3+ messages in thread
From: Anatoliy Oleinikov via B4 Relay @ 2026-12-02 13:15 UTC (permalink / raw)
  To: Andi Shyti, linux-i2c
  Cc: Wolfram Sang, Markus Stockhausen, Linus Walleij,
	Bartosz Golaszewski, linux-gpio, linux-kernel,
	Anatoliy Oleinikov

From: Anatoliy Oleinikov <admin@wizle.tech>

Some Realtek based switches share the data line instead of the clock
line among the I2C buses of their SFP cages. E.g. the Acorid
GLS7700-24F8G-4X drives 24 SFP cages through three RTL8231 GPIO
expanders. Each cage has its own SCL, while every four cages share
one SDA.

Generalize the shared SCL handling so that it covers both lines.

- Turn the shared SCL structure and its helpers into line based ones.
  The connection id, the index into the legacy "gpios" property and
  the lockdep class are passed in. SDA is detected, requested and
  reference counted exactly like SCL: by the phandle and all
  additional cells of its devicetree reference.

- A pin can be shared as SCL or as SDA, but not as both. Such a
  devicetree is rejected with -EINVAL.

- The custom lock_ops take the adapter bus lock, the SCL mutex and
  then the SDA mutex, and release them in reverse order. This
  serializes all buses that share either line. The SCL and SDA
  mutexes have separate lockdep classes and are always taken in the
  same order, so the nesting cannot deadlock.

- Skip the i2c-algo-bit bus test when SDA can be shared, as it
  already is for SCL. The test toggles the lines without the bus lock.

Buses without a shared SDA behave as before. Their SDA mutex is
private to the adapter and never contended.

Tested on the Acorid GLS7700-24F8G-4X with an OpenWrt 6.18 kernel that
carries the shared SCL backport and this change, with kzalloc() for
kzalloc_obj(): the EEPROM of a module read the same 50 times in a row
while the other three cages on its SDA were probed in parallel.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Anatoliy Oleinikov <admin@wizle.tech>
---
 drivers/i2c/busses/i2c-gpio.c | 189 +++++++++++++++++++++++++-----------------
 1 file changed, 112 insertions(+), 77 deletions(-)

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 552fcbb1eaed..315a46ee64c2 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -18,12 +18,18 @@
 #include <linux/property.h>
 #include <linux/slab.h>
 
-static LIST_HEAD(i2c_gpio_scl_list);
-static DEFINE_MUTEX(i2c_gpio_scl_list_lock);
+static LIST_HEAD(i2c_gpio_line_list);
+static DEFINE_MUTEX(i2c_gpio_line_list_lock);
 static struct lock_class_key i2c_gpio_scl_lock_key;
+static struct lock_class_key i2c_gpio_sda_lock_key;
 
-struct i2c_gpio_scl_data {
+/*
+ * An SCL or SDA line, possibly shared by several buses. A transfer holds the lock of its SCL
+ * line and then that of its SDA line, so buses sharing either line are serialized.
+ */
+struct i2c_gpio_line_data {
 	struct fwnode_reference_args args;
+	const char *con_id;
 	struct gpio_desc *gpio;
 	struct rt_mutex lock;
 	struct list_head list;
@@ -31,8 +37,8 @@ struct i2c_gpio_scl_data {
 };
 
 struct i2c_gpio_private_data {
-	struct gpio_desc *sda;
-	struct i2c_gpio_scl_data *scl;
+	struct i2c_gpio_line_data *sda;
+	struct i2c_gpio_line_data *scl;
 	struct i2c_adapter adap;
 	struct i2c_algo_bit_data bit_data;
 	struct i2c_gpio_platform_data pdata;
@@ -57,7 +63,7 @@ static void i2c_gpio_setsda_val(void *data, int state)
 {
 	struct i2c_gpio_private_data *priv = data;
 
-	gpiod_set_value_cansleep(priv->sda, state);
+	gpiod_set_value_cansleep(priv->sda->gpio, state);
 }
 
 /*
@@ -77,7 +83,7 @@ static int i2c_gpio_getsda(void *data)
 {
 	struct i2c_gpio_private_data *priv = data;
 
-	return gpiod_get_value_cansleep(priv->sda);
+	return gpiod_get_value_cansleep(priv->sda->gpio);
 }
 
 static int i2c_gpio_getscl(void *data)
@@ -89,17 +95,28 @@ static int i2c_gpio_getscl(void *data)
 
 static void i2c_gpio_lock_bus(struct i2c_adapter *adap, unsigned int flags)
 {
+	struct i2c_gpio_private_data *priv = adap_to_priv(adap);
+
 	/* Take care about adapter lock. See i2c_adapter_lock_bus() and others. */
 	rt_mutex_lock_nested(&adap->bus_lock, i2c_adapter_depth(adap));
-	rt_mutex_lock(&adap_to_priv(adap)->scl->lock);
+	rt_mutex_lock(&priv->scl->lock);
+	rt_mutex_lock(&priv->sda->lock);
 }
 
 static int i2c_gpio_trylock_bus(struct i2c_adapter *adap, unsigned int flags)
 {
+	struct i2c_gpio_private_data *priv = adap_to_priv(adap);
+
 	if (!rt_mutex_trylock(&adap->bus_lock))
 		return 0;
 
-	if (!rt_mutex_trylock(&adap_to_priv(adap)->scl->lock)) {
+	if (!rt_mutex_trylock(&priv->scl->lock)) {
+		rt_mutex_unlock(&adap->bus_lock);
+		return 0;
+	}
+
+	if (!rt_mutex_trylock(&priv->sda->lock)) {
+		rt_mutex_unlock(&priv->scl->lock);
 		rt_mutex_unlock(&adap->bus_lock);
 		return 0;
 	}
@@ -109,7 +126,10 @@ static int i2c_gpio_trylock_bus(struct i2c_adapter *adap, unsigned int flags)
 
 static void i2c_gpio_unlock_bus(struct i2c_adapter *adap, unsigned int flags)
 {
-	rt_mutex_unlock(&adap_to_priv(adap)->scl->lock);
+	struct i2c_gpio_private_data *priv = adap_to_priv(adap);
+
+	rt_mutex_unlock(&priv->sda->lock);
+	rt_mutex_unlock(&priv->scl->lock);
 	rt_mutex_unlock(&adap->bus_lock);
 }
 
@@ -358,8 +378,8 @@ static struct gpio_desc *i2c_gpio_get_desc(struct device *dev,
 	int ret;
 
 	/*
-	 * Don't use resource-managed functions. SCL may be shared across adapters and has
-	 * its own lifetime management. SDA uses the same path for consistency.
+	 * Don't use resource-managed functions. SCL and SDA may be shared across adapters and
+	 * have their own lifetime management.
 	 */
 	retdesc = gpiod_get(dev, con_id, gflags);
 	if (!IS_ERR(retdesc)) {
@@ -389,26 +409,30 @@ static struct gpio_desc *i2c_gpio_get_desc(struct device *dev,
 	return retdesc;
 }
 
-static struct i2c_gpio_scl_data *i2c_gpio_create_scl(struct device *dev)
+static struct i2c_gpio_line_data *i2c_gpio_create_line(struct device *dev, const char *con_id,
+						       unsigned int index,
+						       struct lock_class_key *key)
 {
 	struct fwnode_handle *fwnode = dev_fwnode(dev);
+	char propname[sizeof("scl-gpios")];
 	struct fwnode_reference_args args;
-	struct i2c_gpio_scl_data *scl;
+	struct i2c_gpio_line_data *line;
 	bool sharable = false;
 	int ret;
 
 	/*
-	 * SCL gpios can be shared if they are defined in the devicetree and have at least one
-	 * cell in addition to the phandle. This is usually the pin. To support complex designs
+	 * SCL and SDA gpios can be shared if they are defined in the devicetree and have at least
+	 * one cell in addition to the phandle. This is usually the pin. To support complex designs
 	 * with arbitrary of_xlate() mappings handle the node cells opaque.
 	 */
 	if (fwnode) {
-		ret = fwnode_property_get_reference_args(fwnode, "scl-gpios",
+		snprintf(propname, sizeof(propname), "%s-gpios", con_id);
+		ret = fwnode_property_get_reference_args(fwnode, propname,
 							 "#gpio-cells", 0, 0, &args);
 		if (ret)
 			/* try the ancient way */
 			ret = fwnode_property_get_reference_args(fwnode, "gpios",
-								 "#gpio-cells", 0, 1, &args);
+								 "#gpio-cells", 0, index, &args);
 
 		if (!ret) {
 			if (args.nargs >= 1)
@@ -418,34 +442,35 @@ static struct i2c_gpio_scl_data *i2c_gpio_create_scl(struct device *dev)
 		}
 	}
 
-	scl = kzalloc_obj(*scl);
-	if (!scl) {
+	line = kzalloc_obj(*line);
+	if (!line) {
 		if (sharable)
 			fwnode_handle_put(args.fwnode);
 		return ERR_PTR(-ENOMEM);
 	}
 
 	if (sharable) {
-		scl->args.fwnode = args.fwnode;
-		scl->args.nargs = args.nargs;
-		memcpy(scl->args.args, args.args, sizeof(args.args[0]) * args.nargs);
+		line->args.fwnode = args.fwnode;
+		line->args.nargs = args.nargs;
+		memcpy(line->args.args, args.args, sizeof(args.args[0]) * args.nargs);
 	}
 
-	rt_mutex_init(&scl->lock);
-	lockdep_set_class(&scl->lock, &i2c_gpio_scl_lock_key);
-	refcount_set(&scl->ref, 1);
+	line->con_id = con_id;
+	rt_mutex_init(&line->lock);
+	lockdep_set_class(&line->lock, key);
+	refcount_set(&line->ref, 1);
 
-	return scl;
+	return line;
 }
 
-static void i2c_gpio_free_scl(struct i2c_gpio_scl_data *scl)
+static void i2c_gpio_free_line(struct i2c_gpio_line_data *line)
 {
-	if (scl->args.fwnode)
-		fwnode_handle_put(scl->args.fwnode);
-	kfree(scl);
+	if (line->args.fwnode)
+		fwnode_handle_put(line->args.fwnode);
+	kfree(line);
 }
 
-static bool i2c_gpio_scl_matches(struct i2c_gpio_scl_data *a, struct i2c_gpio_scl_data *b)
+static bool i2c_gpio_line_matches(struct i2c_gpio_line_data *a, struct i2c_gpio_line_data *b)
 {
 	if (!a->args.fwnode || !b->args.fwnode ||
 	    a->args.fwnode != b->args.fwnode || a->args.nargs != b->args.nargs)
@@ -455,67 +480,77 @@ static bool i2c_gpio_scl_matches(struct i2c_gpio_scl_data *a, struct i2c_gpio_sc
 }
 
 /*
- * Look up an existing or create a new shared SCL structure. Optimistic setup sequence always
- * creates and tries to add a new entry to the list. This uses minimum locking and afterwards
- * requests the GPIO without a lock held. Concurrent probes for the same SCL pin see the entry
- * and do not race into a second gpiod_get(). Until everything is setup they terminate with
- * -EPROBE_DEFER.
+ * Look up an existing or create a new shared SCL or SDA structure. Optimistic setup sequence
+ * always creates and tries to add a new entry to the list. This uses minimum locking and
+ * afterwards requests the GPIO without a lock held. Concurrent probes for the same pin see the
+ * entry and do not race into a second gpiod_get(). Until everything is setup they terminate with
+ * -EPROBE_DEFER. A pin can be shared as SCL or as SDA, but not as both.
  */
-static struct i2c_gpio_scl_data *i2c_gpio_lookup_scl(struct device *dev, enum gpiod_flags gflags)
+static struct i2c_gpio_line_data *i2c_gpio_lookup_line(struct device *dev, const char *con_id,
+						       unsigned int index,
+						       struct lock_class_key *key,
+						       enum gpiod_flags gflags)
 {
-	struct i2c_gpio_scl_data *scl, *new_scl;
+	struct i2c_gpio_line_data *line, *new_line;
 	struct gpio_desc *gpio;
 
-	new_scl = i2c_gpio_create_scl(dev);
-	if (IS_ERR(new_scl))
-		return new_scl;
+	new_line = i2c_gpio_create_line(dev, con_id, index, key);
+	if (IS_ERR(new_line))
+		return new_line;
 
-	scoped_guard(mutex, &i2c_gpio_scl_list_lock) {
-		list_for_each_entry(scl, &i2c_gpio_scl_list, list) {
-			if (!i2c_gpio_scl_matches(scl, new_scl))
+	scoped_guard(mutex, &i2c_gpio_line_list_lock) {
+		list_for_each_entry(line, &i2c_gpio_line_list, list) {
+			if (!i2c_gpio_line_matches(line, new_line))
 				continue;
 
-			i2c_gpio_free_scl(new_scl);
-			if (!scl->gpio)
+			i2c_gpio_free_line(new_line);
+			if (strcmp(line->con_id, con_id)) {
+				dev_err(dev, "%s pin (%pfwP %llu) already used as %s\n", con_id,
+					line->args.fwnode, line->args.args[0], line->con_id);
+				return ERR_PTR(-EINVAL);
+			}
+
+			if (!line->gpio)
 				return ERR_PTR(-EPROBE_DEFER);
 
-			refcount_inc(&scl->ref);
-			if (scl->args.fwnode)
-				dev_dbg(dev, "reusing shared SCL (%pfwP)\n", scl->args.fwnode);
+			refcount_inc(&line->ref);
+			if (line->args.fwnode)
+				dev_dbg(dev, "reusing shared %s (%pfwP)\n", con_id,
+					line->args.fwnode);
 
-			return scl;
+			return line;
 		}
-		list_add(&new_scl->list, &i2c_gpio_scl_list);
+		list_add(&new_line->list, &i2c_gpio_line_list);
 	}
 
-	gpio = i2c_gpio_get_desc(dev, "scl", 1, gflags);
+	gpio = i2c_gpio_get_desc(dev, con_id, index, gflags);
 	if (IS_ERR(gpio)) {
-		scoped_guard(mutex, &i2c_gpio_scl_list_lock)
-			list_del(&new_scl->list);
-		i2c_gpio_free_scl(new_scl);
+		scoped_guard(mutex, &i2c_gpio_line_list_lock)
+			list_del(&new_line->list);
+		i2c_gpio_free_line(new_line);
 
 		return ERR_CAST(gpio);
 	}
 
-	scoped_guard(mutex, &i2c_gpio_scl_list_lock)
-		new_scl->gpio = gpio;
+	scoped_guard(mutex, &i2c_gpio_line_list_lock)
+		new_line->gpio = gpio;
 
-	if (new_scl->args.fwnode)
-		dev_dbg(dev, "registered shared SCL (%pfwP)\n", new_scl->args.fwnode);
+	if (new_line->args.fwnode)
+		dev_dbg(dev, "registered shared %s (%pfwP)\n", con_id, new_line->args.fwnode);
 
-	return new_scl;
+	return new_line;
 }
 
-static void i2c_gpio_cleanup_scl(struct i2c_gpio_scl_data *scl)
+static void i2c_gpio_cleanup_line(struct i2c_gpio_line_data *line)
 {
-	if (!refcount_dec_and_mutex_lock(&scl->ref, &i2c_gpio_scl_list_lock))
+	if (!refcount_dec_and_mutex_lock(&line->ref, &i2c_gpio_line_list_lock))
 		return;
 
-	list_del(&scl->list);
+	list_del(&line->list);
 	/* An adapter that finds no entry requests the pin, so it must be free by then */
-	gpiod_put(scl->gpio);
-	mutex_unlock(&i2c_gpio_scl_list_lock);
-	i2c_gpio_free_scl(scl);
+	gpiod_put(line->gpio);
+	mutex_unlock(&i2c_gpio_line_list_lock);
+	i2c_gpio_free_line(line);
 }
 
 static int i2c_gpio_probe(struct platform_device *pdev)
@@ -560,7 +595,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)
 		gflags = GPIOD_OUT_HIGH;
 	else
 		gflags = GPIOD_OUT_HIGH_OPEN_DRAIN;
-	priv->sda = i2c_gpio_get_desc(dev, "sda", 0, gflags);
+	priv->sda = i2c_gpio_lookup_line(dev, "sda", 0, &i2c_gpio_sda_lock_key, gflags);
 	if (IS_ERR(priv->sda))
 		return PTR_ERR(priv->sda);
 
@@ -568,18 +603,18 @@ static int i2c_gpio_probe(struct platform_device *pdev)
 		gflags = GPIOD_OUT_HIGH;
 	else
 		gflags = GPIOD_OUT_HIGH_OPEN_DRAIN;
-	priv->scl = i2c_gpio_lookup_scl(dev, gflags);
+	priv->scl = i2c_gpio_lookup_line(dev, "scl", 1, &i2c_gpio_scl_lock_key, gflags);
 	if (IS_ERR(priv->scl)) {
 		ret = PTR_ERR(priv->scl);
 		goto err_cleanup_sda;
 	}
 
-	if (gpiod_cansleep(priv->sda) || gpiod_cansleep(priv->scl->gpio))
+	if (gpiod_cansleep(priv->sda->gpio) || gpiod_cansleep(priv->scl->gpio))
 		dev_warn(dev, "Slow GPIO pins might wreak havoc into I2C/SMBus bus timing");
 	else
 		bit_data->can_do_atomic = true;
 
-	bit_data->skip_bit_test = !!priv->scl->args.fwnode;
+	bit_data->skip_bit_test = priv->scl->args.fwnode || priv->sda->args.fwnode;
 	bit_data->setsda = i2c_gpio_setsda_val;
 	bit_data->setscl = i2c_gpio_setscl_val;
 
@@ -608,7 +643,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)
 	else
 		snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id);
 
-	/* Always use shared SCL aware locking */
+	/* Always use shared SCL and SDA aware locking */
 	adap->lock_ops = &i2c_gpio_lock_ops;
 	adap->algo_data = bit_data;
 	adap->class = I2C_CLASS_HWMON;
@@ -628,7 +663,7 @@ static int i2c_gpio_probe(struct platform_device *pdev)
 	 * from the descriptor, then provide that instead.
 	 */
 	dev_info(dev, "using lines %u (SDA) and %u (SCL%s)\n",
-		 desc_to_gpio(priv->sda), desc_to_gpio(priv->scl->gpio),
+		 desc_to_gpio(priv->sda->gpio), desc_to_gpio(priv->scl->gpio),
 		 pdata->scl_is_output_only
 		 ? ", no clock stretching" : "");
 
@@ -637,9 +672,9 @@ static int i2c_gpio_probe(struct platform_device *pdev)
 	return 0;
 
 err_cleanup_scl:
-	i2c_gpio_cleanup_scl(priv->scl);
+	i2c_gpio_cleanup_line(priv->scl);
 err_cleanup_sda:
-	gpiod_put(priv->sda);
+	i2c_gpio_cleanup_line(priv->sda);
 
 	return ret;
 }
@@ -653,8 +688,8 @@ static void i2c_gpio_remove(struct platform_device *pdev)
 	adap = &priv->adap;
 
 	i2c_del_adapter(adap);
-	i2c_gpio_cleanup_scl(priv->scl);
-	gpiod_put(priv->sda);
+	i2c_gpio_cleanup_line(priv->scl);
+	i2c_gpio_cleanup_line(priv->sda);
 }
 
 static const struct of_device_id i2c_gpio_dt_ids[] = {

-- 
Git-157)



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-02 13:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-12-02 13:15 [PATCH v2 0/2] i2c: i2c-gpio: Support buses with shared SDA Anatoliy Oleinikov via B4 Relay
2026-12-02 13:15 ` [PATCH v2 1/2] i2c: i2c-gpio: Release a shared SCL before it can be requested again Anatoliy Oleinikov via B4 Relay
2026-12-02 13:15 ` [PATCH v2 2/2] i2c: i2c-gpio: Enhance driver for buses with shared SDA Anatoliy Oleinikov via B4 Relay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®