From patchwork Wed Jun 7 10:55:44 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: 104430 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp174884vqr; Wed, 7 Jun 2023 04:12:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7e9b/toTobLKYDZNr9aKAjJ6vPbzNTm6D8AbBNLlhHIIw9eghC0fnyWrB6Z0PSsnXR3Pwq X-Received: by 2002:a05:6359:10:b0:125:6f8e:67e9 with SMTP id en16-20020a056359001000b001256f8e67e9mr3208195rwb.18.1686136329920; Wed, 07 Jun 2023 04:12:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686136329; cv=none; d=google.com; s=arc-20160816; b=HU3GBpb8wZkO7pWkuY4LuxNci82KGzEIC1HTWj6aXEQSLuHAjACA2SfEeRcRvHfSAs 1V9aKCAz7/VdT+nWYOPGC4RPwgssmuFK/ynoxsxctpLNEdDczi+ZysllQSYtR/oAvobT ZqGiQ5oyrAQu1jnwR53IwUFJu5EusXuYtIwaNlLz4KSnmK+bLpBTIII9xyKy8JZ3/XHV LKMbJXM+zSJFAdAVsP3RG27lJQXXaPiI8rJdFt0uanOLOyPYBYWNSdWGpkdqgw7terNL xymemPAnVJ11lwMyMzXCjniw7iBbgo+OFDynx+HeeNgh7UBRU7Ts8Luc5AnIwSE9eRJy bWig== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m19-20020a17090a7f9300b00250ce1755e9si983492pjl.14.2023.06.07.04.11.54; Wed, 07 Jun 2023 04:12:09 -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 S239862AbjFGK4Q (ORCPT + 99 others); Wed, 7 Jun 2023 06:56:16 -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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768042088119744273?= X-GMAIL-MSGID: =?utf-8?q?1768042088119744273?= 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");