From patchwork Thu Apr 16 13:24:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 227862 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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT 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 43DF4C2BB55 for ; Thu, 16 Apr 2020 13:42:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 13ECD2076D for ; Thu, 16 Apr 2020 13:42:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044561; bh=cPcVth3C/ecITib/wFDwsrdywlBZ+L1o5W0YguVVgSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZxZkqDSXwKzMkMl03IIBddgGaD0ruOG7mgtvaE2CFjcrtzmdixKho6I32r5VZ8tMh H6Af6tewqSRGyiBLiDPfrt9mYHxU3QYzv1FEQRCjfhMOWaWvNej1mphE8XYbDWiwi6 KiDZMGWycbGBlYHDJ2DPQAfRoY4no0wRQtfm30Lc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441543AbgDPNmj (ORCPT ); Thu, 16 Apr 2020 09:42:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:55618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2441524AbgDPNmf (ORCPT ); Thu, 16 Apr 2020 09:42:35 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4DA0F218AC; Thu, 16 Apr 2020 13:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587044554; bh=cPcVth3C/ecITib/wFDwsrdywlBZ+L1o5W0YguVVgSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MxKSL2UBtxLm59ZsnEvasOMAT+tGLoPJAblbIXi5qnErrlsqXX+jwUqzzkrBAsU0n xRGZmYHb0WqGpkTmmFmzIsK+bH+hZic3dD+w1TnL4lOwm+Fs/JLWH5ymr5sUbO3PIB C8I0WX3Q8C5U8yjWziGVN70ranijeWrE8JZEJ8eI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Torsten Duwe , Thierry Reding , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Thomas Zimmermann , Sasha Levin Subject: [PATCH 5.5 246/257] drm/bridge: analogix-anx78xx: Fix drm_dp_link helper removal Date: Thu, 16 Apr 2020 15:24:57 +0200 Message-Id: <20200416131356.465132016@linuxfoundation.org> X-Mailer: git-send-email 2.26.1 In-Reply-To: <20200416131325.891903893@linuxfoundation.org> References: <20200416131325.891903893@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Torsten Duwe [ Upstream commit 3e138a63d6674a4567a018a31e467567c40b14d5 ] drm_dp_link_rate_to_bw_code and ...bw_code_to_link_rate simply divide by and multiply with 27000, respectively. Avoid an overflow in the u8 dpcd[0] and the multiply+divide alltogether. Signed-off-by: Torsten Duwe Fixes: ff1e8fb68ea0 ("drm/bridge: analogix-anx78xx: Avoid drm_dp_link helpers") Cc: Thierry Reding Cc: Daniel Vetter Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Cc: # v5.5+ Reviewed-by: Thierry Reding Signed-off-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20200218155744.9675368BE1@verein.lst.de Signed-off-by: Sasha Levin --- drivers/gpu/drm/bridge/analogix-anx78xx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix-anx78xx.c b/drivers/gpu/drm/bridge/analogix-anx78xx.c index 274989f96a916..914263a1afab4 100644 --- a/drivers/gpu/drm/bridge/analogix-anx78xx.c +++ b/drivers/gpu/drm/bridge/analogix-anx78xx.c @@ -866,10 +866,9 @@ static int anx78xx_dp_link_training(struct anx78xx *anx78xx) if (err) return err; - dpcd[0] = drm_dp_max_link_rate(anx78xx->dpcd); - dpcd[0] = drm_dp_link_rate_to_bw_code(dpcd[0]); err = regmap_write(anx78xx->map[I2C_IDX_TX_P0], - SP_DP_MAIN_LINK_BW_SET_REG, dpcd[0]); + SP_DP_MAIN_LINK_BW_SET_REG, + anx78xx->dpcd[DP_MAX_LINK_RATE]); if (err) return err;