Message ID | 20230407145845.79557-1-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 b10csp342315vqo; Fri, 7 Apr 2023 08:00:32 -0700 (PDT) X-Google-Smtp-Source: AKy350Zl4EIoRpnqv6SF+C2fd9ctL9rJJOBfHPfeFY/txnumqw7RUt7NqN8+6X1HR/cCxklfnQI9 X-Received: by 2002:a17:906:7e0a:b0:93e:9362:75fa with SMTP id e10-20020a1709067e0a00b0093e936275famr2948386ejr.47.1680879632351; Fri, 07 Apr 2023 08:00:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680879632; cv=none; d=google.com; s=arc-20160816; b=jqHtQPbdvewjCXt0iQvanT7vPWVF3wm60bjYc2L/ODhwR05QdNrCb1DGU9QNSWTE7T V19tip9bq8BRBEwaOM6P60/PfPcwTG1v8vnEsAzJyXwzHbweNaEuaS7I7jXdjBjpCVkP JcOJNHfe83wIzK1VbksuINFsJjyUFf7pHH+F3Bi9KFsdCYkR1qTPA9hLbuyh4OxiG1R8 /ab3pjh3ebYk+5mBlMWcftpNWLigXZKbX9xR2+EHLYw1OkO1VVJ0Zh3QSXiokfK6Toqn ORLVX/x8E5UxfIypmqNC+yVn/k24gbeO7JXNTy4tCrShD5EWXTlAn5UIrNkLMmJ3PZi8 tvIQ== 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; bh=gz8nSdVCZmaN9IyAkeyKMZ9K9mgpMCGTGwWRFSJu7uk=; b=qOeFPgSOGjY6C+NHcj3gIHNwm/C44X9A/jQ7lS8c2G7KPK/Xi4QoLRpJgCeHI5IRug 4RKqkURIyuoQ2RceU8St5ub5y/nzZ16ejXziiWaysp/A4dxOt4d67ytKuH2Ie0VPTYiC og1j40R06FUAQfBa76GsKmUlaqZb+W+LN5Y1Hm4H+XK9CMirQgVHZ8We2HcnUzlNkuj5 7hOJcMluwgmyDXzxKQH2Tp/1Dl6oXqbG2xMCFi0bSHkIS9nhMhVYxgNF9am3MA+PYi1t pP0p1SisJ2qi1tA8677r4w8pW2/yX4VvNOF5uDIQcLDEWSSwdWV94tVLRNW0EPvx37BR b+UQ== 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 s7-20020a170906c30700b0093defbd6294si3141160ejz.1051.2023.04.07.08.00.07; Fri, 07 Apr 2023 08: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; 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 S230292AbjDGO66 (ORCPT <rfc822;a1648639935@gmail.com> + 99 others); Fri, 7 Apr 2023 10:58:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229717AbjDGO64 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 7 Apr 2023 10:58:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46030AD14; Fri, 7 Apr 2023 07:58:56 -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 D60B664F3C; Fri, 7 Apr 2023 14:58:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8F06C433D2; Fri, 7 Apr 2023 14:58:52 +0000 (UTC) From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> To: Guenter Roeck <linux@roeck-us.net>, Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@fb.com>, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Jean Delvare <jdelvare@suse.com>, linux-hwmon@vger.kernel.org Subject: [PATCH] nvme: host: hwmon: constify pointers to hwmon_channel_info Date: Fri, 7 Apr 2023 16:58:45 +0200 Message-Id: <20230407145845.79557-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_MED,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?1762530040923089614?= X-GMAIL-MSGID: =?utf-8?q?1762530040923089614?= |
Series |
nvme: host: hwmon: constify pointers to hwmon_channel_info
|
|
Commit Message
Krzysztof Kozlowski
April 7, 2023, 2:58 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>
---
This depends on hwmon core patch:
https://lore.kernel.org/all/20230406203103.3011503-2-krzysztof.kozlowski@linaro.org/
Therefore I propose this should also go via hwmon tree.
Cc: Jean Delvare <jdelvare@suse.com>
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
---
drivers/nvme/host/hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Thanks, applied to nvme-6.4 with a trivial whitespace fix.
On Tue, Apr 11, 2023 at 08:09:00AM +0200, Christoph Hellwig wrote: > Thanks, > > applied to nvme-6.4 with a trivial whitespace fix. Actually, I've dropped this again as it causes this warning: drivers/nvme/host/hwmon.c:221:19: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] This looks like we might need a core hwmon change first.
On 11/04/2023 08:10, Christoph Hellwig wrote: > On Tue, Apr 11, 2023 at 08:09:00AM +0200, Christoph Hellwig wrote: >> Thanks, >> >> applied to nvme-6.4 with a trivial whitespace fix. > > Actually, I've dropped this again as it causes this warning: > > drivers/nvme/host/hwmon.c:221:19: warning: initialization discards ‘const’ > qualifier from pointer target type [-Wdiscarded-qualifiers] > > This looks like we might need a core hwmon change first. The dependency was described in the patch. Guenter also provided a stable branch with the dependency: git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-const Best regards, Krzysztof
On Tue, Apr 11, 2023 at 08:11:41AM +0200, Krzysztof Kozlowski wrote: > The dependency was described in the patch. Guenter also provided > a stable branch with the dependency: Ok. See below for the version with the whitespace and Subject fix I'd like to see. With that: Acked-by: Christoph Hellwig <hch@lst.de> --- From 882410442b1bb5730f3eec29d8dc9ccda5e92cdb Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Date: Fri, 7 Apr 2023 16:58:45 +0200 Subject: nvme-hwmon: constify pointers to hwmon_channel_info 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/nvme/host/hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c index 9e6e56c20ec993..6aa153f3178a60 100644 --- a/drivers/nvme/host/hwmon.c +++ b/drivers/nvme/host/hwmon.c @@ -185,7 +185,7 @@ static umode_t nvme_hwmon_is_visible(const void *_data, return 0; } -static const struct hwmon_channel_info *nvme_hwmon_info[] = { +static const struct hwmon_channel_info *const nvme_hwmon_info[] = { HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ), HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN |
diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c index 9e6e56c20ec9..c0181d6abd6e 100644 --- a/drivers/nvme/host/hwmon.c +++ b/drivers/nvme/host/hwmon.c @@ -185,7 +185,7 @@ static umode_t nvme_hwmon_is_visible(const void *_data, return 0; } -static const struct hwmon_channel_info *nvme_hwmon_info[] = { +static const struct hwmon_channel_info * const nvme_hwmon_info[] = { HWMON_CHANNEL_INFO(chip, HWMON_C_REGISTER_TZ), HWMON_CHANNEL_INFO(temp, HWMON_T_INPUT | HWMON_T_MAX | HWMON_T_MIN |