Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6321484rwd; Mon, 19 Jun 2023 05:50:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ64w9JuKyjw4CBKJb39dyncNlg6s3oTgIeagxoBpqwDyK5CPtDKfqD03AGv0DXPqvkZ5zEX X-Received: by 2002:aca:2b18:0:b0:39e:b60a:7594 with SMTP id i24-20020aca2b18000000b0039eb60a7594mr5157298oik.17.1687179027500; Mon, 19 Jun 2023 05:50:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687179027; cv=none; d=google.com; s=arc-20160816; b=Fq9tMKiQTsj+vgk+ZAUe3cGaHvSi09Tx0eFZqorTTVyozQWfQ806d9VXQ/6QHYb7ZO Tx8FImkACPOB5JlGGk1O8z3nIG9SbMrxZmI3YEOu/1sJ2mBF5+dqjp3HtH9iBkV2Urhl sogfSe7NDwf64izLTJQwZpcU9zdugbv4O9Mmioa81afDxFkxSyvaqnGS5H1Xn08cPC09 BzC+n9jFly3wd6kSHxFhC1clByhONWEwGKYnMRhWeORuD9Ym4hPyGOTxc/F2L+ovUqfg ebHFDQWauuUo+Q2mzx+A3zUg2MtPnZVPkUmWW3AHcUemC29y03kvnaZXIPAPvN34h8c2 hBqw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu25-20020a632959000000b005529b8e496bsi8836199pgb.436.2023.06.19.05.50.12; Mon, 19 Jun 2023 05:50:27 -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 S230305AbjFSMmO (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 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,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 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"); -- 2.25.1