@@ -53,6 +53,8 @@
#include "cdns-mhdp8546-hdcp.h"
#include "cdns-mhdp8546-j721e.h"
+struct workqueue_struct *cadence_mhdp_wq;
+
static int cdns_mhdp_mailbox_read(struct cdns_mhdp_device *mhdp)
{
int ret, empty;
@@ -2049,7 +2051,7 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge,
out:
mutex_unlock(&mhdp->link_mutex);
if (ret < 0)
- schedule_work(&mhdp->modeset_retry_work);
+ queue_work(cadence_mhdp_wq, &mhdp->modeset_retry_work);
}
static void cdns_mhdp_atomic_disable(struct drm_bridge *bridge,
@@ -2373,7 +2375,7 @@ static irqreturn_t cdns_mhdp_irq_handler(int irq, void *data)
spin_unlock(&mhdp->start_lock);
if (bridge_attached && (sw_ev0 & CDNS_DPTX_HPD)) {
- schedule_work(&mhdp->hpd_work);
+ queue_work(cadence_mhdp_wq, &mhdp->hpd_work);
}
if (sw_ev0 & ~CDNS_DPTX_HPD) {
@@ -2413,7 +2415,7 @@ static void cdns_mhdp_hpd_work(struct work_struct *work)
ret = cdns_mhdp_update_link_status(mhdp);
if (mhdp->connector.dev) {
if (ret < 0)
- schedule_work(&mhdp->modeset_retry_work);
+ queue_work(cadence_mhdp_wq, &mhdp->modeset_retry_work);
else
drm_kms_helper_hotplug_event(mhdp->bridge.dev);
} else {
@@ -2632,7 +2634,27 @@ static struct platform_driver mhdp_driver = {
.probe = cdns_mhdp_probe,
.remove = cdns_mhdp_remove,
};
-module_platform_driver(mhdp_driver);
+
+static int __init mhdp_init(void)
+{
+ int ret;
+
+ cadence_mhdp_wq = alloc_workqueue("cadence_mhdp_wq", 0, 0);
+ if (!cadence_mhdp_wq)
+ return -ENOMEM;
+ ret = platform_driver_register(&mhdp_driver);
+ if (ret)
+ destroy_workqueue(cadence_mhdp_wq);
+ return ret;
+}
+module_init(mhdp_init);
+
+static void __exit mhdp_exit(void)
+{
+ platform_driver_unregister(&mhdp_driver);
+ destroy_workqueue(cadence_mhdp_wq);
+}
+module_exit(mhdp_exit);
MODULE_FIRMWARE(FW_NAME);
@@ -419,4 +419,6 @@ struct cdns_mhdp_device {
u32 cdns_mhdp_wait_for_sw_event(struct cdns_mhdp_device *mhdp, uint32_t event);
+extern struct workqueue_struct *cadence_mhdp_wq;
+
#endif
@@ -449,14 +449,14 @@ static int cdns_mhdp_hdcp_check_link(struct cdns_mhdp_device *mhdp)
ret = _cdns_mhdp_hdcp_disable(mhdp);
if (ret) {
mhdp->hdcp.value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
- schedule_work(&mhdp->hdcp.prop_work);
+ queue_work(cadence_mhdp_wq, &mhdp->hdcp.prop_work);
goto out;
}
ret = _cdns_mhdp_hdcp_enable(mhdp, mhdp->hdcp.hdcp_content_type);
if (ret) {
mhdp->hdcp.value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
- schedule_work(&mhdp->hdcp.prop_work);
+ queue_work(cadence_mhdp_wq, &mhdp->hdcp.prop_work);
}
out:
mutex_unlock(&mhdp->hdcp.mutex);
@@ -474,8 +474,8 @@ static void cdns_mhdp_hdcp_check_work(struct work_struct *work)
hdcp);
if (!cdns_mhdp_hdcp_check_link(mhdp))
- schedule_delayed_work(&hdcp->check_work,
- DRM_HDCP_CHECK_PERIOD_MS);
+ queue_delayed_work(cadence_mhdp_wq, &hdcp->check_work,
+ DRM_HDCP_CHECK_PERIOD_MS);
}
static void cdns_mhdp_hdcp_prop_work(struct work_struct *work)
@@ -538,9 +538,9 @@ int cdns_mhdp_hdcp_enable(struct cdns_mhdp_device *mhdp, u8 content_type)
mhdp->hdcp.hdcp_content_type = content_type;
mhdp->hdcp.value = DRM_MODE_CONTENT_PROTECTION_ENABLED;
- schedule_work(&mhdp->hdcp.prop_work);
- schedule_delayed_work(&mhdp->hdcp.check_work,
- DRM_HDCP_CHECK_PERIOD_MS);
+ queue_work(cadence_mhdp_wq, &mhdp->hdcp.prop_work);
+ queue_delayed_work(cadence_mhdp_wq, &mhdp->hdcp.check_work,
+ DRM_HDCP_CHECK_PERIOD_MS);
out:
mutex_unlock(&mhdp->hdcp.mutex);
return ret;
@@ -553,7 +553,7 @@ int cdns_mhdp_hdcp_disable(struct cdns_mhdp_device *mhdp)
mutex_lock(&mhdp->hdcp.mutex);
if (mhdp->hdcp.value != DRM_MODE_CONTENT_PROTECTION_UNDESIRED) {
mhdp->hdcp.value = DRM_MODE_CONTENT_PROTECTION_UNDESIRED;
- schedule_work(&mhdp->hdcp.prop_work);
+ queue_work(cadence_mhdp_wq, &mhdp->hdcp.prop_work);
ret = _cdns_mhdp_hdcp_disable(mhdp);
}
mutex_unlock(&mhdp->hdcp.mutex);
Use local wq in order to avoid flush_scheduled_work() usage. Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> --- Please see commit c4f135d643823a86 ("workqueue: Wrap flush_workqueue() using a macro") for background. This is a blind conversion, and is only compile tested. .../drm/bridge/cadence/cdns-mhdp8546-core.c | 30 ++++++++++++++++--- .../drm/bridge/cadence/cdns-mhdp8546-core.h | 2 ++ .../drm/bridge/cadence/cdns-mhdp8546-hdcp.c | 16 +++++----- 3 files changed, 36 insertions(+), 12 deletions(-)