Re: [PATCH v2 03/15] HID: ft260: add GPIO support

From
Michael Zaidman <michael.zaidman@gmail.com>
Date
2026-11-06 12:53:52
Also in
linux-gpio, linux-i2c, linux-serial, lkml
Reply to
Bartosz Golaszewski, 2026-11-03
On Tue, Nov 03, 2026 at 01:53:26PM +0100, Bartosz Golaszewski wrote:
There's a lot of sashiko comments to address but a few additional nits
below.
Thank you for the review. I am working through the Sashiko findings
for v3. Below is what I plan for each of your points.
quoted
+	mutex_lock(&dev->lock);
Use lock guards from linux/cleanup.h.
[...]
quoted
+exit:
+	mutex_unlock(&dev->lock);
That way you'll avoid this label. Same elsewhere.
I plan to do this as one new patch at the end of v3, which converts
the whole driver to guard(), and to remove these labels there.

The reason is that I also maintain an out-of-tree version of this
driver for kernels older than 6.5, which do not have linux/cleanup.h.
With the conversion as the last patch, the code before it becomes the
base for that version. It builds on older kernels with small changes,
and I can simply leave the last patch out there.
quoted
+	dev->gc = devm_kzalloc(&hdev->dev, sizeof(*dev->gc), GFP_KERNEL);
+	if (!dev->gc)
+		return -ENOMEM;
Why is this dynamically allocated? Make it part of ft260_device.
Will do in v3.
quoted
+	if (!label) {
+		ret = -ENOMEM;
+		goto exit;
Just return here? Why the label?
Right, it will return directly.
quoted
+	snprintf(label, label_sz, "%s%s", prefix, dev_name(&hdev->dev));
devm_kasprintf()?
Yes, v3 uses devm_kasprintf().
quoted
+	hid_info(hdev, "initialize gpio chip on %s\n", label);
Drop logs like this, they add nothing except useless noise. Same
elsewhere.
Agreed. In v3 I drop both "initialize gpio chip" messages.

The "enabled GPIOs" message moves from info to debug verbosity. It is
off by default. I would like to keep it there, because my hardware
tests read the GPIO mask from it.

Two messages stay at info level. "registering device /dev/ttyFT%d" is
the only one that tells which tty belongs to which device, like
"converter now attached to ttyUSB%d" in the USB serial core.
"chip code" was in the driver before this series, and it is the only
place that prints the chip version.

Thanks,
Michael
Thread (27 messages) 27 messages, 3 authors, last reply 10d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help