From: Dan Williams <dan.j.williams@intel.com>
To: mcgrof@kernel.org, russ.weight@linux.dev, dakr@kernel.org
Cc: linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Chao Gao <chao.gao@intel.com>
Subject: [PATCH 2/3] firmware_loader: Stop pinning parent device per workqueue invocation
Date: Tue, 31 Mar 2026 14:47:25 -0700 [thread overview]
Message-ID: <20260331214726.903274-3-dan.j.williams@intel.com> (raw)
In-Reply-To: <20260331214726.903274-1-dan.j.williams@intel.com>
The device core pins parent devices while children are registered. As long
as all usage of the parent device by the firmware_loader ends at
firmware_upload_unregister(), no per queue_work() reference is needed.
Now that firmware_upload_unregister() holds its own parent device reference
over the child device_del() and flush_work() events, the per queue_work()
reference can be deleted.
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: Russ Weight <russ.weight@linux.dev>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Chao Gao <chao.gao@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
drivers/base/firmware_loader/sysfs_upload.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/base/firmware_loader/sysfs_upload.c b/drivers/base/firmware_loader/sysfs_upload.c
index 87c4f2a9a21b..23f6cdaf29c5 100644
--- a/drivers/base/firmware_loader/sysfs_upload.c
+++ b/drivers/base/firmware_loader/sysfs_upload.c
@@ -176,7 +176,7 @@ static void fw_upload_main(struct work_struct *work)
ret = fwlp->ops->prepare(fwl, fwlp->data, fwlp->remaining_size);
if (ret != FW_UPLOAD_ERR_NONE) {
fw_upload_set_error(fwlp, ret);
- goto putdev_exit;
+ goto out;
}
fw_upload_update_progress(fwlp, FW_UPLOAD_PROG_TRANSFERRING);
@@ -204,9 +204,7 @@ static void fw_upload_main(struct work_struct *work)
done:
if (fwlp->ops->cleanup)
fwlp->ops->cleanup(fwl);
-
-putdev_exit:
- put_device(fw_dev->parent);
+out:
/*
* Note: fwlp->remaining_size is left unmodified here to provide
@@ -249,8 +247,6 @@ int fw_upload_start(struct fw_sysfs *fw_sysfs)
return -EBUSY;
}
- get_device(fw_dev->parent); /* released in fw_upload_main */
-
fwlp->progress = FW_UPLOAD_PROG_RECEIVING;
fwlp->err_code = 0;
fwlp->remaining_size = fw_priv->size;
--
2.53.0
next prev parent reply other threads:[~2026-03-31 21:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 21:47 [PATCH 0/3] firmware_loader: Fix shutdown ordering and reference counting Dan Williams
2026-03-31 21:47 ` [PATCH 1/3] firmware_loader: Stop pinning modules on registration Dan Williams
2026-03-31 21:47 ` Dan Williams [this message]
2026-03-31 21:47 ` [PATCH 3/3] treewide: firmware_loader: Drop the unused @module argument Dan Williams
2026-04-09 16:06 ` Conor Dooley
2026-04-07 19:24 ` [PATCH 0/3] firmware_loader: Fix shutdown ordering and reference counting Russ Weight
2026-04-08 2:26 ` Chao Gao
2026-04-08 2:34 ` Dan Williams
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=20260331214726.903274-3-dan.j.williams@intel.com \
--to=dan.j.williams@intel.com \
--cc=chao.gao@intel.com \
--cc=dakr@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=rafael@kernel.org \
--cc=russ.weight@linux.dev \
/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