Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp185288pxb; Mon, 2 Nov 2020 18:14:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJxnB4dRO7d8b/dUbq5AVBysoOl3xBteaPYWcYb6wawUhLfu+Xt2jXSWm5JxbuTKuu6hOBLI X-Received: by 2002:a17:906:6d4:: with SMTP id v20mr7729968ejb.500.1604369647382; Mon, 02 Nov 2020 18:14:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604369647; cv=none; d=google.com; s=arc-20160816; b=CUvCsaxW58xrOW88BQGEVw2A1qXxxSHM74oeKlMEsptTal19XLd4nSRz3e1E6bcLCL sMJlx41u/ELxpymvdsBiGWi0Z2oVNh00XFszbx0YRd944/p6Guj6aIiMu7hEH9EbC5q+ ymrw9ux49Jw3qN2/BRFcbBg+BF4w62Nj32Cz0LZMGAS8CanRqp9l3UuzhfjBCBJbsORG ReNQbrh8/USnOqprLUxyGcUlLCvP4riWZk0d5gRJcNCvxVip6gr0IErWOIyDzzENP9ym KnaDR9jK9Ngei7iAK7ywrdaJt/Kdfr7FmhFidkxMeRXBOIltqu+7JT/oVl1qUmhsukje Vyow== 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=fH54S4LjVgiEY9jEV144cdvzvCClJaE+yFcysqHos2Q=; b=Q/erDGzE5MtG9HPMawmnRbJgvLYcZE+dXzm8xeW9oNMiBRDZQR81aiW4MPjuBPsAWP VPOHl00vTFTBNLi6Tlv6WLJncklXERL2k6AhfO+NJvhV8lr5UNnIfBYDWFHzazPrG95C cF+UIIHBX8y61wnxWAuhZqOLER0+MjwR1myHneMzRDeOy4fzWaO3QokEe32uF/syjk2V UMZvCj0AkT+T7ztbjCrucFXHRx1vpfh0DCGgVaKqb70J9ziGA7dMbVsC+edYj6KDxsvg tBCjjyh1pYzbudx7RPI56W/FZ3D6xvvV9/u7jcOj2DVbi2AWu+xU8r1MJcYRz2RQyLuh 0CJg== 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 lf27si5518044ejb.400.2020.11.02.18.13.45; Mon, 02 Nov 2020 18:14:07 -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 S1727043AbgKCCKK (ORCPT + 99 others); Mon, 2 Nov 2020 21:10:10 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:7404 "EHLO szxga07-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725956AbgKCCKK (ORCPT ); Mon, 2 Nov 2020 21:10:10 -0500 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CQCsp16FYz72SN; Tue, 3 Nov 2020 10:10:06 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.487.0; Tue, 3 Nov 2020 10:10:05 +0800 From: Tian Tao To: , , , , , , Subject: [PATCH v2] drm: Add the new api to install irq Date: Tue, 3 Nov 2020 10:10:41 +0800 Message-ID: <1604369441-65254-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. v2: fixed the wrong parameter. 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..0fe5243 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, dev); + 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