Hi Greg and all,
This series performs a set of cleanups, correctness fixes, and remaining TODO removals across the Greybus drivers in drivers/staging/greybus.
Greybus has existed in staging for a long time, and many FIXMEs, outdated comments, and partial implementations had accumulated over the years. While reviewing and compile-testing the drivers I found a number of places where the comments were obsolete, logic was incomplete, or newer subsystem APIs had evolved.
This series addresses those issues without changing any fundamental design or architecture. All changes are self-contained, straightforward, and focues on improving correctness and maintainability.
The patches include:
* Removal of obsolete FIXMEs that no longer reflect the current code or hardware behavior. * Correctness fixes in several protocol drivers (UART, RAW, USB, Loopback, Firmware core, Audio). * Small improvements to error handling and shutdown paths. * Cleanup of commented-out or dead code. * Removal of the now-completed GPIO and PWM TODO items. * Removal of the empty Greybus TODO file.
All patches were compile-tested with COMPILE_TEST=y and all Greybus options enabled. Runtime smoke testing was performed where possible.
This series does not attempt to graduate Greybus out of staging; these changes are preparatory cleanups only.
Thanks for your time and review.
Ayaan Mirza Baig (13): staging: greybus: Remove completed GPIO conversion TODO item staging: greybus: pwm: move activation into pwm apply and remove request() staging: greybus: remove empty TODO file staging: greybus: audio: remove obsolete INPUT_PROP_NO_DUMMY_RELEASE FIXME staging: greybus: audio: remove obsolete FIXME and document topology ownership staging: greybus: bootrom: remove obsolete FIXME about SVC parallel event handling staging: greybus: bootrom: remove obsolete FIXME around firmware filename logging staging: greybus: fw-core: remove obsolete S2 Loader runtime PM FIXME staging: greybus: loopback: remove incorrect FIXME about async wait staging: greybus: raw: handle disconnect while chardev is open staging: greybus: uart: clear unsupported termios bits staging: greybus: usb: validate hub control response length staging: greybus: usb: remove obsolete FIXME about bridged-PHY support
drivers/staging/greybus/TODO | 5 ----- drivers/staging/greybus/audio_codec.c | 7 +------ drivers/staging/greybus/audio_module.c | 6 ++++-- drivers/staging/greybus/bootrom.c | 10 ++-------- drivers/staging/greybus/fw-core.c | 4 ++-- drivers/staging/greybus/loopback.c | 6 +----- drivers/staging/greybus/pwm.c | 19 +++++++++++-------- drivers/staging/greybus/raw.c | 18 ++++++++++++++++-- drivers/staging/greybus/uart.c | 10 ++++++++-- drivers/staging/greybus/usb.c | 23 ++++++++--------------- 10 files changed, 53 insertions(+), 55 deletions(-) delete mode 100644 drivers/staging/greybus/TODO
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/TODO | 3 --- 1 file changed, 3 deletions(-)
diff --git a/drivers/staging/greybus/TODO b/drivers/staging/greybus/TODO index 6461e0132fe3..43fb6dc3dff0 100644 --- a/drivers/staging/greybus/TODO +++ b/drivers/staging/greybus/TODO @@ -1,5 +1,2 @@ -* Convert all uses of the old GPIO API from <linux/gpio.h> to the - GPIO descriptor API in <linux/gpio/consumer.h> and look up GPIO - lines from device tree or ACPI. * Make pwm.c use the struct pwm_ops::apply instead of ::config, ::set_polarity, ::enable and ::disable.
Move PWM activation from the legacy request() callback into the pwm_ops apply() path. Activation is now performed when the PWM transitions from disabled to enabled (state.enabled = true), so request() is no longer required. This aligns the driver with modern PWM core expectations: activation happens when the channel is actually enabled, and the device free path still performs deactivation.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/pwm.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/staging/greybus/pwm.c b/drivers/staging/greybus/pwm.c index 1cb7b9089ead..c80f42100e3b 100644 --- a/drivers/staging/greybus/pwm.c +++ b/drivers/staging/greybus/pwm.c @@ -174,10 +174,6 @@ static int gb_pwm_disable_operation(struct pwm_chip *chip, u8 which) return ret; }
-static int gb_pwm_request(struct pwm_chip *chip, struct pwm_device *pwm) -{ - return gb_pwm_activate_operation(chip, pwm->hwpwm); -};
static void gb_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) { @@ -206,6 +202,7 @@ static int gb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, return err; }
+ /* Disable if requested */ if (!state->enabled) { if (enabled) gb_pwm_disable_operation(chip, pwm->hwpwm); @@ -228,15 +225,21 @@ static int gb_pwm_apply(struct pwm_chip *chip, struct pwm_device *pwm, if (err) return err;
- /* enable/disable */ - if (!enabled) - return gb_pwm_enable_operation(chip, pwm->hwpwm); + /* Activate and enable on transition from disabled to enabled */ + if (state->enabled && !enabled) { + err = gb_pwm_activate_operation(chip, pwm->hwpwm); + if (err) + return err; + + /* Activate hardware channel before enabling input */ + err = gb_pwm_enable_operation(chip, pwm->hwpwm); + return err; + }
return 0; }
static const struct pwm_ops gb_pwm_ops = { - .request = gb_pwm_request, .free = gb_pwm_free, .apply = gb_pwm_apply, };
The Greybus TODO file listed two remaining cleanup items: - conversion to the GPIO descriptor API - conversion of pwm.c to pwm_ops.apply()
Both have now been completed, leaving the TODO file empty. Remove it as it no longer serves a purpose.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/TODO | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 drivers/staging/greybus/TODO
diff --git a/drivers/staging/greybus/TODO b/drivers/staging/greybus/TODO deleted file mode 100644 index 43fb6dc3dff0..000000000000 --- a/drivers/staging/greybus/TODO +++ /dev/null @@ -1,2 +0,0 @@ -* Make pwm.c use the struct pwm_ops::apply instead of ::config, ::set_polarity, - ::enable and ::disable.
The commented-out code attempted to set INPUT_PROP_NO_DUMMY_RELEASE on the jack's input device, but this input property does not exist in the kernel and struct snd_jack does not expose an input_dev field. The FIXME is obsolete and the commented code is invalid, remove it.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/audio_codec.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index 2f05e761fb9a..cafce125d5d4 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -785,12 +785,7 @@ static int gbaudio_init_jack(struct gbaudio_module_info *module, goto free_jacks; } } - - /* FIXME - * verify if this is really required - set_bit(INPUT_PROP_NO_DUMMY_RELEASE, - module->button.jack.jack->input_dev->propbit); - */ +
return 0;
gb_audio_gb_get_topology() allocates the topology buffer using kzalloc() and transfers ownership to the codec module. The buffer is already freed on error via the free_topology label and during disconnect in gb_audio_disconnect(). Remove the outdated FIXME and replace it with a comment documenting the ownership semantics.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/audio_module.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/audio_module.c b/drivers/staging/greybus/audio_module.c index 12c376c477b3..c7deeb99a41c 100644 --- a/drivers/staging/greybus/audio_module.c +++ b/drivers/staging/greybus/audio_module.c @@ -305,8 +305,10 @@ static int gb_audio_probe(struct gb_bundle *bundle, gbmodule->dev_id = gbmodule->mgmt_connection->intf->interface_id;
/* - * FIXME: malloc for topology happens via audio_gb driver - * should be done within codec driver itself + * The topology buffer is allocated by gb_audio_gb_get_topology() + * and ownership is transferred to this codec module. + * The codec is responsible for freeing the returned topology + * on error and on module removal. */ ret = gb_audio_gb_get_topology(gbmodule->mgmt_connection, &topology); if (ret) {
The MODE_SWITCH_TIMEOUT_MS constant included a FIXME suggesting the timeout could be reduced once the SVC core supported parallel event processing. Greybus SVC logic is stable today and no such change is planned, and the existing timeout has been used reliably for years. Remove the obsolete FIXME and replace it with a descriptive comment.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/bootrom.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c index d4d86b3898de..156212301d58 100644 --- a/drivers/staging/greybus/bootrom.c +++ b/drivers/staging/greybus/bootrom.c @@ -17,10 +17,7 @@ /* Timeout, in jiffies, within which the next request must be received */ #define NEXT_REQ_TIMEOUT_MS 1000
-/* - * FIXME: Reduce this timeout once svc core handles parallel processing of - * events from the SVC, which are handled sequentially today. - */ +/* Timeout for mode switching operations, based on current SVC behaviour */ #define MODE_SWITCH_TIMEOUT_MS 10000
enum next_request_type {
On Mon, Nov 17, 2025 at 11:48:11PM +0530, Ayaan Mirza Baig wrote:
The MODE_SWITCH_TIMEOUT_MS constant included a FIXME suggesting the timeout could be reduced once the SVC core supported parallel event processing. Greybus SVC logic is stable today and no such change is planned, and the existing timeout has been used reliably for years. Remove the obsolete FIXME and replace it with a descriptive comment.
No, just leave the FIXME in place.
-/*
- FIXME: Reduce this timeout once svc core handles parallel processing of
- events from the SVC, which are handled sequentially today.
- */
+/* Timeout for mode switching operations, based on current SVC behaviour */ #define MODE_SWITCH_TIMEOUT_MS 10000
Johan
A historical FIXME suggested converting a dev_info() message to dev_dbg() after all Greybus modules reported valid IDs. Greybus hardware is stable today and the firmware filename is still useful to log at info level, so remove the obsolete FIXME and keep the existing behaviour. Replace it with a concise descriptive comment.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/bootrom.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c index 156212301d58..8665be86dae6 100644 --- a/drivers/staging/greybus/bootrom.c +++ b/drivers/staging/greybus/bootrom.c @@ -165,10 +165,7 @@ static int find_firmware(struct gb_bootrom *bootrom, u8 stage) intf->ddbl1_manufacturer_id, intf->ddbl1_product_id, intf->vendor_id, intf->product_id);
- // FIXME: - // Turn to dev_dbg later after everyone has valid bootloaders with good - // ids, but leave this as dev_info for now to make it easier to track - // down "empty" vid/pid modules. + /* Log the firmware filename being requested */ dev_info(&connection->bundle->dev, "Firmware file '%s' requested\n", firmware_name);
A historical FIXME indicated that this autosuspend call could be removed once the S2 Loader supported runtime PM. That hardware is no longer supported and Greybus runtime PM is stable as-is, so the FIXME is obsolete. Remove it and replace it with a descriptive comment.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/fw-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/fw-core.c b/drivers/staging/greybus/fw-core.c index 0fb15a60412f..b9e989a99f06 100644 --- a/drivers/staging/greybus/fw-core.c +++ b/drivers/staging/greybus/fw-core.c @@ -208,7 +208,7 @@ static int gb_fw_core_probe(struct gb_bundle *bundle,
greybus_set_drvdata(bundle, fw_core);
- /* FIXME: Remove this after S2 Loader gets runtime PM support */ + /* Drop runtime PM reference unless the interface disables PM */ if (!(bundle->intf->quirks & GB_INTERFACE_QUIRK_NO_PM)) gb_pm_runtime_put_autosuspend(bundle);
@@ -233,7 +233,7 @@ static void gb_fw_core_disconnect(struct gb_bundle *bundle) struct gb_fw_core *fw_core = greybus_get_drvdata(bundle); int ret;
- /* FIXME: Remove this after S2 Loader gets runtime PM support */ + /* Get runtime PM reference unless interface disables PM */ if (!(bundle->intf->quirks & GB_INTERFACE_QUIRK_NO_PM)) { ret = gb_pm_runtime_get_sync(bundle); if (ret)
On Mon, Nov 17, 2025 at 11:48:13PM +0530, Ayaan Mirza Baig wrote:
A historical FIXME indicated that this autosuspend call could be removed once the S2 Loader supported runtime PM. That hardware is no longer supported and Greybus runtime PM is stable as-is, so the FIXME is obsolete. Remove it and replace it with a descriptive comment.
Just leave the FIXMEs in place.
Johan
The comment suggested that gb_loopback_async_wait_all() was redundant because the connection is disabled earlier. Disabling a Greybus connection prevents new requests but does not guarantee that previously submitted asynchronous operations have completed. The wait is still required for safe teardown.
Remove the incorrect FIXME and replace it with a descriptive comment.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/loopback.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index 1f19323b0e1a..0a5827e1a8c7 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -1110,11 +1110,7 @@ static void gb_loopback_disconnect(struct gb_bundle *bundle) gb_connection_latency_tag_disable(gb->connection); debugfs_remove(gb->file);
- /* - * FIXME: gb_loopback_async_wait_all() is redundant now, as connection - * is disabled at the beginning and so we can't have any more - * incoming/outgoing requests. - */ + /* Ensure all outstanding async loopback requests have completed */ gb_loopback_async_wait_all(gb);
spin_lock_irqsave(&gb_dev.lock, flags);
The raw protocol driver destroyed its character device and freed its private data even when userspace still had the device node open. This could cause use-after-free access through active file operations.
Fix this by marking the device as disconnected, returning -ENODEV from all file operations after disconnect, and disabling the Greybus connection before destroying the cdev. This provides safe teardown without redesigning the driver.
Remove the obsolete FIXME
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/raw.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/raw.c b/drivers/staging/greybus/raw.c index 71de6776739c..74818ca829c2 100644 --- a/drivers/staging/greybus/raw.c +++ b/drivers/staging/greybus/raw.c @@ -24,6 +24,7 @@ struct gb_raw { dev_t dev; struct cdev cdev; struct device *device; + bool disconnected; };
struct raw_data { @@ -231,10 +232,14 @@ static void gb_raw_disconnect(struct gb_bundle *bundle) struct raw_data *raw_data; struct raw_data *temp;
- // FIXME - handle removing a connection when the char device node is open. + /* Mark device as disconnected so file operations fail gracefully */ + raw->disconnected = true; + + /* Disable Greybus connection before destroying the chardev */ + gb_connection_disable(connection); + device_destroy(&raw_class, raw->dev); cdev_del(&raw->cdev); - gb_connection_disable(connection); ida_free(&minors, MINOR(raw->dev)); gb_connection_destroy(connection);
@@ -262,6 +267,9 @@ static int raw_open(struct inode *inode, struct file *file) struct cdev *cdev = inode->i_cdev; struct gb_raw *raw = container_of(cdev, struct gb_raw, cdev);
+ if (raw->disconnected) + return -ENODEV; + file->private_data = raw; return 0; } @@ -272,6 +280,9 @@ static ssize_t raw_write(struct file *file, const char __user *buf, struct gb_raw *raw = file->private_data; int retval;
+ if (raw->disconnected) + return -ENODEV; + if (!count) return 0;
@@ -292,6 +303,9 @@ static ssize_t raw_read(struct file *file, char __user *buf, size_t count, int retval = 0; struct raw_data *raw_data;
+ if (raw->disconnected) + return -ENODEV; + mutex_lock(&raw->list_lock); if (list_empty(&raw->list)) goto exit;
On Mon, Nov 17, 2025 at 11:48:15PM +0530, Ayaan Mirza Baig wrote:
diff --git a/drivers/staging/greybus/raw.c b/drivers/staging/greybus/raw.c index 71de6776739c..74818ca829c2 100644 --- a/drivers/staging/greybus/raw.c +++ b/drivers/staging/greybus/raw.c @@ -24,6 +24,7 @@ struct gb_raw { dev_t dev; struct cdev cdev; struct device *device;
- bool disconnected;
}; struct raw_data { @@ -231,10 +232,14 @@ static void gb_raw_disconnect(struct gb_bundle *bundle) struct raw_data *raw_data; struct raw_data *temp;
- // FIXME - handle removing a connection when the char device node is open.
- /* Mark device as disconnected so file operations fail gracefully */
- raw->disconnected = true;
- /* Disable Greybus connection before destroying the chardev */
- gb_connection_disable(connection);
- device_destroy(&raw_class, raw->dev); cdev_del(&raw->cdev);
- gb_connection_disable(connection); ida_free(&minors, MINOR(raw->dev)); gb_connection_destroy(connection);
At the end of gb_raw_disconnect(), the raw structure is freed using kfree, and so subsequent reads to raw->disconnected from other entrypoints would be a use after free.
In addition to adding the disconnected flag which you have done, you also have to convert raw to use reference counting, ensuring that the raw structure is alive till the last file is closed. Please have a look at drivers/staging/greybus/authentication.c where the same issue of files being open during disconnection is handled for the gb_cap structure in gb_cap_connection_exit() using reference counting.
Regards, Nihaal
The Greybus UART protocol supports only 8 data bits, no parity, one stop bit, and no hardware flow control. Mask out unsupported termios flags before applying settings and force the supported configuration. This removes the old FIXME and aligns the driver with TTY subsystem expectations.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/uart.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 10df5c37c83e..cc7337bf5088 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -495,8 +495,14 @@ static void gb_tty_set_termios(struct tty_struct *tty,
newline.data_bits = tty_get_char_size(termios->c_cflag);
- /* FIXME: needs to clear unsupported bits in the termios */ - gb_tty->clocal = ((termios->c_cflag & CLOCAL) != 0); + /* Mask out unsupported termios flags for Greybus UART */ + termios->c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD | + CRTSCTS | CMSPAR | CBAUD | CBAUDEX); + termios->c_cflag |= CS8; /* Force 8 data bits */ + termios->c_cflag &= ~PARENB; /* No parity */ + termios->c_cflag &= ~CSTOPB; /* One stop bit */ + + gb_tty->clocal = (termios->c_cflag & CLOCAL);
if (C_BAUD(tty) == B0) { newline.rate = gb_tty->line_coding.rate;
On Mon, Nov 17, 2025 at 11:48:16PM +0530, Ayaan Mirza Baig wrote:
The Greybus UART protocol supports only 8 data bits, no parity, one stop bit, and no hardware flow control.
Where did you get that from? Did you even look at the code you are changing?
Mask out unsupported termios flags before applying settings and force the supported configuration. This removes the old FIXME and aligns the driver with TTY subsystem expectations.
Please just leave the FIXMEs in place since you clearly do no understand what you are doing.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com
drivers/staging/greybus/uart.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 10df5c37c83e..cc7337bf5088 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -495,8 +495,14 @@ static void gb_tty_set_termios(struct tty_struct *tty, newline.data_bits = tty_get_char_size(termios->c_cflag);
- /* FIXME: needs to clear unsupported bits in the termios */
- gb_tty->clocal = ((termios->c_cflag & CLOCAL) != 0);
- /* Mask out unsupported termios flags for Greybus UART */
- termios->c_cflag &= ~(CSIZE | CSTOPB | PARENB | PARODD |
CRTSCTS | CMSPAR | CBAUD | CBAUDEX);- termios->c_cflag |= CS8; /* Force 8 data bits */
- termios->c_cflag &= ~PARENB; /* No parity */
- termios->c_cflag &= ~CSTOPB; /* One stop bit */
- gb_tty->clocal = (termios->c_cflag & CLOCAL);
Johan
Clamp hub control wLength to a reasonable maximum before allocating the response buffer to avoid oversized allocations and remove the FIXME about unspecified lengths.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/usb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c index 475f24f20cd4..1502641f5dbb 100644 --- a/drivers/staging/greybus/usb.c +++ b/drivers/staging/greybus/usb.c @@ -105,7 +105,13 @@ static int hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, size_t response_size; int ret;
- /* FIXME: handle unspecified lengths */ + /* + * Clamp wLength to a reasonable maximum to avoid oversized allocations. + * USB control responses are expected to be small, use 2K as a safe + * upper bound for the response payload. + */ + if (wLength > 2048) + wLength = 2048; response_size = sizeof(*response) + wLength;
operation = gb_operation_create(dev->connection,
On Mon, Nov 17, 2025 at 11:48:17PM +0530, Ayaan Mirza Baig wrote:
Clamp hub control wLength to a reasonable maximum before allocating the response buffer to avoid oversized allocations and remove the FIXME about unspecified lengths.
I don't believe you this is what the comment is about at all. Leave it.
Johan
The USB bridged-PHY protocol has never been supported by the upstream USB core and cannot function. Remove the obsolete FIXME and keep the protocol disabled with a straightforward explanatory comment.
Signed-off-by: Ayaan Mirza Baig ayaanmirzabaig85@gmail.com --- drivers/staging/greybus/usb.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-)
diff --git a/drivers/staging/greybus/usb.c b/drivers/staging/greybus/usb.c index 1502641f5dbb..e1c9966ab678 100644 --- a/drivers/staging/greybus/usb.c +++ b/drivers/staging/greybus/usb.c @@ -194,23 +194,10 @@ static int gb_usb_probe(struct gbphy_device *gbphy_dev, if (retval) goto exit_connection_destroy;
- /* - * FIXME: The USB bridged-PHY protocol driver depends on changes to - * USB core which are not yet upstream. - * - * Disable for now. - */ - if (1) { + /* The USB bridged-PHY protocol is not supported by upstream USB core */ dev_warn(dev, "USB protocol disabled\n"); retval = -EPROTONOSUPPORT; goto exit_connection_disable; - } - - retval = usb_add_hcd(hcd, 0, 0); - if (retval) - goto exit_connection_disable; - - return 0;
exit_connection_disable: gb_connection_disable(connection);
On Mon, Nov 17, 2025 at 11:48:18PM +0530, Ayaan Mirza Baig wrote:
The USB bridged-PHY protocol has never been supported by the upstream USB core and cannot function. Remove the obsolete FIXME and keep the protocol disabled with a straightforward explanatory comment.
Drop this one as well. The comment is not obsolete.
Johan
On Mon, Nov 17, 2025 at 11:48:05PM +0530, Ayaan Mirza Baig wrote:
Hi Greg and all,
This series performs a set of cleanups, correctness fixes, and remaining TODO removals across the Greybus drivers in drivers/staging/greybus.
Greybus has existed in staging for a long time, and many FIXMEs, outdated comments, and partial implementations had accumulated over the years.
These haven't accumulated in staging, but during development as the git logs should tell you.
While reviewing and compile-testing the drivers I found a number of places where the comments were obsolete, logic was incomplete, or newer subsystem APIs had evolved.
This series addresses those issues without changing any fundamental design or architecture. All changes are self-contained, straightforward, and focues on improving correctness and maintainability.
The patches include:
- Removal of obsolete FIXMEs that no longer reflect the current code or hardware behavior.
- Correctness fixes in several protocol drivers (UART, RAW, USB, Loopback, Firmware core, Audio).
- Small improvements to error handling and shutdown paths.
- Cleanup of commented-out or dead code.
- Removal of the now-completed GPIO and PWM TODO items.
- Removal of the empty Greybus TODO file.
All patches were compile-tested with COMPILE_TEST=y and all Greybus options enabled. Runtime smoke testing was performed where possible.
This series does not attempt to graduate Greybus out of staging; these changes are preparatory cleanups only.
Thanks for your time and review.
Ayaan Mirza Baig (13): staging: greybus: Remove completed GPIO conversion TODO item staging: greybus: pwm: move activation into pwm apply and remove request() staging: greybus: remove empty TODO file staging: greybus: audio: remove obsolete INPUT_PROP_NO_DUMMY_RELEASE FIXME staging: greybus: audio: remove obsolete FIXME and document topology ownership staging: greybus: bootrom: remove obsolete FIXME about SVC parallel event handling staging: greybus: bootrom: remove obsolete FIXME around firmware filename logging staging: greybus: fw-core: remove obsolete S2 Loader runtime PM FIXME staging: greybus: loopback: remove incorrect FIXME about async wait staging: greybus: raw: handle disconnect while chardev is open staging: greybus: uart: clear unsupported termios bits staging: greybus: usb: validate hub control response length staging: greybus: usb: remove obsolete FIXME about bridged-PHY support
I only skimmed some of these and there are so many bugs and misunderstandings here that I can only imagine what's lurking in the remaining ones.
The basic misunderstanding seems to be that FIXMEs can and should be removed without addressing the underlying issues.
Johan
On Tue, Nov 18, 2025 at 05:11:13PM +0100, Johan Hovold wrote:
On Mon, Nov 17, 2025 at 11:48:05PM +0530, Ayaan Mirza Baig wrote:
Hi Greg and all,
This series performs a set of cleanups, correctness fixes, and remaining TODO removals across the Greybus drivers in drivers/staging/greybus.
Greybus has existed in staging for a long time, and many FIXMEs, outdated comments, and partial implementations had accumulated over the years.
These haven't accumulated in staging, but during development as the git logs should tell you.
While reviewing and compile-testing the drivers I found a number of places where the comments were obsolete, logic was incomplete, or newer subsystem APIs had evolved.
This series addresses those issues without changing any fundamental design or architecture. All changes are self-contained, straightforward, and focues on improving correctness and maintainability.
The patches include:
- Removal of obsolete FIXMEs that no longer reflect the current code or hardware behavior.
- Correctness fixes in several protocol drivers (UART, RAW, USB, Loopback, Firmware core, Audio).
- Small improvements to error handling and shutdown paths.
- Cleanup of commented-out or dead code.
- Removal of the now-completed GPIO and PWM TODO items.
- Removal of the empty Greybus TODO file.
All patches were compile-tested with COMPILE_TEST=y and all Greybus options enabled. Runtime smoke testing was performed where possible.
This series does not attempt to graduate Greybus out of staging; these changes are preparatory cleanups only.
Thanks for your time and review.
Ayaan Mirza Baig (13): staging: greybus: Remove completed GPIO conversion TODO item staging: greybus: pwm: move activation into pwm apply and remove request() staging: greybus: remove empty TODO file staging: greybus: audio: remove obsolete INPUT_PROP_NO_DUMMY_RELEASE FIXME staging: greybus: audio: remove obsolete FIXME and document topology ownership staging: greybus: bootrom: remove obsolete FIXME about SVC parallel event handling staging: greybus: bootrom: remove obsolete FIXME around firmware filename logging staging: greybus: fw-core: remove obsolete S2 Loader runtime PM FIXME staging: greybus: loopback: remove incorrect FIXME about async wait staging: greybus: raw: handle disconnect while chardev is open staging: greybus: uart: clear unsupported termios bits staging: greybus: usb: validate hub control response length staging: greybus: usb: remove obsolete FIXME about bridged-PHY support
I only skimmed some of these and there are so many bugs and misunderstandings here that I can only imagine what's lurking in the remaining ones.
The basic misunderstanding seems to be that FIXMEs can and should be removed without addressing the underlying issues.
Johan
Hi Johan,
Thank you for taking the time to review the series, and thank you for being direct about the issues. I want to apologize for the misunderstandings and for removing FIXMEs that should not have been touched. That was my mistake, and I should have taken more care before modifying areas of the subsystem I don't fully understand yet.
I also want to be transparent: I'm an undergraduate student who is just starting to learn kernel development. I'm very interested in Linux and want to contribute seriously, but I clearly approached this series with more confidence than understanding, and I am sorry for the noise that caused.
I'll resend only a very small, focused series once I have properly analysed the code. Before I send a v2, I want to make sure I am going in the right direction.
If you have any guidance on how I can improve - in terms of approach, review process, or how to evaluate FIXMEs and TODOs correctly - I would really appreciate it. I'm trying to learn the right way to contribute and I don't want to repeat the same mistakes.
I also want to double-check whether the PWM apply() changes (one of the TODO items) were done correctly, also if there are any issues in [PATCH 10/13], apart from what Abdun suggested. I'm willing to redo the work properly.
Again, apologies for the errors. I appreciate your time and feedback.
Thanks, Ayaan