Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3376185rwd; Sat, 3 Jun 2023 04:18:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7NOMMVwyhmTBO34kjz9gaZl4jWD+sXIg1jnw7P7f9Ldhy//7A8ZnHHnMYuJEjxuh27gXNC X-Received: by 2002:a17:90b:817:b0:256:ae6e:993d with SMTP id bk23-20020a17090b081700b00256ae6e993dmr2697413pjb.1.1685791139353; Sat, 03 Jun 2023 04:18:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685791139; cv=none; d=google.com; s=arc-20160816; b=0ADdNl50cJumUj9Hg9PGdbM7cHhDZZ141SOdUhGjmG93FyPF60Z0wN5jZSmN3IzSLe vd4T+/mS+0uxKfeby8OiLF7O5XWP+ZXWA6UA0hhrDxyR0ssp51iEww0X1udhAEH4c9C2 CpbOvn/P+WgFSexav4c0QDkFlD5PdSsmaG6e9cx2vI1gjuJtFG7XlrFVUsinmt1fXWHY nyxGPUSqiaHSZB5tuWgTgKlEdXfvixX5aF74EjgUGCsyWFwPP5+2h5fop6T91BXGGTLe 3D/oYpwKUXBSRa+tdDcotUQCTOzROomzqQrAyp3Nu3HR3ymQG3m3omtNSnLC+G277Su1 p9UQ== 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=kqnJsqXUbHaYvBkRjOgecB9z2kzUIUo/LeB77D69mf0=; b=sHNQJWeDCXNHMvmmlQYc7odewmM9bNMhKBT7wRloGC5d3u/5d8AdF5LEU6I8fcJq7n VKHlsLw13D4gohp7+/5Y7im22fw6efb88z5Fu8qR2c9MLcc5A+tIetT0i9kZ0CZMn9+j IeSOt9PIbZoipvmOZ6QZr5f+0ILJYhxMdWki1XsoUTkDmmgF4YTqxH0zaCu49k7gWkOE pRjN71bITZvv5CTmMi5+Uh5qicMKZbH9wN4/yHR5OfnoqJiji8cfwmPe85XCo/LjVyGM kP3o8gZALXdy0lju9MKa3NtJWdfRr2S1Z6xdwwvDLZLev3b/foSmPqYvhcmbRudm7Sm7 3y4g== 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 k137-20020a633d8f000000b0053fee168aabsi2573118pga.742.2023.06.03.04.18.34; Sat, 03 Jun 2023 04:18:59 -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 S232110AbjFCLAO (ORCPT + 99 others); Sat, 3 Jun 2023 07:00:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbjFCLAK (ORCPT ); Sat, 3 Jun 2023 07:00:10 -0400 Received: from 189.cn (ptr.189.cn [183.61.185.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DA166E1 for ; Sat, 3 Jun 2023 04:00:06 -0700 (PDT) HMM_SOURCE_IP: 10.64.8.43:51732.1826327623 HMM_ATTACHE_NUM: 0000 HMM_SOURCE_TYPE: SMTP Received: from clientip-114.242.206.180 (unknown [10.64.8.43]) by 189.cn (HERMES) with SMTP id E0446100239; Sat, 3 Jun 2023 19:00:05 +0800 (CST) Received: from ([114.242.206.180]) by gateway-151646-dep-75648544bd-7vx9t with ESMTP id c23bd1fc2e904056b40e5c6747f144d1 for l.stach@pengutronix.de; Sat, 03 Jun 2023 19:00:05 CST X-Transaction-ID: c23bd1fc2e904056b40e5c6747f144d1 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 , Christian Gmeiner , Daniel Vetter , Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Sui Jingfeng Subject: [PATCH v7 1/7] drm/etnaviv: add a dedicated function to register an irq handler Date: Sat, 3 Jun 2023 18:59:37 +0800 Message-Id: <20230603105943.3042766-2-15330273260@189.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230603105943.3042766-1-15330273260@189.cn> References: <20230603105943.3042766-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. 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..636d3f39ddcb 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 handler registered, irq = %d\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