lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Ydtoib+OCyaPhrOH@pendragon.ideasonboard.com>
Date:   Mon, 10 Jan 2022 00:58:17 +0200
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Colin Ian King <colin.i.king@...il.com>
Cc:     Andrzej Hajda <andrzej.hajda@...el.com>,
        Neil Armstrong <narmstrong@...libre.com>,
        Robert Foss <robert.foss@...aro.org>,
        Jonas Karlman <jonas@...boo.se>,
        Jernej Skrabec <jernej.skrabec@...il.com>,
        David Airlie <airlied@...ux.ie>,
        Daniel Vetter <daniel@...ll.ch>,
        Sam Ravnborg <sam@...nborg.org>,
        dri-devel@...ts.freedesktop.org, kernel-janitors@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drm/bridge: adv7533: make array clock_div_by_lanes
 static const

Hi Colin,

Thank you for the patch.

On Sun, Jan 09, 2022 at 08:41:05PM +0000, Colin Ian King wrote:
> Don't populate the read-only array clock_div_by_lanes on the stack but
> instead it static const. Also makes the object code a little smaller.
> 
> Signed-off-by: Colin Ian King <colin.i.king@...il.com>
> ---
>  drivers/gpu/drm/bridge/adv7511/adv7533.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7533.c b/drivers/gpu/drm/bridge/adv7511/adv7533.c
> index eb7579dec40a..ef6270806d1d 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7533.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7533.c
> @@ -29,7 +29,7 @@ static void adv7511_dsi_config_timing_gen(struct adv7511 *adv)
>  	struct mipi_dsi_device *dsi = adv->dsi;
>  	struct drm_display_mode *mode = &adv->curr_mode;
>  	unsigned int hsw, hfp, hbp, vsw, vfp, vbp;
> -	u8 clock_div_by_lanes[] = { 6, 4, 3 };	/* 2, 3, 4 lanes */
> +	static const u8 clock_div_by_lanes[] = { 6, 4, 3 };	/* 2, 3, 4 lanes */

It's not mandatory, but I have a tendency to declare static const
variable first before all mutable variables.

>  
>  	hsw = mode->hsync_end - mode->hsync_start;
>  	hfp = mode->hsync_start - mode->hdisplay;

I wonder if

	/* set pixel clock divider mode */
	regmap_write(adv->regmap_cec, 0x16, (12 / dsi->lanes) << 3);

would be even better, or if it would be too much black magic. Either
way,

Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ