From: "Gero Schwäricke" <gero.schwaericke@sevenlab.de>
To: "Brigham Campbell" <me@brighamcampbell.com>
Cc: "Wolfram Sang" <wsa+renesas@sang-engineering.com>,
"Jean Delvare" <jdelvare@suse.de>, <linux-i2c@vger.kernel.org>
Subject: Re: [PATCH v2] i2c-tools: Allow passing device file paths
Date: Tue, 28 Apr 2026 13:43:53 +0200 [thread overview]
Message-ID: <DI4RFLES1MXN.31HXMQMGXAXF7@sevenlab.de> (raw)
In-Reply-To: <20260312081808.347978-1-me@brighamcampbell.com>
Hi Brigham,
On Thu Mar 12, 2026 at 9:18 AM CET, Brigham Campbell wrote:
> I've tested these changes using i2cdetect, i2cget, and i2cset. However,
> I still consider this v2 a work-in-progress. In particular, I don't like
> that the code copies the path from argv into filename for two reasons:
> 1. It's needless and 2. it introduces another potential edge case in
> the case that the user passes in a path longer than PATH_MAX.
>
> I'm looking for comments and feedback. I'm interested to know whether or
> not you maintainers believe I'm on the right track with these changes
> and what you might suggest. I sense that some slightly more invasive
> changes may help clean up the code.
I see that you're struggling to find a good way to pass the device
information between lookup_i2c_bus() and open_i2c_dev(). How about we
lookup and open the device in one go? Exit paths will have to close the
file, but the rest should stay the same. It's worth to take a look at
how libgpio does the same, see gpiod_chip_open_lookup().
Also, to keep things backward compatible, we should presumably do the
path lookup only after bus number parsing and bus name lookup failed.
Symlink support would be welcome as well.
Best,
Gero
--
sevenlab engineering GmbH <https://sevenlab.de>
serious engineering.
Geschäftsführer: Christian J. Pereira
Amtsgericht Köln, HRB 121730
Anschrift: Hansaring 20, 50670 Köln
prev parent reply other threads:[~2026-04-28 11:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-12 8:18 [PATCH v2] i2c-tools: Allow passing device file paths Brigham Campbell
2026-04-01 23:33 ` Brigham Campbell
2026-04-28 11:43 ` Gero Schwäricke [this message]
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=DI4RFLES1MXN.31HXMQMGXAXF7@sevenlab.de \
--to=gero.schwaericke@sevenlab.de \
--cc=jdelvare@suse.de \
--cc=linux-i2c@vger.kernel.org \
--cc=me@brighamcampbell.com \
--cc=wsa+renesas@sang-engineering.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox