Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3304140rdg; Tue, 17 Oct 2023 10:17:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFW+RH43hoXf4KgH2knlh7fIdcHDA1dr5qmukg0+0IFcIhuuA82d17BVVHvNk6On+Exwwbt X-Received: by 2002:a05:6a21:3e01:b0:16c:b5be:5f6c with SMTP id bk1-20020a056a213e0100b0016cb5be5f6cmr2497509pzc.54.1697563033806; Tue, 17 Oct 2023 10:17:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697563033; cv=none; d=google.com; s=arc-20160816; b=YiLe8pzaBSx/GNIJ0C9AFC0uZtM9PTAFEFTIph+48ccdNtyRnUacHgwyp7EFoAkUFF Qixvyyc4iDtDUuE1VGbeKQzxE2caJJno1TyL8Wxo+Z6rnrEKtOrFK5A0+q4mPhS9e4R3 lYIgnSZWhXjnHOXxbUsqW+7x+voi1h/BQsgOv6hoJSyP9c2BwKLEAczRFf1I3OXcz+8E OWb8IFsy2f7OL/7VWdL2yLxkzQju8/jdIBdA8d02cziRcra7UOUqUIwxsTUenwiTiOrW jk3vlQchzaZaI6jKB/2VeSTgUmmI/Z7nTo4JYu5rPBGgDGXgGV9K+f7MxJEgSgJbdRip O2Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=IYoT3W04IrhjBaHMC+q53PN/kEQ0V1Lm63ZKZoqvGHY=; fh=Gd/2snmk4iSPFJUOc9gsB7uWSKh2bHTKZZsZCa9ERxo=; b=qciHfn7NKuqgW5zdU/rrFrIcZ4TTZTOzR2UjsRm6aPvK61bdOMZhMamkNkpnzrTv4l sxGq81LaRuAh/FSOFMqO+DgmCTpPTox709YJWv9diMR3WZqsnTT13w47/754WCvnCGXb Rx+sYGj4zX8NrPfft5XrvjYmEk3UgUgkCDF6ueW2SoBfzJf1F2aSk2kA4jN5zWzTRILm J+kmpK1SuoCyEyk0u0OWw5Zi9qeejaRC0s4C0nowBgP2CAUhobgtcPIYNt96QbVqU/WY h1ekhATCuFWuC46JiBwwPsQGg9kensh5ls7QjbVk5tsLsoX/CTMeQ+JFnhLEMj1ygmV4 J6Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=foo5A4QA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id f26-20020a63381a000000b00573fc71f6d9si199896pga.64.2023.10.17.10.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 10:17:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=foo5A4QA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A1A1A80209E8; Tue, 17 Oct 2023 10:17:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234794AbjJQRRB (ORCPT + 99 others); Tue, 17 Oct 2023 13:17:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232644AbjJQRRA (ORCPT ); Tue, 17 Oct 2023 13:17:00 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A2B594; Tue, 17 Oct 2023 10:16:59 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id 2adb3069b0e04-507c5249d55so473834e87.3; Tue, 17 Oct 2023 10:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697563017; x=1698167817; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=IYoT3W04IrhjBaHMC+q53PN/kEQ0V1Lm63ZKZoqvGHY=; b=foo5A4QAnSrC3i0EcRw0Pbo+7xNtw5SgNIRClSV9/27tTIVUJJBUKrStge4dg1cNiH 3KFonxr5OcHQWVeusoQa5IG+xRNONJ383rBkYlf3ziSAiqf4C0bOk39FC7Ri8cTRYa0x CASYHrY3B50D5xE6sM1BVF8M6PWgRg0okz98OO+sA+GDqcBoTR0dSZGLObOowwBWYPv+ Nx4FPBTAGXxU0ydSVRK1AaphGy+7ZKOQAOSGVu1ZXXVnLS0MzbLiiON6T6qErN31zal7 Ck/mWNVIqr1dCQI9dzQ7N+24pMEAFZCMw2iVcTW/Q0UFbMX7mpIpOafjC6q9CjjkXjI4 EOCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697563017; x=1698167817; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IYoT3W04IrhjBaHMC+q53PN/kEQ0V1Lm63ZKZoqvGHY=; b=GKHyIW0KTr2W9tlLeMsQMjdex7Y3Ayo3NDzpNRrHhZRsSsN1LhfZ/rFPp5LCXFPhrD Csb3ibd0r0531zrOq0wIj6r9y4qOMzqpmcpYuLucZWECwk6hXaJGVwupv5xIz2gk9JTI DZcINHI7MkHLsmj2tfXof9f/ERCbZ6+hwyLB6NgE2MzRaSfHVNjVJqLoLh4CzgUAdeTx IjQ1L7HDw8tE1WZC80lrs4t5Wp3VRzhPCvk+NOhOkYmJMQVS4eTEsk0GkECX/0/oEwNl k99eyDON2ki0pLrYvRqn9/WCDjCFUQ3iZoaVwqiGaIhxK8j+6YaTBTBj+OYK1+FGYDNC 9VKw== X-Gm-Message-State: AOJu0Yyj6xLOERcDZmMt7skwAItM1El8bDRI0GxaeDsS9EWJ5kaiDKnk 3cn1jj9sjY/6mJIhdMPoQfs= X-Received: by 2002:a05:6512:3102:b0:507:9b70:1f0e with SMTP id n2-20020a056512310200b005079b701f0emr2460991lfb.24.1697563017147; Tue, 17 Oct 2023 10:16:57 -0700 (PDT) Received: from localhost (cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net. [80.193.200.194]) by smtp.gmail.com with ESMTPSA id iv13-20020a05600c548d00b004064cd71aa8sm2415838wmb.34.2023.10.17.10.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 10:16:56 -0700 (PDT) From: Colin Ian King To: "Rafael J . Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Matthias Brugger , AngeloGioacchino Del Regno , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] thermal: lvts: make some read-only arrays static const Date: Tue, 17 Oct 2023 18:16:55 +0100 Message-Id: <20231017171655.177096-1-colin.i.king@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 17 Oct 2023 10:17:11 -0700 (PDT) Don't populate the read-only arrays on the stack, instead make them static const. Make lvts_write_config parameters cmds and nr_cmds const too. Signed-off-by: Colin Ian King --- drivers/thermal/mediatek/lvts_thermal.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c index 877a0e5ac3fd..b20e69cb466f 100644 --- a/drivers/thermal/mediatek/lvts_thermal.c +++ b/drivers/thermal/mediatek/lvts_thermal.c @@ -308,7 +308,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp) static void lvts_update_irq_mask(struct lvts_ctrl *lvts_ctrl) { - u32 masks[] = { + static const u32 masks[] = { LVTS_MONINT_OFFSET_SENSOR0, LVTS_MONINT_OFFSET_SENSOR1, LVTS_MONINT_OFFSET_SENSOR2, @@ -400,7 +400,7 @@ static irqreturn_t lvts_ctrl_irq_handler(struct lvts_ctrl *lvts_ctrl) { irqreturn_t iret = IRQ_NONE; u32 value; - u32 masks[] = { + static const u32 masks[] = { LVTS_INT_SENSOR0, LVTS_INT_SENSOR1, LVTS_INT_SENSOR2, @@ -781,7 +781,7 @@ static int lvts_ctrl_init(struct device *dev, struct lvts_domain *lvts_td, * each write in the configuration register must be separated by a * delay of 2 us. */ -static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, u32 *cmds, int nr_cmds) +static void lvts_write_config(struct lvts_ctrl *lvts_ctrl, const u32 *cmds, const int nr_cmds) { int i; @@ -865,7 +865,8 @@ static int lvts_ctrl_set_enable(struct lvts_ctrl *lvts_ctrl, int enable) static int lvts_ctrl_connect(struct device *dev, struct lvts_ctrl *lvts_ctrl) { - u32 id, cmds[] = { 0xC103FFFF, 0xC502FF55 }; + u32 id; + static const u32 cmds[] = { 0xC103FFFF, 0xC502FF55 }; lvts_write_config(lvts_ctrl, cmds, ARRAY_SIZE(cmds)); @@ -889,7 +890,7 @@ static int lvts_ctrl_initialize(struct device *dev, struct lvts_ctrl *lvts_ctrl) /* * Write device mask: 0xC1030000 */ - u32 cmds[] = { + static const u32 cmds[] = { 0xC1030E01, 0xC1030CFC, 0xC1030A8C, 0xC103098D, 0xC10308F1, 0xC10307A6, 0xC10306B8, 0xC1030500, 0xC1030420, 0xC1030300, 0xC1030030, 0xC10300F6, 0xC1030050, 0xC1030060, 0xC10300AC, -- 2.39.2