From patchwork Mon Jun 19 12:41:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sui Jingfeng <15330273260@189.cn> X-Patchwork-Id: 109986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2985311vqr; Mon, 19 Jun 2023 05:52:58 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5D4VeecSac+hnUhxPPdTwHcEYsRanjLZgpxwTmN3oP8NA2PnCIvRbt6qg9Mu9HS7guZ71B X-Received: by 2002:a17:902:f7cf:b0:1b3:d27b:32b0 with SMTP id h15-20020a170902f7cf00b001b3d27b32b0mr10295794plw.7.1687179178504; Mon, 19 Jun 2023 05:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687179178; cv=none; d=google.com; s=arc-20160816; b=BybuzdCKrvvguPUFQ9U4WaFPQJkFP2Wa3lTPsbgSEd8Q40I/D7JYjXnxWvAo1rckQ4 jKpSQtTCUTb8sc1/lR64Mk6gisnUpDnPjS9KOZ7nQIpiRCP78H+KXN46tY7Xy2ivj7xM fdJwAROjUGmYyrO4JqiqP4x0TxsZ54IHwwpLRaBUSPwfB08P0f0x03s/hhmQB3WYbXei gxbt5dQr9Dd067xbX9CxiDYsCbNef/8R6zG5DB5l66BwKzsrZA17DzLMGU1RPkS0jMkS Yhbb2jHCZv9+lvGo00oKRMdhV+YEe/tcMRjYWWI24BowDisFbtJR4g5HiZ0OCiUmOHDQ puaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :hmm_source_type:hmm_attache_num:hmm_source_ip; bh=wU8Ie13gmhuczqUhzOFuP6vAwh58ReysXrVNUirzfUE=; b=zxpiZY1G7r9CIDDeMdE25riQ4CEKsIv9Sx4dl693PuikY5qShog4UNxf63lsck9eNz 5ZPUgNQ4UauxleJ+cX70NRzegKFY4z4ZULUrUmCw+X3Mut5NF9e130KtioVur4I78DVK SD/0prdSkJCHJfCtp0L1G0oDNPcQbQ5V1K1eX290jTbIIlmMq4pt6THnPnFbnBXTW5WD RPUovebyi8uEJ5z2IGTF48SKUPzW8PhYe60iZUo9y3qOKIVkSpCZBeD8/mgFcs/M3Yaf qqoSKiv2Oqf37HFuVXbExVCL6JF2/xLEuEdwsbZ63FmV5P5pxzb54RwSe0+cEuv2/BVt YXFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n9-20020a170902d2c900b001ab147e4543si22348952plc.418.2023.06.19.05.52.43; Mon, 19 Jun 2023 05:52:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230364AbjFSMmO (ORCPT + 99 others); Mon, 19 Jun 2023 08:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbjFSMmK (ORCPT ); Mon, 19 Jun 2023 08:42:10 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.104]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B744EAB for ; Mon, 19 Jun 2023 05:42:08 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.41:49634.708654646 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.41]) by 189.cn (HERMES) with SMTP id 06E4C100239; Mon, 19 Jun 2023 20:42:06 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-75648544bd-xwndj with ESMTP id 2d93ac6bcbae4e088327129f15390ec1 for l.stach@pengutronix.de; Mon, 19 Jun 2023 20:42:08 CST X-Transaction-ID: 2d93ac6bcbae4e088327129f15390ec1 X-Real-From: 15330273260@189.cn X-Receive-IP: 114.242.206.180 X-MEDUSA-Status: 0 Sender: 15330273260@189.cn From: Sui Jingfeng <15330273260@189.cn> To: Lucas Stach , Russell King , Christian Gmeiner , David Airlie , Daniel Vetter Cc: linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Sui Jingfeng , Philipp Zabel , Bjorn Helgaas Subject: [PATCH v10 01/11] drm/etnaviv: Add a dedicated function to register an irq handler Date: Mon, 19 Jun 2023 20:41:51 +0800 Message-Id: <20230619124201.2215558-2-15330273260@189.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230619124201.2215558-1-15330273260@189.cn> References: <20230619124201.2215558-1-15330273260@189.cn> MIME-Version: 1.0 X-Spam-Status: No, score=1.7 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,FROM_LOCAL_DIGITS, FROM_LOCAL_HEX,RCVD_IN_SBL_CSS,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769135594190747241?= X-GMAIL-MSGID: =?utf-8?q?1769135594190747241?= From: Sui Jingfeng Because getting IRQ from a device is platform-dependent, PCI devices have different methods for getting an IRQ. This patch is a preparation to extend this driver for supporting the PCI devices. Cc: Lucas Stach Cc: Christian Gmeiner Cc: Philipp Zabel Cc: Bjorn Helgaas Cc: Daniel Vetter Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 32 +++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index de8c9894967c..a03e81337d8f 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1817,6 +1817,27 @@ static const struct of_device_id etnaviv_gpu_match[] = { }; MODULE_DEVICE_TABLE(of, etnaviv_gpu_match); +static int etnaviv_gpu_register_irq(struct etnaviv_gpu *gpu, int irq) +{ + struct device *dev = gpu->dev; + int err; + + if (irq < 0) + return irq; + + err = devm_request_irq(dev, irq, irq_handler, 0, dev_name(dev), gpu); + if (err) { + dev_err(dev, "failed to request irq %u: %d\n", irq, err); + return err; + } + + gpu->irq = irq; + + dev_info(dev, "irq(%d) handler registered\n", irq); + + return 0; +} + static int etnaviv_gpu_platform_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1837,16 +1858,9 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev) return PTR_ERR(gpu->mmio); /* Get Interrupt: */ - gpu->irq = platform_get_irq(pdev, 0); - if (gpu->irq < 0) - return gpu->irq; - - err = devm_request_irq(&pdev->dev, gpu->irq, irq_handler, 0, - dev_name(gpu->dev), gpu); - if (err) { - dev_err(dev, "failed to request IRQ%u: %d\n", gpu->irq, err); + err = etnaviv_gpu_register_irq(gpu, platform_get_irq(pdev, 0)); + if (err) return err; - } /* Get Clocks: */ gpu->clk_reg = devm_clk_get_optional(&pdev->dev, "reg");