Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp566164rwd; Wed, 7 Jun 2023 04:08:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6zABC2J4orehKXh1RUHqg+PvEVrmgL5biewbzPSlJnuD7fAPP4vM4gBKshhBGKGme5vO4g X-Received: by 2002:a17:902:c1c5:b0:1ae:50a4:78da with SMTP id c5-20020a170902c1c500b001ae50a478damr1750272plc.67.1686136114423; Wed, 07 Jun 2023 04:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686136114; cv=none; d=google.com; s=arc-20160816; b=oT6DrSYeqe9qfgEjTeHoSLhGGiGlXe82z5hR1uAJv35JeKIuE33caRtCJle+uZ1ZNP W+H5yNb0SBa+v/7Ikmuj3huPxEf8XQSQhEy0bU5fD2JEycEQKXhfbPhzdVCuA6t/gKql 3Ayz0HR2ZuLbGGQJ9IAr1HwzBtmoJ8gkbq4priTIRzH/xKURT0dgGd1FkgDGCGs78/o7 lhSP+8BE3vU6b96e1XIwpXxaRBaYoltDLpbuO+ppayQt7voAOJ7CfXwRoen1r+f6tIrt rLf84Sa9744w9Qbs2RcicelsIV+POvhyXe86s1RZCEmIW/e19/RlSvF/DkbD+X9JKPLx 9i4w== 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=JgofLk4W/acgVmRDTtR+pg4l6g4d8kV2mxFCQVcihaQ=; b=ajaPN0JDCHaJKrRLxXPDJmf5VMGGH4h3xKfyoZMKPHcs9Qgny0hOF7ghnxksIEpew0 R2AU+2C6edzeMcCl4rcPm53DxNzJPvJHXH9tfn5x31ylX1gf2cSH+LgavubvVNeGXMb8 dew62EC0BrPa9rYU5rbLz1MlFQoF5DA4dkhcSfCXAtX5CfXf/9mZucAb+nu2PFfP7AdA 0qdHAtUq08B2OSdwECmHxGp1z1gr0paLenTtSAYM1Gm9P7MmWc35U8uqFb7hfNMWRoPu PeX1kGQrv0yK0LJKx3wYiv3QTHz9leux9c56hTlYMge1cTAi4fVlJlw9fdKV65c0zMQV 9m2Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z9-20020a170903018900b001adf0f9cf6fsi8882242plg.303.2023.06.07.04.08.18; Wed, 07 Jun 2023 04:08:34 -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 S239858AbjFGK4P (ORCPT + 99 others); Wed, 7 Jun 2023 06:56:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235203AbjFGK4K (ORCPT ); Wed, 7 Jun 2023 06:56:10 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.102]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A24EB1BDC for ; Wed, 7 Jun 2023 03:56:02 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.31:55208.1520123491 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.31]) by 189.cn (HERMES) with SMTP id DABEB1002AD; Wed, 7 Jun 2023 18:56:00 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-75648544bd-xp9j7 with ESMTP id fb010ee028134a118806a72d5076cfa2 for l.stach@pengutronix.de; Wed, 07 Jun 2023 18:56:01 CST X-Transaction-ID: fb010ee028134a118806a72d5076cfa2 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 , Li Yi Cc: linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Sui Jingfeng , Philipp Zabel , Bjorn Helgaas Subject: [PATCH v8 1/8] drm/etnaviv: add a dedicated function to register an irq handler Date: Wed, 7 Jun 2023 18:55:44 +0800 Message-Id: <20230607105551.568639-2-15330273260@189.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230607105551.568639-1-15330273260@189.cn> References: <20230607105551.568639-1-15330273260@189.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 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 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 patch to extend the driver for the PCI device support. 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 | 34 ++++++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c index de8c9894967c..b9c12d3145a2 100644 --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c @@ -1817,6 +1817,29 @@ 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) { + dev_err(dev, "failed to get irq: %d\n", irq); + 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 +1860,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"); -- 2.25.1