From 35cb635c4d29e0290e2404795c6ca266fa24222c Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Tue, 21 Aug 2018 13:41:07 -0700 Subject: [PATCH] xrp-kernel: add xrp_deinit_hw There's no easy way to get HW-specific data pointer in the driver remove handler of the HW-specific driver. Provide function xrp_deinit_hw that returns HW-specific data pointer to its second optional argument. Signed-off-by: Max Filippov --- xrp-kernel/xrp_hw.h | 1 + xrp-kernel/xvp_main.c | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/xrp-kernel/xrp_hw.h b/xrp-kernel/xrp_hw.h index 012b3e3..919c158 100644 --- a/xrp-kernel/xrp_hw.h +++ b/xrp-kernel/xrp_hw.h @@ -93,6 +93,7 @@ long xrp_init_cma(struct platform_device *pdev, enum xrp_init_flags flags, const struct xrp_hw_ops *hw, void *hw_arg); int xrp_deinit(struct platform_device *pdev); +int xrp_deinit_hw(struct platform_device *pdev, void **hw_arg); irqreturn_t xrp_irq_handler(int irq, struct xvp *xvp); int xrp_runtime_resume(struct device *dev); int xrp_runtime_suspend(struct device *dev); diff --git a/xrp-kernel/xvp_main.c b/xrp-kernel/xvp_main.c index 4a8ea00..349a97a 100644 --- a/xrp-kernel/xvp_main.c +++ b/xrp-kernel/xvp_main.c @@ -1965,6 +1965,16 @@ int xrp_deinit(struct platform_device *pdev) } EXPORT_SYMBOL(xrp_deinit); +int xrp_deinit_hw(struct platform_device *pdev, void **hw_arg) +{ + if (hw_arg) { + struct xvp *xvp = platform_get_drvdata(pdev); + *hw_arg = xvp->hw_arg; + } + return xrp_deinit(pdev); +} +EXPORT_SYMBOL(xrp_deinit_hw); + static void *get_hw_sync_data(void *hw_arg, size_t *sz) { void *p = kzalloc(64, GFP_KERNEL);