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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80EDAC001DF for ; Fri, 4 Aug 2023 00:37:02 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 441C986CA7; Fri, 4 Aug 2023 02:36:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cidnw0Hi"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9FCCF8662E; Fri, 4 Aug 2023 02:36:19 +0200 (CEST) Received: from mail-oa1-x2f.google.com (mail-oa1-x2f.google.com [IPv6:2001:4860:4864:20::2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7AFCF866C0 for ; Fri, 4 Aug 2023 02:36:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alvarofernandogarcia@gmail.com Received: by mail-oa1-x2f.google.com with SMTP id 586e51a60fabf-1bf08ca187cso1059405fac.3 for ; Thu, 03 Aug 2023 17:36:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691109375; x=1691714175; 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=NIfsuIqURV1NffrsDwlp6AXwtq18yeURu2gmu87FdBw=; b=cidnw0Hi1G5Ar59Cb8zZqmnhfIQ/YT+tBdyWicNdEyn0L1HSIsKWP3i1ehczPDBpgv Jvst//jRl56lzSZbcYgMCkOzpd1tJwEub2+zWqs8hUTizW+DoSYZh4+HA0w17HG33QWm j4wO0MwcF0JKpc95VXXOAsevEDfu6meYUpj0ZFjYjRQoZvaX1ZbWgXM4TJygla/4nIbI w1uCXdOt52AdzvRo9JnpX3a6HvYSKRWaYpP+OcX3z/PTjXYGJYtP0W6jt53hlkUuB6XI wqUSvI4vwGpZ/ugNPKGDCwKP2scfo8aG0uVV6HdVxtYOJ7U5m7hYj+PQvRv/bN6Sixdd lqeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691109375; x=1691714175; 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=NIfsuIqURV1NffrsDwlp6AXwtq18yeURu2gmu87FdBw=; b=C64GRtOiu5L5ibax/ypafeE8t23W/Vr4o6+EEsyz4m2tJU0yNAPbJ8ZVTRTGZzpGnC 7/KBmkkGJAP8MVVWWC3vp2RRD1MzWeVTMf+ucqshKcKf/2cPQDEyzCZroTq6duB02afa igqGTWD9yhad0MotG2trwTANSf8tHldrc8XTi2bxlga/LRklsvzx591oSPeNA0VZ60fH jwWv6Wr9RftelCiVaddNlL2Tls+XdDDK1woskL10+jlyV2+m46Hivsy2Anw0jGvfkGgs ubrCAyABHrZU1cos5dktPrRx20y0ibtGMIM9NUsSkRt32R5GB8cbju0+u0iBWj0i6Inw f4jA== X-Gm-Message-State: AOJu0YypwiEI8D+Q27VZQyDfwZw7A60qQna39OZtY0JEx+kPsQz6UJAu igVcZOm3HRylWY6+BMU/qnEu1eExOsMf2Q== X-Google-Smtp-Source: AGHT+IF2qnUrJ8RWzwgNoh0BUFSpKHpd9nHjLJkkuj5IPKLaAoqgwvSCbED/yT8kc6jKpd0PEbRECQ== X-Received: by 2002:a05:6870:8a2c:b0:1b3:8d35:c85f with SMTP id p44-20020a0568708a2c00b001b38d35c85fmr295644oaq.1.1691109375694; Thu, 03 Aug 2023 17:36:15 -0700 (PDT) Received: from xenia.fibertel.com.ar ([190.188.68.6]) by smtp.gmail.com with ESMTPSA id eg43-20020a05687098ab00b001bb803c1cb6sm564797oab.11.2023.08.03.17.36.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 17:36:15 -0700 (PDT) From: =?UTF-8?q?Alvaro=20Fernando=20Garc=C3=ADa?= To: U-Boot Mailing List Cc: =?UTF-8?q?Alvaro=20Fernando=20Garc=C3=ADa?= , Anatolij Gustschin Subject: [PATCH 1/1] video: avoid build failure on veyron board Date: Thu, 3 Aug 2023 21:35:38 -0300 Message-ID: <20230804003603.1862321-2-alvarofernandogarcia@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230804003603.1862321-1-alvarofernandogarcia@gmail.com> References: <20230804003603.1862321-1-alvarofernandogarcia@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Fri, 04 Aug 2023 02:36:50 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 533ad9dc avoided an overflow but causes compilation failure on 32bit boards (eg. veyron speedy) this commit uses div_u64 which has a fallback codepath for 32bit platforms Signed-off-by: Alvaro Fernando GarcĂ­a --- drivers/video/pwm_backlight.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c index 46c16a8f44..aa0e292866 100644 --- a/drivers/video/pwm_backlight.c +++ b/drivers/video/pwm_backlight.c @@ -14,6 +14,7 @@ #include #include #include +#include #include /** @@ -59,12 +60,14 @@ struct pwm_backlight_priv { static int set_pwm(struct pwm_backlight_priv *priv) { + u64 width; uint duty_cycle; int ret; if (priv->period_ns) { - duty_cycle = (u64)priv->period_ns * (priv->cur_level - priv->min_level) / - (priv->max_level - priv->min_level); + width = priv->period_ns * (priv->cur_level - priv->min_level); + duty_cycle = div_u64(width, + (priv->max_level - priv->min_level)); ret = pwm_set_config(priv->pwm, priv->channel, priv->period_ns, duty_cycle); } else { -- 2.41.0