linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vidya Sagar <vidyas@nvidia.com>
To: <kishon@ti.com>, <lpieralisi@kernel.org>, <kw@linux.com>,
	<bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<kthota@nvidia.com>, <mmaddireddy@nvidia.com>,
	<nkristam@nvidia.com>, <vidyas@nvidia.com>, <sagar.tv@gmail.com>
Subject: [PATCH V1] PCI: endpoint: Register release() for EPC device
Date: Wed, 22 Jun 2022 11:07:05 +0530	[thread overview]
Message-ID: <20220622053705.3283-1-vidyas@nvidia.com> (raw)

Register a dummy release function to avoid the below spew
when the driver is unbinded for an endpoint device.

root@tegra-ubuntu:/sys/bus/platform/drivers/tegra194-pcie# echo "141a0000.pcie-ep" > unbind
[   55.802704] ------------[ cut here ]------------
[   55.802737] Device '141a0000.pcie-ep' does not have a release() function, it is broken and must be fixed. See Documentation/core-api/kobject.rst.
[   55.802956] WARNING: CPU: 2 PID: 477 at /home/vidyas/y/mlt/kernel/drivers/base/core.c:2321 device_release+0x7c/0x90
[   55.831544] Modules linked in:
[   55.834781] CPU: 2 PID: 477 Comm: bash Not tainted 5.19.0-rc3-next-20220620-00001-ge53d3cc05d82 #17
[   55.844078] Hardware name: NVIDIA Jetson AGX Xavier Developer Kit (DT)
[   55.850675] pstate: 40400009 (nZcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[   55.857957] pc : device_release+0x7c/0x90
[   55.862265] lr : device_release+0x7c/0x90
[   55.866558] sp : ffff80000c24bab0
[   55.869965] x29: ffff80000c24bab0 x28: ffff0000872a5700 x27: 0000000000000000
[   55.877410] x26: 0000000000000000 x25: 0000000000000000 x24: ffff000080a946bc
[   55.884840] x23: ffff000080a946c0 x22: 0000000000000000 x21: ffff000083194400
[   55.892275] x20: ffff000082076000 x19: ffff00008203ec00 x18: ffffffffffffffff
[   55.899720] x17: 6620656220747375 x16: 6d20646e61206e65 x15: 62207473756d2064
[   55.907179] x14: 6e61206e656b6f72 x13: 6d20646e61206e65 x12: 6b6f726220736920
[   55.914651] x11: 2e7473722e746365 x10: 6a626f6b2f697061 x9 : 2d65726f632f6e6f
[   55.922132] x8 : ffff800009ff2e40 x7 : ffff80000c24b8b0 x6 : 00000000fffff1fc
[   55.929587] x5 : ffff0003fdf4ba08 x4 : 00000000fffff1fc x3 : ffff8003f44f1000
[   55.937033] x2 : ffff0000872a5700 x1 : 45c50f22e593f400 x0 : 0000000000000000
[   55.944501] Call trace:
[   55.947037]  device_release+0x7c/0x90
[   55.950995]  kobject_put+0x90/0x108
[   55.954797]  device_unregister+0x20/0x30
[   55.958877]  pci_epc_destroy+0x20/0x38
[   55.962908]  devm_pci_epc_release+0x10/0x18
[   55.967406]  release_nodes+0x3c/0x68
[   55.971121]  devres_release_all+0x8c/0xc8
[   55.975409]  device_unbind_cleanup+0x14/0x60
[   55.979951]  device_release_driver_internal+0x100/0x180
[   55.985508]  device_driver_detach+0x14/0x20
[   55.989968]  unbind_store+0xd8/0xf0
[   55.993732]  drv_attr_store+0x20/0x30
[   55.997639]  sysfs_kf_write+0x48/0x58
[   56.001489]  kernfs_fop_write_iter+0x118/0x1a0
[   56.006239]  new_sync_write+0xd0/0x190
[   56.010159]  vfs_write+0x1bc/0x390
[   56.013831]  ksys_write+0x64/0xf0
[   56.017483]  __arm64_sys_write+0x14/0x20
[   56.021567]  invoke_syscall+0x40/0xf8
[   56.025516]  el0_svc_common.constprop.3+0x6c/0xf8
[   56.030511]  do_el0_svc+0x28/0xc8
[   56.033920]  el0_svc+0x1c/0x58
[   56.036936]  el0t_64_sync_handler+0x94/0xb8
[   56.041049]  el0t_64_sync+0x15c/0x160
[   56.044652] ---[ end trace 0000000000000000 ]---

Signed-off-by: Vidya Sagar <vidyas@nvidia.com>
---
 drivers/pci/endpoint/pci-epc-core.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c
index 3bc9273d0a08..ae403aa54e72 100644
--- a/drivers/pci/endpoint/pci-epc-core.c
+++ b/drivers/pci/endpoint/pci-epc-core.c
@@ -746,6 +746,11 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc)
 }
 EXPORT_SYMBOL_GPL(devm_pci_epc_destroy);
 
+static void pci_epc_nop_release(struct device *dev)
+{
+	dev_vdbg(dev, "%s\n", __func__);
+}
+
 /**
  * __pci_epc_create() - create a new endpoint controller (EPC) device
  * @dev: device that is creating the new EPC
@@ -779,6 +784,7 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
 	device_initialize(&epc->dev);
 	epc->dev.class = pci_epc_class;
 	epc->dev.parent = dev;
+	epc->dev.release = pci_epc_nop_release;
 	epc->ops = ops;
 
 	ret = dev_set_name(&epc->dev, "%s", dev_name(dev));
-- 
2.17.1


             reply	other threads:[~2022-06-22  5:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22  5:37 Vidya Sagar [this message]
2022-06-22  6:52 ` [PATCH V1] PCI: endpoint: Register release() for EPC device Kishon Vijay Abraham I
2022-06-22  7:07   ` Vidya Sagar

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=20220622053705.3283-1-vidyas@nvidia.com \
    --to=vidyas@nvidia.com \
    --cc=bhelgaas@google.com \
    --cc=kishon@ti.com \
    --cc=kthota@nvidia.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mmaddireddy@nvidia.com \
    --cc=nkristam@nvidia.com \
    --cc=sagar.tv@gmail.com \
    /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;
as well as URLs for NNTP newsgroup(s).