greybus: Discard pm_runtime_put_autosuspend() return value

Returning an error code from pm_runtime_put_autosuspend() merely means
that it has not queued up a timer or work item to check whether or not
the device can be suspended and there are many perfectly valid
situations in which that can happen, like after writing "on" to the
device's runtime PM "control" attribute in sysfs for one example.

Modify gb_pm_runtime_put_autosuspend() to discard the
pm_runtime_put_autosuspend() return value, change its return type to
void, and update its caller in the Greybus power supply driver
accordingly.  Also drop the redundant pm_runtime_mark_last_busy() call
from gb_pm_runtime_put_autosuspend() while we're here, as this is
already part of pm_runtime_put_autosuspend().

Note that this resolves a bug in the power_supply driver: in tracking
'gbpsy->pm_acquired', it erroneously assumed that
pm_runtime_put_autosuspend() would not release a refcount when it
returned a non-zero value. That's a false assumption.

This will facilitate a planned change of the
pm_runtime_put_autosuspend() return type to void in the future, similar
to commit 3afd8df024 ("PM: runtime: Change pm_runtime_put() return
type to void").

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Alex Elder <elder@riscstar.com>
Link: https://patch.msgid.link/20261006161337.7.Ib0925681ca623093ddf812cc4de848e10ec07c73@changeid
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Brian Norris 2026-10-06 16:13:35 -07:00 committed by Greg Kroah-Hartman
parent b269cadb8e
commit b8cb5f7f6d
2 changed files with 5 additions and 15 deletions

View File

@ -377,12 +377,8 @@ static void gb_power_supply_state_change(struct gb_power_supply *gbpsy,
gbpsy->pm_acquired = true;
} else {
if (gbpsy->pm_acquired) {
ret = gb_pm_runtime_put_autosuspend(connection->bundle);
if (ret)
dev_err(&connection->bundle->dev,
"Fail to set wake unlock for none charging\n");
else
gbpsy->pm_acquired = false;
gb_pm_runtime_put_autosuspend(connection->bundle);
gbpsy->pm_acquired = false;
}
}

View File

@ -59,14 +59,9 @@ static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
return 0;
}
static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
static inline void gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
{
int retval;
pm_runtime_mark_last_busy(&bundle->dev);
retval = pm_runtime_put_autosuspend(&bundle->dev);
return retval;
pm_runtime_put_autosuspend(&bundle->dev);
}
static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle)
@ -82,8 +77,7 @@ static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle)
#else
static inline int gb_pm_runtime_get_sync(struct gb_bundle *bundle)
{ return 0; }
static inline int gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle)
{ return 0; }
static inline void gb_pm_runtime_put_autosuspend(struct gb_bundle *bundle) {}
static inline void gb_pm_runtime_get_noresume(struct gb_bundle *bundle) {}
static inline void gb_pm_runtime_put_noidle(struct gb_bundle *bundle) {}