Re: [PATCH v2 03/15] HID: ft260: add GPIO support
From: Michael Zaidman
Date: Fri Nov 06 2026 - 08:00:41 EST
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.
>> + mutex_lock(&dev->lock);
>
> Use lock guards from linux/cleanup.h.
[...]
>> +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.
>> + 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.
>> + if (!label) {
>> + ret = -ENOMEM;
>> + goto exit;
>
> Just return here? Why the label?
Right, it will return directly.
>> + snprintf(label, label_sz, "%s%s", prefix, dev_name(&hdev->dev));
>
> devm_kasprintf()?
Yes, v3 uses devm_kasprintf().
>> + 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