From patchwork Sun Sep 24 19:26:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Jernej_=C5=A0krabec?= X-Patchwork-Id: 13397068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 39EFBCE7A8A for ; Sun, 24 Sep 2023 19:26:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Ry6e+a3ZWPOexne2HoYMv3TrOyBPWKKu8YC7hYKNkeY=; b=eoX7ZfjHc0qpzE 77lFp7g8kyWxC+VOmTtt5NUuW0DdqWAavbKOzHdkX5Qic+aK/bQ5PjX4owW61i6NGF14yRzWW+F5s RjXu6H352eP3WKyNLIUB/DDxZfvcYcwZVQuRygOaptU7ipzXN3Ovkj/4LleLHoWmQQpXYKX3ueQMw CAfuWmeaYq7QkVtlYawfFqu40mY2Jdhd80hjFYlUR3dB5GH/8t96YLGi+edYc5r5PZ3KJQNF543Xr VwBoJxcP1DECoKeuxfo/4vMPUOe7Ytw+rqZ5GuU/UQW/XqEDikuhibVf317nL9KmlZ97Mce06rij3 acDT21/Y3551nsr8VrQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qkUkM-00CgZP-1x; Sun, 24 Sep 2023 19:26:26 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qkUkG-00CgWK-2w for linux-arm-kernel@lists.infradead.org; Sun, 24 Sep 2023 19:26:22 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-9ad8d47ef2fso617119066b.1 for ; Sun, 24 Sep 2023 12:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695583578; x=1696188378; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LyCnYDXrBkQd8nc6ex8m6+Z4ml6K8C/rEJGtjuolnss=; b=DvISNWQXGsGH15tbX/2WFOm5LoHYneOvluvUuNAgvCdFD6AQedCyGnLyI4eoG4+B7W +zJ+UtiwnAJyaCZHBCIuLkAuxF1YGdOGjfucgRrdwGH+W/+GLmf0LLq9IgrqZGbT9tW5 BcwLYQAQQWWNC6iDwtwTiMGDrMhBDws02ePT4hviE5GqOe8PwWlid84DOoGBwOm7tYne crSdW1cTpXp6zRi/eSPlPc3tnGw/GuH3nS1zNEFAFeEVMd94fb1yY+joaJMpwuF+2pPm XBll/Oq6AjFfBFnpGxweGIiGhYkRHJwE0sfgJRABSj1YOfk7WvgW3nVO6p0amGVHzqvG 8RYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695583578; x=1696188378; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LyCnYDXrBkQd8nc6ex8m6+Z4ml6K8C/rEJGtjuolnss=; b=NWF7WAJOF/ps5H7BRo1FxBrGQQhy7AE4Xf/Ds7ucbr/GzU8M3bRG207gjbypzQQR3i I1rGn3zkq1Tsx8YHkhnyG6Sx29WFhIUpo6NROWWI2P2R2TbZGCT03qTTfmWR/Gw3Mldx RFA/ZWDSKjgzZc0wRO6HK6MCSchB28h+WSFfPvu7GUN4hRNI9KXJj9G+kp3byggm6oes 51j0huZKxCpo5EN5vIiLmM57/MZfXodkaK9SCoyW/Wfe2R+hA9gW3Ja3SiEwt0nV639L 7WX8zIc/UhU4myPxL04/JeQ4PWf99NCRSp5b1SakZpfCH8yBJPS30MfPFKTxeh1ZNdFj jABg== X-Gm-Message-State: AOJu0YzUOkk2Qa1/x2epKy4/L1vpvNw4cH8e3WNnbQphtZpEqGTc1W1o 8hFAxvAMPX+9FUhBXBgy6RU= X-Google-Smtp-Source: AGHT+IHCd1BgUV+vVYd3ZH8172gAFJIE1DUEWCbKCJthb4PpjhafqLcGbcOPCGbl9m5xDtLEBPKB7g== X-Received: by 2002:a17:907:7715:b0:9ae:6a8b:f8aa with SMTP id kw21-20020a170907771500b009ae6a8bf8aamr3983876ejc.26.1695583578522; Sun, 24 Sep 2023 12:26:18 -0700 (PDT) Received: from localhost.localdomain (82-149-12-148.dynamic.telemach.net. [82.149.12.148]) by smtp.gmail.com with ESMTPSA id z21-20020a1709063a1500b0099d0c0bb92bsm5317632eje.80.2023.09.24.12.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 12:26:18 -0700 (PDT) From: Jernej Skrabec To: mripard@kernel.org, wens@csie.org Cc: airlied@gmail.com, daniel@ffwll.ch, samuel@sholland.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, Jernej Skrabec Subject: [PATCH 6/7] drm/sun4i: dw-hdmi: Make sun8i_hdmi_phy_get() more intuitive Date: Sun, 24 Sep 2023 21:26:03 +0200 Message-ID: <20230924192604.3262187-7-jernej.skrabec@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230924192604.3262187-1-jernej.skrabec@gmail.com> References: <20230924192604.3262187-1-jernej.skrabec@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230924_122620_946178_74592816 X-CRM114-Status: GOOD ( 16.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Let's make sun8i_hdmi_phy_get() to behave more like other kernel functions and return phy pointer instead of setting field in struct. This also makes function more universal. Signed-off-by: Jernej Skrabec --- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c | 5 +++-- drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h | 2 +- drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c | 10 ++++------ 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c index d93e8ff71aae..41f815a1faec 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c @@ -239,10 +239,11 @@ static int sun8i_dw_hdmi_bind(struct device *dev, struct device *master, goto err_disable_clk_tmds; } - ret = sun8i_hdmi_phy_get(hdmi, phy_node); + hdmi->phy = sun8i_hdmi_phy_get(phy_node); of_node_put(phy_node); - if (ret) { + if (IS_ERR(hdmi->phy)) { dev_err(dev, "Couldn't get the HDMI PHY\n"); + ret = PTR_ERR(hdmi->phy); goto err_disable_clk_tmds; } diff --git a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h index 21e010deeb48..748b6a4d9cdd 100644 --- a/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h @@ -200,7 +200,7 @@ encoder_to_sun8i_dw_hdmi(struct drm_encoder *encoder) return container_of(encoder, struct sun8i_dw_hdmi, encoder); } -int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node); +struct sun8i_hdmi_phy *sun8i_hdmi_phy_get(struct device_node *node); int sun8i_hdmi_phy_init(struct sun8i_hdmi_phy *phy); void sun8i_hdmi_phy_deinit(struct sun8i_hdmi_phy *phy); diff --git a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c index f917a979e4a4..1c9bdefed35e 100644 --- a/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c +++ b/drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c @@ -650,25 +650,23 @@ static const struct of_device_id sun8i_hdmi_phy_of_table[] = { { /* sentinel */ } }; -int sun8i_hdmi_phy_get(struct sun8i_dw_hdmi *hdmi, struct device_node *node) +struct sun8i_hdmi_phy *sun8i_hdmi_phy_get(struct device_node *node) { struct platform_device *pdev = of_find_device_by_node(node); struct sun8i_hdmi_phy *phy; if (!pdev) - return -EPROBE_DEFER; + return ERR_PTR(-EPROBE_DEFER); phy = platform_get_drvdata(pdev); if (!phy) { put_device(&pdev->dev); - return -EPROBE_DEFER; + return ERR_PTR(-EPROBE_DEFER); } - hdmi->phy = phy; - put_device(&pdev->dev); - return 0; + return phy; } static int sun8i_hdmi_phy_probe(struct platform_device *pdev)