Message ID | 20230406203530.3012191-7-krzysztof.kozlowski@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1299968vqo; Thu, 6 Apr 2023 14:05:43 -0700 (PDT) X-Google-Smtp-Source: AKy350aNc5pO1TO963zYmkBFUL6/cbq4D1cICzh8TS8Ykp27YSn//8MSY4FTl9alUdN3uK04zHza X-Received: by 2002:a17:902:d4c2:b0:1a1:c6a7:44f5 with SMTP id o2-20020a170902d4c200b001a1c6a744f5mr530155plg.52.1680815142959; Thu, 06 Apr 2023 14:05:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680815142; cv=none; d=google.com; s=arc-20160816; b=nErpJu7xxk9s+lSre3d1+v9sLWPp1LFce58exgga9BMWkVYWNqvbKYxJ0kf2n9Am7O kTHpatN3PVO9eKz5R6OPx4Md8nDqPPhid0XXsrfIKJEt11JUGiKGQrGMJ2SsyLGglWGp 1e9lm8EueW6JG82dvjCv1weFhWxZE4dOhFi/RmoYx4j3Z7gIxuOqxwZjMN5Kv3cDSQ4P jWt8Opr22V26mDpo9x+yYdqWnDjNCjKBtFwoO2D5yWg2JA0n3/oItj9+VY6lv8N4hOPp i6YBCMcDNlKtLtzFk2OabUm4TBHlthwM8JXGp8u1pZVG3sFwt9v8SzGLOUUFU2+e7sLQ 5VAw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=8uBHLKaZ/uJYaNSiIEItEmBSI/TMvhxpB1u3m3wL1Yw=; b=iaiEwSaNgfW91vEzN1rEdveRTQE2r49awTkuLbOE3P6KLxFhc3zjY/HyEx40gQ+8He /dCmf8ihyLANA6KTACKnS1SwQb6Npo146kHqjij8mWlxon7qQqrP4mcD4erAf8fMYilT y9gIZmqh1xhIYz6Z/ezqB2yCbevsPbdpw1ZWOxV+HA0xfwDJgjDtA4tzxgINHUTMNAEj ZFML6CxfL6TBwRjxmzYSwUi56Q1jgCKACWJWFACp5xBAvAKzZZh9FT7Eu/KefmTjdPid jBuiq0BHMAbtRnHR59QHmy0VtPsrW9jHpmeKOfw3a3YSmSs/l8MZMVBJn580ts5+IXYj b61A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id iw18-20020a170903045200b001a1f68ff791si2384497plb.17.2023.04.06.14.05.30; Thu, 06 Apr 2023 14:05:42 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240044AbjDFUln (ORCPT <rfc822;a1648639935@gmail.com> + 99 others); Thu, 6 Apr 2023 16:41:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240004AbjDFUlN (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 6 Apr 2023 16:41:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6C7CB449; Thu, 6 Apr 2023 13:37:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 70B5963F57; Thu, 6 Apr 2023 20:37:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6DAEC4339C; Thu, 6 Apr 2023 20:37:14 +0000 (UTC) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>, Jonathan Corbet <corbet@lwn.net>, Oded Gabbay <ogabbay@kernel.org>, Michael Hennerich <Michael.Hennerich@analog.com>, Aleksa Savic <savicaleksa83@gmail.com>, Jack Doan <me@jackdoan.com>, =?utf-8?q?Nuno_S=C3=A1?= <nuno.sa@analog.com>, Marius Zachmann <mail@mariuszachmann.de>, Wilken Gottwalt <wilken.gottwalt@posteo.net>, =?utf-8?q?Pali_Roh=C3=A1r?= <pali@kernel.org>, Jean-Marie Verdun <verdun@hpe.com>, Nick Hawkins <nick.hawkins@hpe.com>, Xu Yilun <yilun.xu@intel.com>, Tom Rix <trix@redhat.com>, Clemens Ladisch <clemens@ladisch.de>, Rudolf Marek <r.marek@assembler.cz>, Charles Keepax <ckeepax@opensource.cirrus.com>, Richard Fitzgerald <rf@opensource.cirrus.com>, Ibrahim Tilki <Ibrahim.Tilki@analog.com>, Avi Fishman <avifishman70@gmail.com>, Tomer Maimon <tmaimon77@gmail.com>, Tali Perry <tali.perry1@gmail.com>, Patrick Venture <venture@google.com>, Nancy Yuen <yuenn@google.com>, Benjamin Fair <benjaminfair@google.com>, Jonas Malaco <jonas@protocubo.io>, Aleksandr Mezin <mezin.alexander@gmail.com>, Derek John Clark <derekjohn.clark@gmail.com>, =?utf-8?q?Joaqu=C3=ADn_Ignaci?= =?utf-8?q?o_Aramend=C3=ADa?= <samsagax@gmail.com>, Iwona Winiarska <iwona.winiarska@intel.com>, Florian Fainelli <f.fainelli@gmail.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Hans de Goede <hdegoede@redhat.com>, Michael Walle <michael@walle.cc>, Lars Povlsen <lars.povlsen@microchip.com>, Steen Hegelund <Steen.Hegelund@microchip.com>, Daniel Machon <daniel.machon@microchip.com>, UNGLinuxDriver@microchip.com, Agathe Porte <agathe.porte@nokia.com>, Eric Tremblay <etremblay@distech-controls.com>, Robert Marko <robert.marko@sartura.hr>, linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, patches@opensource.cirrus.com, openbmc@lists.ozlabs.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Subject: [PATCH 48/68] hwmon: nzxt: constify pointers to hwmon_channel_info Date: Thu, 6 Apr 2023 22:35:29 +0200 Message-Id: <20230406203530.3012191-7-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230406203103.3011503-1-krzysztof.kozlowski@linaro.org> References: <20230406203103.3011503-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762462419359611942?= X-GMAIL-MSGID: =?utf-8?q?1762462419359611942?= |
Series |
hwmon: constify pointers to hwmon_channel_info
|
|
Commit Message
Krzysztof Kozlowski
April 6, 2023, 8:35 p.m. UTC
Statically allocated array of pointed to hwmon_channel_info can be made
const for safety.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
drivers/hwmon/nzxt-kraken2.c | 2 +-
drivers/hwmon/nzxt-smart2.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Comments
On Thu, Apr 6, 2023 at 11:37 PM Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > -static const struct hwmon_channel_info *nzxt_smart2_channel_info[] = { > +static const struct hwmon_channel_info * const nzxt_smart2_channel_info[] = { In the rest of nzxt-smart2.c there are spaces only before "*", not on both sides (and there are a few "*const" already). Would be nice to keep it consistent. The same seems to be true for nzxt-kraken2.c (although I'm not a maintainer)
On Sat, Apr 08, 2023 at 06:14:19AM +0300, Aleksandr Mezin wrote: > On Thu, Apr 6, 2023 at 11:37 PM Krzysztof Kozlowski > <krzysztof.kozlowski@linaro.org> wrote: > > -static const struct hwmon_channel_info *nzxt_smart2_channel_info[] = { > > +static const struct hwmon_channel_info * const nzxt_smart2_channel_info[] = { > > In the rest of nzxt-smart2.c there are spaces only before "*", not on > both sides (and there are a few "*const" already). Would be nice to > keep it consistent. The same seems to be true for nzxt-kraken2.c > (although I'm not a maintainer) While I don't have a strong preference for either `* const` or `*const`, it would be prefereable to use a single style in any given file. As the kernel seems to favor the former style: $ rg -F '*const ' | wc -l 2593 $ rg -F '* const ' | wc -l 15359 it would be better to change the other two locations in nzxt-kraken2.c to also use `* const`.
diff --git a/drivers/hwmon/nzxt-kraken2.c b/drivers/hwmon/nzxt-kraken2.c index 89f7ea4f42d4..428c77b5fce5 100644 --- a/drivers/hwmon/nzxt-kraken2.c +++ b/drivers/hwmon/nzxt-kraken2.c @@ -86,7 +86,7 @@ static const struct hwmon_ops kraken2_hwmon_ops = { .read_string = kraken2_read_string, }; -static const struct hwmon_channel_info *kraken2_info[] = { +static const struct hwmon_channel_info * const kraken2_info[] = { HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_LABEL), HWMON_CHANNEL_INFO(fan, diff --git a/drivers/hwmon/nzxt-smart2.c b/drivers/hwmon/nzxt-smart2.c index e5edf8071f39..7aa586eb74be 100644 --- a/drivers/hwmon/nzxt-smart2.c +++ b/drivers/hwmon/nzxt-smart2.c @@ -663,7 +663,7 @@ static const struct hwmon_ops nzxt_smart2_hwmon_ops = { .write = nzxt_smart2_hwmon_write, }; -static const struct hwmon_channel_info *nzxt_smart2_channel_info[] = { +static const struct hwmon_channel_info * const nzxt_smart2_channel_info[] = { HWMON_CHANNEL_INFO(fan, HWMON_F_INPUT | HWMON_F_LABEL, HWMON_F_INPUT | HWMON_F_LABEL, HWMON_F_INPUT | HWMON_F_LABEL),