From: Abhijit Gangurde <abhijit.gangurde@amd.com>
To: <gregkh@linuxfoundation.org>, <linux-kernel@vger.kernel.org>
Cc: <git@amd.com>, <michal.simek@amd.com>, <Nipun.Gupta@amd.com>,
<nikhil.agarwal@amd.com>,
Abhijit Gangurde <abhijit.gangurde@amd.com>
Subject: [PATCH 1/1] cdx: register shutdown callback for cdx controller
Date: Thu, 17 Oct 2024 16:02:16 +0530 [thread overview]
Message-ID: <20241017103216.316114-1-abhijit.gangurde@amd.com> (raw)
register shutdown callback for cdx controller platform device
to handle graceful connection closure of rpmsg transport.
Also, handle shutdown of cdx bus device by disabling the bus.
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
---
drivers/cdx/cdx.c | 5 ++++-
drivers/cdx/controller/cdx_controller.c | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/cdx/cdx.c b/drivers/cdx/cdx.c
index 07371cb653d3..655a056bca4e 100644
--- a/drivers/cdx/cdx.c
+++ b/drivers/cdx/cdx.c
@@ -338,8 +338,11 @@ static void cdx_shutdown(struct device *dev)
{
struct cdx_driver *cdx_drv = to_cdx_driver(dev->driver);
struct cdx_device *cdx_dev = to_cdx_device(dev);
+ struct cdx_controller *cdx = cdx_dev->cdx;
- if (cdx_drv && cdx_drv->shutdown)
+ if (cdx_dev->is_bus && cdx_dev->enabled && cdx->ops->bus_disable)
+ cdx->ops->bus_disable(cdx, cdx_dev->bus_num);
+ else if (cdx_drv && cdx_drv->shutdown)
cdx_drv->shutdown(cdx_dev);
}
diff --git a/drivers/cdx/controller/cdx_controller.c b/drivers/cdx/controller/cdx_controller.c
index 7c1ea5373b12..9aad5a9b328c 100644
--- a/drivers/cdx/controller/cdx_controller.c
+++ b/drivers/cdx/controller/cdx_controller.c
@@ -261,6 +261,11 @@ static void xlnx_cdx_remove(struct platform_device *pdev)
kfree(cdx_mcdi);
}
+static void xlnx_cdx_shutdown(struct platform_device *pdev)
+{
+ cdx_destroy_rpmsg(pdev);
+}
+
static const struct of_device_id cdx_match_table[] = {
{.compatible = "xlnx,versal-net-cdx",},
{ },
@@ -276,6 +281,7 @@ static struct platform_driver cdx_pdriver = {
},
.probe = xlnx_cdx_probe,
.remove_new = xlnx_cdx_remove,
+ .shutdown = xlnx_cdx_shutdown,
};
static int __init cdx_controller_init(void)
--
2.25.1
next reply other threads:[~2024-10-17 10:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 10:32 Abhijit Gangurde [this message]
2024-11-04 0:43 ` Greg KH
2024-11-11 11:28 ` Agarwal, Nikhil
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=20241017103216.316114-1-abhijit.gangurde@amd.com \
--to=abhijit.gangurde@amd.com \
--cc=Nipun.Gupta@amd.com \
--cc=git@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=nikhil.agarwal@amd.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
all inboxes | Powered by JetHome®