Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp149356pxb; Mon, 2 Nov 2020 16:58:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJzjIu+4eP648Pz0uRqRjCnJDmWJGhF0LmXSfni44BmwGI4jWp4S/VOVZBHJ91bCUaEH5api X-Received: by 2002:a17:906:b216:: with SMTP id p22mr17976545ejz.228.1604365118075; Mon, 02 Nov 2020 16:58:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604365118; cv=none; d=google.com; s=arc-20160816; b=Jv934KyK2IrDgKlkRYWC2dM3R2krv9wJcLw8F/cVEOgo5C5JKmXmW/C0D4IQFk+Pvu txKaIQ5lCP1eR652NBsl7jqs0R5XMVuZrC64PUibpWCvww9V53jDxBNsrrUTmMILlcOV hiGlAKkCxh00wKSSoTNWKbrQE2OUBL/5Ohpz90owwMCcFCl17oRPkyhC0w04YU6ukdse Yb4jQoLADvvlaqH623wIkifLbchtwkAmfqmynxTPAi8wA1xGuz64p+gs2NcAeKPzw6md xMvF/p0wCDKMlzXa4/EdCsX7I1kmgiUOQQ8f6Lni+vO6bI4ruw1IlT5+EX1IGk4GoL+M iKgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:to:from; bh=SP25OhgxoysfNqwzURdlTB4BEXhz9ywHCB1jZACST+0=; b=VGxJu+mlJab5vYmqw6IpHiU4ngvtpanXiaqNLIr2r7W+jShesEwY2oNFCUj4WgLRKV qaoMAag2zmC5SM6YR3MK1M5AcPoZEKsy3M9OIQ+YIirwd8CKJiFDFluXrTyExP8cpy6r 3x2h7VGIRGkwgno2qGcleLLVXK5Kb2O67rWxf7ade7SK8XgBPR4Nx2TK3ZBVBGHW1DIQ bzrXJgoDzq25qxOF8JWbuE7NDu2JQktxnOAt1FiJMZkLSwNFKR6v9WeF6wZqMBh1B1Cd wekLDcOwCEpK5gMM9r0dWh9UTM11F6Y4a2VwKc399ZzBC74TvgolA9HY8ko4qGddF1pz 6gHA== 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 a17si4258196eda.321.2020.11.02.16.58.14; Mon, 02 Nov 2020 16:58:38 -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 S1726216AbgKCA4l (ORCPT + 99 others); Mon, 2 Nov 2020 19:56:41 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:6691 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725855AbgKCA4l (ORCPT ); Mon, 2 Nov 2020 19:56:41 -0500 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4CQBF03mq6z15Qnf; Tue, 3 Nov 2020 08:56:36 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Tue, 3 Nov 2020 08:56:37 +0800 From: Tian Tao To: , , , , , , Subject: [PATCH] drm: Add the new api to install irq Date: Tue, 3 Nov 2020 08:57:13 +0800 Message-ID: <1604365033-60277-1-git-send-email-tiantao6@hisilicon.com> X-Mailer: git-send-email 2.7.4 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_drv.c | 23 +++++++++++++++++++++++ include/drm/drm_drv.h | 3 ++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index cd162d4..f4a15b5 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -678,6 +679,28 @@ static int devm_drm_dev_init(struct device *parent, return ret; } +static void devm_drm_dev_irq_uninstall(void *data) +{ + drm_irq_uninstall(data); +} + +int devm_drm_irq_install(struct device *parent, + struct drm_device *dev, int irq) +{ + int ret; + + ret = drm_irq_install(dev, irq); + if (ret) + return ret; + + ret = devm_add_action(parent, devm_drm_dev_irq_uninstall, &irq); + if (ret) + devm_drm_dev_irq_uninstall(dev); + + return ret; +} +EXPORT_SYMBOL(devm_drm_irq_install); + void *__devm_drm_dev_alloc(struct device *parent, struct drm_driver *driver, size_t size, size_t offset) { diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index 0230762..fec1776 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -513,7 +513,8 @@ struct drm_driver { void *__devm_drm_dev_alloc(struct device *parent, struct drm_driver *driver, size_t size, size_t offset); - +int devm_drm_irq_install(struct device *parent, struct drm_device *dev, + int irq); /** * devm_drm_dev_alloc - Resource managed allocation of a &drm_device instance * @parent: Parent device object -- 2.7.4