[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <855a4931c8a652f97e83d911b76ccf98a3655c17.camel@nvidia.com>
Date: Wed, 20 Sep 2023 19:29:56 +0000
From: Timur Tabi <ttabi@...dia.com>
To: "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"nouveau@...ts.freedesktop.org" <nouveau@...ts.freedesktop.org>,
"lyude@...hat.com" <lyude@...hat.com>
CC: "keescook@...omium.org" <keescook@...omium.org>,
"daniel@...ll.ch" <daniel@...ll.ch>,
"ruanjinjie@...wei.com" <ruanjinjie@...wei.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"bskeggs@...hat.com" <bskeggs@...hat.com>
Subject: Re: [Nouveau] [PATCH v3 23/44] drm/nouveau/disp: add output backlight
control methods
On Tue, 2023-09-19 at 17:56 -0400, Lyude Paul wrote:
> +static int
> +gt215_sor_bl_set(struct nvkm_ior *ior, int lvl)
> +{
> + struct nvkm_device *device = ior->disp->engine.subdev.device;
> + const u32 soff = nv50_ior_base(ior);
> + u32 div, val;
> +
> + div = nvkm_rd32(device, 0x61c080 + soff);
> + val = (lvl * div) / 100;
Integer promotion rules always throw me for a loop, but since 'lvl' is a
signed integer, and div is a u32, are we sure this won't overflow? Maybe
lvl should be unsigned and val should be a u64?
> + if (div)
> + nvkm_wr32(device, 0x61c084 + soff, 0xc0000000 | val);
Also, maybe calculate 'val' in this if-block?
Powered by blists - more mailing lists