Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp1584175rwi; Thu, 3 Nov 2022 07:00:32 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4p3hmYPUyMcxSHjplvmct619Ye1/RvWxLkxYyaqjK4zCrMqm1719Vq566RWzwypOz47GxD X-Received: by 2002:a63:5063:0:b0:46e:cd36:ce0c with SMTP id q35-20020a635063000000b0046ecd36ce0cmr26787103pgl.617.1667484032407; Thu, 03 Nov 2022 07:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667484032; cv=none; d=google.com; s=arc-20160816; b=ZLL6HW7ep72n7VMKFsTcyHYrJ6W36a6J0cftGQEfqtDzqM/QOz9PhqEVB6VcpqPfk3 hdnEtcPegrbitu+L+SeILIXSgU2RCsiUYZyXJVDdF/HYpNoVmxsDlpu4gcCnjW1+oQZ4 fn4Nxn6vMPFkLKqG1kW+XqovS2Ox9JJTrytAEE6P+E09K5eB+7I4MySxp8s5FOFfbZPP +azxiy2iAJxgHBmus4znceuCYY0VGgr5LsJJRpfjFlMFuyFgszPwhRSOCFqJtstaMcii o5cKAPPRa1kbH3edBvcYgrCk+2jzj/ww+wu0elhxM8Dt8wjRh3WnpdDQqdj3+F4SVDRr JxzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from:dkim-signature; bh=LPYM4+1Cgi0vvAzNR0bzrPwgFE9aUxEe3+BNvxgv+BI=; b=c7rynizimz52B3avoYsgiJ40TF++3sjGBF5ELeitq0uNL0Z0ShFOjvTuL5Wrx1NnPC Oapaa15PCeR6ryRvunwm3pGHXNlOXyq0yzvOK2Y6NyhjMNWOQcsnR6qYBahceyV+1WFJ uFqh1hDnzUssel+CWzeOJP+LO7Kivv2292cTcReepo/FfnCk8pDlQg7JSvLbKxVzVbkR i3jtAzolzdg1X+oE0cZqKsqniiWpmUWEyeAspGLBE1wHgLxN/0o/3ARyX7vUF72F4Cj3 aErWeVYU4XE6/gNHDnmgZxXWt4VTyViXwys8DQXhVUCumXes4yUVpgK0/W+KU3xxM8Ot LQPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gYYukWFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l20-20020a635714000000b0046ff35fa651si1200360pgb.181.2022.11.03.07.00.18; Thu, 03 Nov 2022 07:00:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=gYYukWFS; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231358AbiKCNvN (ORCPT + 97 others); Thu, 3 Nov 2022 09:51:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230111AbiKCNvK (ORCPT ); Thu, 3 Nov 2022 09:51:10 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FD08B1F0; Thu, 3 Nov 2022 06:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667483469; x=1699019469; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=MdJs6GJxG+5C4y1kNW92hXKl7i8pmS2mGPoi5urTFW0=; b=gYYukWFSCIP2WEt2GE4LLlQX0WK5PL94cpE6ME0vqcpKuy29OXmlI3td M6DHb4T8tptA8vbhty8leC1VQR7fJHi3qVFXQP1teynuXBpL/x01uESob eKDvqhRoJozew6erezuQJt39cFU0akKukROFphPCWxf0OQXjDutYTu1// njMwx+I4ghwQIPpJQj6Y804jlym0cDwQusedPTIvaIy5GmH01YhodWTOz 1IDm8pExUSKZNuYdgcwLDi7aU6X+VmwveY5mYXjvkqrKEE5uUkt4ytqt2 xRS9cRgHxaf30FG6mVOtheXyOKnx9RHvdWUtg8D/NlTz5l8jeC7nV4/oM A==; X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="371786827" X-IronPort-AV: E=Sophos;i="5.96,235,1665471600"; d="scan'208";a="371786827" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2022 06:51:08 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10520"; a="667972012" X-IronPort-AV: E=Sophos;i="5.96,235,1665471600"; d="scan'208";a="667972012" Received: from jnikula-mobl4.fi.intel.com (HELO localhost) ([10.237.66.147]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Nov 2022 06:51:05 -0700 From: Jani Nikula To: Colin Ian King , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm/edid: make a couple of read-only arrays static const In-Reply-To: <20221103133730.80940-1-colin.i.king@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20221103133730.80940-1-colin.i.king@gmail.com> Date: Thu, 03 Nov 2022 15:51:01 +0200 Message-ID: <87o7tob0ze.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 03 Nov 2022, Colin Ian King wrote: > Don't populate two read-only arrays on the stack but instead make > them static const . Also makes the object code a little smaller. > > Signed-off-by: Colin Ian King > --- > drivers/gpu/drm/drm_edid.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 4671dc23abe0..50d488cc840e 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -3916,8 +3916,8 @@ static int drm_cvt_modes(struct drm_connector *connector, > struct drm_display_mode *newmode; > struct drm_device *dev = connector->dev; > const struct cvt_timing *cvt; > - const int rates[] = { 60, 85, 75, 60, 50 }; > - const u8 empty[3] = { 0, 0, 0 }; > + static const int rates[] = { 60, 85, 75, 60, 50 }; > + static const u8 empty[3] = { 0, 0, 0 }; The change is fine per se, but I think this whole array is silly. Could be removed with: - if (!memcmp(cvt->code, empty, 3)) + if (!memchr_inv(cvt->code, 0, sizeof(cvt->code))) BR, Jani. PS. I also note that rates[0] is never used, but that's another story, maybe a bug. > > for (i = 0; i < 4; i++) { > int width, height; -- Jani Nikula, Intel Open Source Graphics Center