aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwtracing/intel_th/msu.c
diff options
context:
space:
mode:
authorAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-04-08 17:37:40 +0300
committerAlexander Shishkin <alexander.shishkin@linux.intel.com>2016-04-08 17:45:46 +0300
commitf152dfee19c0cd146b16179a60ffb2cacf995736 (patch)
tree0d17a2e74c33e885f6a49ec167f58d647daa3ff0 /drivers/hwtracing/intel_th/msu.c
parentintel_th: msu: Set fops::owner to prevent module from unloading (diff)
downloadlinux-dev-f152dfee19c0cd146b16179a60ffb2cacf995736.tar.xz
linux-dev-f152dfee19c0cd146b16179a60ffb2cacf995736.zip
intel_th: msu: Release resources on removal
Do release the resources when msu subdevice gets removed: stop the capture if it is active (which is still possible even though the module in pinned) and free the capture buffers. Signed-off-by: Alexander Shishkin <alexander.shishkin@linux.intel.com> Reviewed-by: Laurent Fert <laurent.fert@intel.com>
Diffstat (limited to 'drivers/hwtracing/intel_th/msu.c')
-rw-r--r--drivers/hwtracing/intel_th/msu.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/msu.c
index bcc3b4713377..0974090abc7d 100644
--- a/drivers/hwtracing/intel_th/msu.c
+++ b/drivers/hwtracing/intel_th/msu.c
@@ -1492,6 +1492,18 @@ static int intel_th_msc_probe(struct intel_th_device *thdev)
static void intel_th_msc_remove(struct intel_th_device *thdev)
{
+ struct msc *msc = dev_get_drvdata(&thdev->dev);
+ int ret;
+
+ intel_th_msc_deactivate(thdev);
+
+ /*
+ * Buffers should not be used at this point except if the
+ * output character device is still open and the parent
+ * device gets detached from its bus, which is a FIXME.
+ */
+ ret = msc_buffer_free_unless_used(msc);
+ WARN_ON_ONCE(ret);
}
static struct intel_th_driver intel_th_msc_driver = {