Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp724176pxu; Wed, 2 Dec 2020 01:29:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJyRoaDfrfoMrCCpYi/SalkN7ATn8dHwqu97MKMTjLCCQkkUHnO6ZpIXmNCxrwcP07alHKfv X-Received: by 2002:a17:906:edc4:: with SMTP id sb4mr1391133ejb.21.1606901372594; Wed, 02 Dec 2020 01:29:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606901372; cv=none; d=google.com; s=arc-20160816; b=rM+UohobMho5uOkIiBe17abvU3hFDis7L/5VnSGO+TRBOs9Xks6mFGOvCUxaMB2nEn cq+6UZYRQwmmKuGa4oB8bAIgizcFCMoi098Q/SI4Gw2BMlxZpg4nKxmYb6ImQDu769w4 DAEPKtRySC3IyeF7/ENlRV47CFVOM6OJ+7PyN/foXpCgAKa7lc2RSHzq7Oe54c/6fgbt QqgTvWXn6eI/IVttAo9zVMf78gXo1Mdi+WgZKk2RCnEJ2DOH5LPoVugoffPLKDbuxxN4 7eE+WSR68Y1n81BHe2NJRL9/9tGvIgj76Ymthtj/BWQXYo33ElmPH0BvzGFYRdrhxQOK NKYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=n8/EdgcNl/Oecc/J/j6s1ny1hIaKhmbx3hV6vJ6+NFY=; b=l4ximfxxYNtwuF+F5RF2XB09qTNUdbevpCn7jiVOBcFSJ7FNum6wINuuMi3XVs77FJ bhpD6je0STBtT9G5Rqa/q6BcZCHoYsyMcy6JdmImfvfus69reD5y+OXRPElbTPTNnzWO 2qNATUgB4gTYqWUF9aW69xGFVMG8Ny9fLJWyd2+1jaDpo79bFr2SSUNY4qSyYc14fqG3 HnFvtMKTC3DPKQV3rlAZaBT1KDDZZMlvTrQ0IKTO5siT+0eDnuw1aA1jWHD3k6RF27rO Q/6rUV+3zoitJThrN93aocG9Ul63dmxPDqpOPFC47mCgabE3jPfp7YAtH+cJfRQHLLqy DAFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j26si494182ejk.615.2020.12.02.01.29.09; Wed, 02 Dec 2020 01:29:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729196AbgLBJ1V (ORCPT + 99 others); Wed, 2 Dec 2020 04:27:21 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:9092 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728360AbgLBJ1U (ORCPT ); Wed, 2 Dec 2020 04:27:20 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4CmD9R4CxNzLy8c; Wed, 2 Dec 2020 17:26:03 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.487.0; Wed, 2 Dec 2020 17:26:35 +0800 From: Tian Tao To: , , , , , , , , , CC: Subject: [PATCH drm/hisilicon v2 2/3] drm/irq: Add the new api to install irq Date: Wed, 2 Dec 2020 17:26:51 +0800 Message-ID: <1606901212-8214-3-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1606901212-8214-1-git-send-email-tiantao6@hisilicon.com> References: <1606901212-8214-1-git-send-email-tiantao6@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add new api devm_drm_irq_install() to register interrupts, no need to call drm_irq_uninstall() when the drm module is removed. Signed-off-by: Tian Tao --- drivers/gpu/drm/drm_irq.c | 32 ++++++++++++++++++++++++++++++++ include/drm/drm_irq.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c index 09d6e9e..803af4b 100644 --- a/drivers/gpu/drm/drm_irq.c +++ b/drivers/gpu/drm/drm_irq.c @@ -214,6 +214,38 @@ int drm_irq_uninstall(struct drm_device *dev) } EXPORT_SYMBOL(drm_irq_uninstall); +static void devm_drm_irq_uninstall(void *data) +{ + drm_irq_uninstall(data); +} + +/** + * devm_drm_irq_install - install IRQ handler + * @dev: DRM device + * @irq: IRQ number to install the handler for + * + * devm_drm_irq_install is a help function of drm_irq_install. + * + * if the driver uses devm_drm_irq_install, there is no need + * to call drm_irq_uninstall when the drm module get unloaded, + * as this will done automagically. + * + * Returns: + * Zero on success or a negative error code on failure. + */ +int devm_drm_irq_install(struct drm_device *dev, int irq) +{ + int ret; + + ret = drm_irq_install(dev, irq); + if (ret) + return ret; + + return devm_add_action_or_reset(dev->dev, + devm_drm_irq_uninstall, dev); +} +EXPORT_SYMBOL(devm_drm_irq_install); + #if IS_ENABLED(CONFIG_DRM_LEGACY) int drm_legacy_irq_control(struct drm_device *dev, void *data, struct drm_file *file_priv) diff --git a/include/drm/drm_irq.h b/include/drm/drm_irq.h index d77f6e6..631b22f 100644 --- a/include/drm/drm_irq.h +++ b/include/drm/drm_irq.h @@ -28,5 +28,5 @@ struct drm_device; int drm_irq_install(struct drm_device *dev, int irq); int drm_irq_uninstall(struct drm_device *dev); - +int devm_drm_irq_install(struct drm_device *dev, int irq); #endif -- 2.7.4