Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BED57C00A89 for ; Mon, 2 Nov 2020 06:57:32 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2F06422226 for ; Mon, 2 Nov 2020 06:57:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ti.com header.i=@ti.com header.b="W6bNXynC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F06422226 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A128D6E03E; Mon, 2 Nov 2020 06:57:30 +0000 (UTC) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) by gabe.freedesktop.org (Postfix) with ESMTPS id E9D786E03E for ; Mon, 2 Nov 2020 06:57:28 +0000 (UTC) Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 0A26vCQF053237; Mon, 2 Nov 2020 00:57:12 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1604300232; bh=JTo7kayqjYwO3duP000M0zTm0U8KiaUdPxQC6iPTFn0=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=W6bNXynCngzCaYOzXnPt064BEkoP2UUCFr61trX9YBs+EWa0x7B8w8ftw/jVcdA9s +eEXRAH70lwlREVbBbGtiO528L8m9i6rVg04xJCzYO1cZ8P5RVgLB3X8KGaISaWjSB ZPSalIL2hd1I8OIJUpmW95TnauFqzhApn+uiLxwY= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 0A26vCS6000379 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 2 Nov 2020 00:57:12 -0600 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Mon, 2 Nov 2020 00:57:11 -0600 Received: from fllv0040.itg.ti.com (10.64.41.20) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Mon, 2 Nov 2020 00:57:11 -0600 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0040.itg.ti.com (8.15.2/8.15.2) with ESMTP id 0A26v9js028321; Mon, 2 Nov 2020 00:57:09 -0600 Subject: Re: [PATCH] drm/bridge: tpd12s015: Fix irq registering in tpd12s015_probe To: Sam Ravnborg , YueHaibing References: <20201031031648.42368-1-yuehaibing@huawei.com> <20201031071936.GA1044557@ravnborg.org> From: Tomi Valkeinen Message-ID: <57bfde5b-aee1-c15f-896a-63033e86d9a2@ti.com> Date: Mon, 2 Nov 2020 08:57:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20201031071936.GA1044557@ravnborg.org> Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jernej.skrabec@siol.net, jonas@kwiboo.se, airlied@linux.ie, narmstrong@baylibre.com, sebastian.reichel@collabora.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 31/10/2020 09:19, Sam Ravnborg wrote: > Hi YueHaibing > > Thanks for the fix. Appreciated but please update as per comments below. > > On Sat, Oct 31, 2020 at 11:16:48AM +0800, YueHaibing wrote: >> gpiod_to_irq() return negative value in case of error, >> the existing code handle negative error codes wrongly. >> >> Fixes: cff5e6f7e83f ("drm/bridge: Add driver for the TI TPD12S015 HDMI level shifter") >> Signed-off-by: YueHaibing >> --- >> drivers/gpu/drm/bridge/ti-tpd12s015.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/drm/bridge/ti-tpd12s015.c b/drivers/gpu/drm/bridge/ti-tpd12s015.c >> index 514cbf0eac75..a18d5197c16c 100644 >> --- a/drivers/gpu/drm/bridge/ti-tpd12s015.c >> +++ b/drivers/gpu/drm/bridge/ti-tpd12s015.c >> @@ -160,7 +160,7 @@ static int tpd12s015_probe(struct platform_device *pdev) >> >> /* Register the IRQ if the HPD GPIO is IRQ-capable. */ >> tpd->hpd_irq = gpiod_to_irq(tpd->hpd_gpio); >> - if (tpd->hpd_irq) { >> + if (tpd->hpd_irq > 0) { >> ret = devm_request_threaded_irq(&pdev->dev, tpd->hpd_irq, NULL, >> tpd12s015_hpd_isr, >> IRQF_TRIGGER_RISING | > > The current implmentation will skip devm_request_threaded_irq() in case > or error - but continue with the rest of the function. So the > driver fails to return an error code. That is intended. If the HPD gpio supports IRQs (gpiod_to_irq returns a valid number), we use the IRQ. If it doesn't (gpiod_to_irq returns an error), it gets polled via detect(). Both are ok. I don't know if the gpiod_to_irq never returning 0 is something we should rely on. The docs say gpiod_to_irq returns the irq number or an error, so I think checking for >= 0 matches the docs better. Tomi -- Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel