From patchwork Thu Jul 29 10:40:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489109 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1925C4338F for ; Thu, 29 Jul 2021 10:40:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A64BE60720 for ; Thu, 29 Jul 2021 10:40:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236065AbhG2Kkk (ORCPT ); Thu, 29 Jul 2021 06:40:40 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:47712 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235880AbhG2Kkj (ORCPT ); Thu, 29 Jul 2021 06:40:39 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id 578FA3F239 for ; Thu, 29 Jul 2021 10:40:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555235; bh=2+MASfDeMXItUy0KRRU6qIh2N4zib4Lrz4DxPbXJr60=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=A8W42v4KoNY2p8NkFhp0mtMxil1RQC4pu9cte5lTrt1XD0539BEgQB7PK6aN6ZYP6 uKH8w+ZyweDyj5M0Wz1AUqw8IX+K1BzCHq/7c4ze53HhMYT9RsFxw9PhD5FpXzdMbI FEQUyRRrCvYY2fBUtUsebDMlFPly9E7A/WFVUZSrgmrm/It0TKIg95gRzdkdgAy2+e ThACAkGKQCGNhA1TuHUlZvOmM30cYPz/Tj97HxxLkuK2q79DuGYTg74wdFS+Lz+etD S9yfErz6RP/RmowefzlgXKlnIgtpVqjW9Z3AVnkzUAYQ+VNLOHqFzwq2Noyapq9aX5 IsuZ4qUNPbY4g== Received: by mail-ej1-f70.google.com with SMTP id ju25-20020a17090798b9b029058c24b55273so1853398ejc.8 for ; Thu, 29 Jul 2021 03:40:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2+MASfDeMXItUy0KRRU6qIh2N4zib4Lrz4DxPbXJr60=; b=KXQgHe+iVyhxuLm2paympKlIhQOCQDDKMImdd3Djgvv9dsNIxXFnsTbpTfsiK1YU1y I1R+nZaVIza4t1fBbp0KieE6sVvbFjXWijrcvPkaA6OojuKl43D6YmNMDm77x9UWH+hu oKdQJmT+3g3W5wWOMrJABT5bO0njvriFEtzI//+oMNSLXo/mKzEjLkXlfqwBJwAD+W4n lMt6UlBS7A9aprnWhKVA36ju1ruQPRBq8W8J7J89KL7qcK5f2oKVemrMd7hASyN32TD7 3RIgofKUXWm530ouEmVc4+bU/FnnEfzEAy2DqJC2i9lfwZKuUrbLWNCI0coI5i111RDv cdIA== X-Gm-Message-State: AOAM530OiOuE1sZ+HsUpNOqTxgmkvDqYFEEaHlJvGPNDavvFv+c6OYBa joqEr5p/rvbspl7uU6SRl/iYYImNxE3QI12Myl2TGxwbtwmMl9shTpmZjRUHxlW/LXQwf8S8fLA Rb59OK8ygAQ2LmBP0pmgib+cVkude9E3GjI69Xv4jBFOI X-Received: by 2002:a05:6402:b83:: with SMTP id cf3mr5240275edb.12.1627555235120; Thu, 29 Jul 2021 03:40:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwJDOdp8Ic5sbEoP+ybcJEGMi8R0A1BITHI63lRz6KY4s1GLDvMBVi9ewCQtp/6p2bmUkfPA== X-Received: by 2002:a05:6402:b83:: with SMTP id cf3mr5240255edb.12.1627555234989; Thu, 29 Jul 2021 03:40:34 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:34 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 01/12] nfc: constify passed nfc_dev Date: Thu, 29 Jul 2021 12:40:11 +0200 Message-Id: <20210729104022.47761-2-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The struct nfc_dev is not modified by nfc_get_drvdata() and nfc_device_name() so it can be made a const. Signed-off-by: Krzysztof Kozlowski --- include/net/nfc/nfc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/net/nfc/nfc.h b/include/net/nfc/nfc.h index c9ff341d57e4..5dee575fbe86 100644 --- a/include/net/nfc/nfc.h +++ b/include/net/nfc/nfc.h @@ -245,7 +245,7 @@ static inline void nfc_set_drvdata(struct nfc_dev *dev, void *data) * * @dev: The nfc device */ -static inline void *nfc_get_drvdata(struct nfc_dev *dev) +static inline void *nfc_get_drvdata(const struct nfc_dev *dev) { return dev_get_drvdata(&dev->dev); } @@ -255,7 +255,7 @@ static inline void *nfc_get_drvdata(struct nfc_dev *dev) * * @dev: The nfc device whose name to return */ -static inline const char *nfc_device_name(struct nfc_dev *dev) +static inline const char *nfc_device_name(const struct nfc_dev *dev) { return dev_name(&dev->dev); } From patchwork Thu Jul 29 10:40:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489680 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78638C4320E for ; Thu, 29 Jul 2021 10:40:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6175860C41 for ; Thu, 29 Jul 2021 10:40:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236223AbhG2Kkm (ORCPT ); Thu, 29 Jul 2021 06:40:42 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:34450 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236072AbhG2Kkl (ORCPT ); Thu, 29 Jul 2021 06:40:41 -0400 Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 7E3A23F230 for ; Thu, 29 Jul 2021 10:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555237; bh=Cw3WxWMdLZ5M5UUT98hz5uB4oSAZN8UMdeHX+1yibmU=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UA6W0mJepY+O8jhv0HDxrEZOfnFjSdBLv6/CymMIE833Vk6y7kg7C/1AsFH47TtpN BiV2vbnX0ApVhRNwH39E1KJVGGQqebXNJy934Xi9GQHev1+tLd8CM3GlSviElvf3g/ 5WECRMGgd8pqUavUveux178EATYz8klg+8PUcRLUGCRB7spU6t5mbUHN61BSPhGYsR HgHclX9OBvGeip8QjJikSCBAKK4HOaJ4tGUts0qAjroirzIYFdtRvJ5HsJH9jpBvZw dhw1/KtUOWyWjdNj89WyQStEc/UpeyY/h+m6xZLS6rodq7IH2MQjmHeHISc+wYJMq1 ffG2z1SZ6yqeQ== Received: by mail-ed1-f70.google.com with SMTP id d6-20020a50f6860000b02903bc068b7717so2748660edn.11 for ; Thu, 29 Jul 2021 03:40:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cw3WxWMdLZ5M5UUT98hz5uB4oSAZN8UMdeHX+1yibmU=; b=qyrWeRRWiaka54CfOMLe5sifKoZ/P/BN3Jy7CCS/rQ+NE7M/eP8G5shfJM4s9mC3ke uWzzVMm8krLdwpA78/Ylw+6Ngpe/8V/vFnO/1jgMfarZSPE8xndUhgiLvY3EhYpR3PjD M9tlgDQzHryT3RJnrNC+Bk3RYCqJoO/EyjZ28T0wh7Q/1sLim1v5NonbCMkRNCDMDe8O aNJ9++tj9/zTIAkmHLkWYRdB4TCQ4xFoUHmD2+iAFmJG44scJlZGTASHj5S3iZWDBpZP dOTYswoAxZg0qgG3G9SlpdEFedY+yflCcw8Au7QoRKxw/F1ocQ/gDghqqMEh+56sIi6a SoEw== X-Gm-Message-State: AOAM533aNjBcV4GF4MmOffNBKrb+PGg4aq3W1t89RhgwyXW7G+Osp7Hu r+WVcQAw0Jdtv989sdVMzsoxvxJhBoNS5oI75d84DyrrTpPCwAGu6pIF9Ub5vMLfcSvZQotHFBS 3HxxFsqGJVBGrpstLYdYKab/kk56hmXDDkjs6E4SQVj5B X-Received: by 2002:a17:907:1190:: with SMTP id uz16mr3961129ejb.543.1627555236309; Thu, 29 Jul 2021 03:40:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyelGCc7LxjALvK3umx0eo+PexaLLnBk1cGkBUbydBmcQuE3sbk2nmw8yhHldZtMsl1cgWHbw== X-Received: by 2002:a17:907:1190:: with SMTP id uz16mr3961115ejb.543.1627555236127; Thu, 29 Jul 2021 03:40:36 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:35 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 02/12] nfc: mei_phy: constify buffer passed to mei_nfc_send() Date: Thu, 29 Jul 2021 12:40:12 +0200 Message-Id: <20210729104022.47761-3-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org The buffer passed to mei_nfc_send() can be const for correctness and safety. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/mei_phy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nfc/mei_phy.c b/drivers/nfc/mei_phy.c index 41146bb99474..f9cca885beec 100644 --- a/drivers/nfc/mei_phy.c +++ b/drivers/nfc/mei_phy.c @@ -202,7 +202,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy) return r; } -static int mei_nfc_send(struct nfc_mei_phy *phy, u8 *buf, size_t length) +static int mei_nfc_send(struct nfc_mei_phy *phy, const u8 *buf, size_t length) { struct mei_nfc_hdr *hdr; u8 *mei_buf; From patchwork Thu Jul 29 10:40:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489108 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35E20C432BE for ; Thu, 29 Jul 2021 10:40:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1E3AE60720 for ; Thu, 29 Jul 2021 10:40:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236369AbhG2Kkp (ORCPT ); Thu, 29 Jul 2021 06:40:45 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:34466 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235880AbhG2Kkl (ORCPT ); Thu, 29 Jul 2021 06:40:41 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 068993F114 for ; Thu, 29 Jul 2021 10:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555238; bh=a08v9hxy0zgk30tu0EPhwU1/dVMKGIwopyByTRLQTW8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JSE+sse5AK/JvJNGhV7vdPnzd3eYs2rDC75u6Mf29C2lO9rRofDhpS6NoU33uy36T ZZ2l7whi5jMpSpt7BwwsFxnnEDsIXDG6zEuAXeOayLqgORFACY2d8kBO8PMt2aPMml 5sZBI/qgy4KuXo6oYUufe04N+ny4SKUfDdcEx7qL7WVblBARU4WY9MFvOK9rJBYlMF aDM2xlNid8niIGQWJy8cHOZqORnkxdtr4JNppnzARupATcD1anmF7BNg2s641fbA1q /Z+74eihU+KJ1RFEllS6pL+4hVba1RXmIfiFqlKAZyjmpqoEsE7poabPuNGcQ/qInZ V7sYFKbLGSfJQ== Received: by mail-ed1-f69.google.com with SMTP id j22-20020a50ed160000b02903ab03a06e86so2728021eds.14 for ; Thu, 29 Jul 2021 03:40:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a08v9hxy0zgk30tu0EPhwU1/dVMKGIwopyByTRLQTW8=; b=O61Wzozoqgz1ZWvrHyZTgXF/xkEA1i/Ma5peSEBkRGS7LV9gQZ2jWUvLfZLfAswAX7 nDuEtaQP0fhKSMGupSlHOQOc1uDybwBtgRjqW3Tw3WqUMJ/HoHdi3qYmEmb+96VrwJOw jTfjgrnEnrlAlimOWwsOKpFGBAfIzHzb3w7gRh8gKRQMdtlqILJmyd5FLT1PTjWNclPZ WKPFz8Iag+zH6oJfE2WBei5yoorHisW4MWZ9BTElwOLlFF8t1LTHzmrEffM9VE1N/3kS gb/o1l3uBVy6Lpk6oSFqnY7FETYk4G3+1Hz5zo/HPsMjsd6GuUd+fNFWqEIZlyRkHpeu pT8A== X-Gm-Message-State: AOAM530fo1OgqLIwVVb/LK6WlVSM+hXQOHisReDZee0QA92Sayo5LjWU f2kBCZatAMpO5FgaeorQpumQsHH58hWAK2bNHW8K1LAFmX81P7nLIx3VU3wXrcqAtYJ34bEVf2q 47AXnAhdc40GQHPLRpCDvKwwWs9jPLILjDUrSCXBs0eIl X-Received: by 2002:a17:906:94cd:: with SMTP id d13mr4063280ejy.158.1627555237728; Thu, 29 Jul 2021 03:40:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpcC8Z7IC55TpoG5cbgBRsSSS6C555lTVpoloQhomyURPjel7+zQOzWNYTmYIp//p8tRPZ1g== X-Received: by 2002:a17:906:94cd:: with SMTP id d13mr4063260ejy.158.1627555237495; Thu, 29 Jul 2021 03:40:37 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:37 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 03/12] nfc: port100: constify several pointers Date: Thu, 29 Jul 2021 12:40:13 +0200 Message-Id: <20210729104022.47761-4-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Several functions do not modify pointed data so arguments and local variables can be const for correctness and safety. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/port100.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/nfc/port100.c b/drivers/nfc/port100.c index ccb5c5fab905..517376c43b86 100644 --- a/drivers/nfc/port100.c +++ b/drivers/nfc/port100.c @@ -526,7 +526,7 @@ static inline u8 port100_checksum(u16 value) } /* The rule: sum(data elements) + checksum = 0 */ -static u8 port100_data_checksum(u8 *data, int datalen) +static u8 port100_data_checksum(const u8 *data, int datalen) { u8 sum = 0; int i; @@ -568,10 +568,10 @@ static void port100_tx_update_payload_len(void *_frame, int len) le16_add_cpu(&frame->datalen, len); } -static bool port100_rx_frame_is_valid(void *_frame) +static bool port100_rx_frame_is_valid(const void *_frame) { u8 checksum; - struct port100_frame *frame = _frame; + const struct port100_frame *frame = _frame; if (frame->start_frame != cpu_to_be16(PORT100_FRAME_SOF) || frame->extended_frame != cpu_to_be16(PORT100_FRAME_EXT)) @@ -589,23 +589,24 @@ static bool port100_rx_frame_is_valid(void *_frame) return true; } -static bool port100_rx_frame_is_ack(struct port100_ack_frame *frame) +static bool port100_rx_frame_is_ack(const struct port100_ack_frame *frame) { return (frame->start_frame == cpu_to_be16(PORT100_FRAME_SOF) && frame->ack_frame == cpu_to_be16(PORT100_FRAME_ACK)); } -static inline int port100_rx_frame_size(void *frame) +static inline int port100_rx_frame_size(const void *frame) { - struct port100_frame *f = frame; + const struct port100_frame *f = frame; return sizeof(struct port100_frame) + le16_to_cpu(f->datalen) + PORT100_FRAME_TAIL_LEN; } -static bool port100_rx_frame_is_cmd_response(struct port100 *dev, void *frame) +static bool port100_rx_frame_is_cmd_response(const struct port100 *dev, + const void *frame) { - struct port100_frame *f = frame; + const struct port100_frame *f = frame; return (PORT100_FRAME_CMD(f) == PORT100_CMD_RESPONSE(dev->cmd->code)); } @@ -655,7 +656,8 @@ static void port100_recv_response(struct urb *urb) schedule_work(&dev->cmd_complete_work); } -static int port100_submit_urb_for_response(struct port100 *dev, gfp_t flags) +static int port100_submit_urb_for_response(const struct port100 *dev, + gfp_t flags) { dev->in_urb->complete = port100_recv_response; @@ -666,7 +668,7 @@ static void port100_recv_ack(struct urb *urb) { struct port100 *dev = urb->context; struct port100_cmd *cmd = dev->cmd; - struct port100_ack_frame *in_frame; + const struct port100_ack_frame *in_frame; int rc; cmd->status = urb->status; @@ -708,7 +710,7 @@ static void port100_recv_ack(struct urb *urb) schedule_work(&dev->cmd_complete_work); } -static int port100_submit_urb_for_ack(struct port100 *dev, gfp_t flags) +static int port100_submit_urb_for_ack(const struct port100 *dev, gfp_t flags) { dev->in_urb->complete = port100_recv_ack; @@ -753,8 +755,9 @@ static int port100_send_ack(struct port100 *dev) return rc; } -static int port100_send_frame_async(struct port100 *dev, struct sk_buff *out, - struct sk_buff *in, int in_len) +static int port100_send_frame_async(struct port100 *dev, + const struct sk_buff *out, + const struct sk_buff *in, int in_len) { int rc; @@ -960,7 +963,7 @@ static void port100_abort_cmd(struct nfc_digital_dev *ddev) usb_kill_urb(dev->in_urb); } -static struct sk_buff *port100_alloc_skb(struct port100 *dev, unsigned int size) +static struct sk_buff *port100_alloc_skb(const struct port100 *dev, unsigned int size) { struct sk_buff *skb; @@ -1152,7 +1155,7 @@ static int port100_in_configure_hw(struct nfc_digital_dev *ddev, int type, static void port100_in_comm_rf_complete(struct port100 *dev, void *arg, struct sk_buff *resp) { - struct port100_cb_arg *cb_arg = arg; + const struct port100_cb_arg *cb_arg = arg; nfc_digital_cmd_complete_t cb = cb_arg->complete_cb; u32 status; int rc; @@ -1330,7 +1333,7 @@ static void port100_tg_comm_rf_complete(struct port100 *dev, void *arg, struct sk_buff *resp) { u32 status; - struct port100_cb_arg *cb_arg = arg; + const struct port100_cb_arg *cb_arg = arg; nfc_digital_cmd_complete_t cb = cb_arg->complete_cb; struct port100_tg_comm_rf_res *hdr; @@ -1453,7 +1456,7 @@ static int port100_listen_mdaa(struct nfc_digital_dev *ddev, static int port100_listen(struct nfc_digital_dev *ddev, u16 timeout, nfc_digital_cmd_complete_t cb, void *arg) { - struct port100 *dev = nfc_digital_get_drvdata(ddev); + const struct port100 *dev = nfc_digital_get_drvdata(ddev); struct sk_buff *skb; skb = port100_alloc_skb(dev, 0); From patchwork Thu Jul 29 10:40:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489104 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4613C4338F for ; Thu, 29 Jul 2021 10:41:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D009460E94 for ; Thu, 29 Jul 2021 10:41:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236977AbhG2KlV (ORCPT ); Thu, 29 Jul 2021 06:41:21 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:34496 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236292AbhG2Kkp (ORCPT ); Thu, 29 Jul 2021 06:40:45 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 286AA3F114 for ; Thu, 29 Jul 2021 10:40:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555240; bh=8EDO8hbetO1mnknXtDL482rftlukDehwkpBsBwJNSdE=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D989OQww4T54EB5kWFBLYsZFUxBekBV/D+b+vnQUNg2gNz7iKBroM+Y57/ztQU1BU ZtH3Lc5klXg8n5vZy6Ie/yQwZQsxoQnHoMlz3Y6mJE/5kV0js4h9eJcw1Y/443JS4Q 5XgYUyRAtVpqN0X8YtAJXUVjQngE4ovh5byoe+wCGjvfmu677rcbfVgCQe4NYw842A NAusMGss7+SvizG3B5fOfeQOt4qr/6GpgEP3ZjVbtgfquEXtDLduhdzbM8v51tgx0J H6PKSLdgTZBvGrN7cTK/0+n0g6ho3E8Ekz1nZwDg9ULQqmGJMhz0Y/CnXJMhnHM4Hd Rn4jBrl+FgZog== Received: by mail-ed1-f71.google.com with SMTP id c16-20020aa7d6100000b02903bc4c2a387bso2700309edr.21 for ; Thu, 29 Jul 2021 03:40:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8EDO8hbetO1mnknXtDL482rftlukDehwkpBsBwJNSdE=; b=itGHXac2swy4MiQHZw0ecw9HLu5Tm5o2OtoT/lO6AcNRRmdwAlxHrr0cRu46dTgn/u 0TcccnOXLSYhe+AIaOsNgsGH2BgH1jrA5ouy2tSCFiq5wMLjsh9TXCpCqI66YrHFPJsM yJvmLrsT3BlOXQikPUoDw9LWMVU1XiYoChE69ipaBAB6oqoZk3iaTXyvsW/ryFNGekg3 4V6QmxO7YD6vgTsF1JMoXgHlOu8w6id2eDf7/d70y4a+jdaCpBlO72/oLYtYHWxtRS+D LtmvhPOfbGHSqZKHoAKBPGDMHoafffbzrfZ9t4gcqTQPQj2fWxi54GlrCJswrFQywinC wJqA== X-Gm-Message-State: AOAM533JrWWXIU5b0Wjec3qUcaVY7pFXP0lSwkIfFjf9J0hEF3cQG9q/ CCl6GrSYmutXza+BBsQCjtx+3fYYJzmgY8RiBVbbiazGtNOrPyvV/mie3kRgvWjVn+gniMUXNoS VSd6n9I4RULund4FaSEPtVGOklvIPcaqKg2W37Kmsl1MV X-Received: by 2002:a17:907:364:: with SMTP id rs4mr4101080ejb.56.1627555238864; Thu, 29 Jul 2021 03:40:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZOu9E6xI3XjXcxdCN71pcdo7KIqUHufVdue1M53+xuTdudckjsCWW6eu5CVaY3Tc87olLnA== X-Received: by 2002:a17:907:364:: with SMTP id rs4mr4101068ejb.56.1627555238733; Thu, 29 Jul 2021 03:40:38 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:38 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 04/12] nfc: trf7970a: constify several pointers Date: Thu, 29 Jul 2021 12:40:14 +0200 Message-Id: <20210729104022.47761-5-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Several functions do not modify pointed data so arguments and local variables can be const for correctness and safety. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/trf7970a.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index 1aed44629aaa..8890fcd59c39 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -643,7 +643,7 @@ static void trf7970a_send_err_upstream(struct trf7970a *trf, int errno) } static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb, - unsigned int len, u8 *prefix, + unsigned int len, const u8 *prefix, unsigned int prefix_len) { struct spi_transfer t[2]; @@ -1387,9 +1387,10 @@ static int trf7970a_is_iso15693_write_or_lock(u8 cmd) } } -static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb) +static int trf7970a_per_cmd_config(struct trf7970a *trf, + const struct sk_buff *skb) { - u8 *req = skb->data; + const u8 *req = skb->data; u8 special_fcn_reg1, iso_ctrl; int ret; @@ -1791,7 +1792,7 @@ static int _trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout, static int trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout, nfc_digital_cmd_complete_t cb, void *arg) { - struct trf7970a *trf = nfc_digital_get_drvdata(ddev); + const struct trf7970a *trf = nfc_digital_get_drvdata(ddev); dev_dbg(trf->dev, "Listen - state: %d, timeout: %d ms\n", trf->state, timeout); @@ -1803,7 +1804,7 @@ static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev, u16 timeout, nfc_digital_cmd_complete_t cb, void *arg) { - struct trf7970a *trf = nfc_digital_get_drvdata(ddev); + const struct trf7970a *trf = nfc_digital_get_drvdata(ddev); int ret; dev_dbg(trf->dev, "Listen MD - state: %d, timeout: %d ms\n", @@ -1824,7 +1825,7 @@ static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev, static int trf7970a_tg_get_rf_tech(struct nfc_digital_dev *ddev, u8 *rf_tech) { - struct trf7970a *trf = nfc_digital_get_drvdata(ddev); + const struct trf7970a *trf = nfc_digital_get_drvdata(ddev); dev_dbg(trf->dev, "Get RF Tech - state: %d, rf_tech: %d\n", trf->state, trf->md_rf_tech); @@ -1974,7 +1975,7 @@ static void trf7970a_shutdown(struct trf7970a *trf) trf7970a_power_down(trf); } -static int trf7970a_get_autosuspend_delay(struct device_node *np) +static int trf7970a_get_autosuspend_delay(const struct device_node *np) { int autosuspend_delay, ret; @@ -1987,7 +1988,7 @@ static int trf7970a_get_autosuspend_delay(struct device_node *np) static int trf7970a_probe(struct spi_device *spi) { - struct device_node *np = spi->dev.of_node; + const struct device_node *np = spi->dev.of_node; struct trf7970a *trf; int uvolts, autosuspend_delay, ret; u32 clk_freq = TRF7970A_13MHZ_CLOCK_FREQUENCY; From patchwork Thu Jul 29 10:40:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80B3BC4338F for ; Thu, 29 Jul 2021 10:40:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A61060720 for ; Thu, 29 Jul 2021 10:40:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236140AbhG2Kks (ORCPT ); Thu, 29 Jul 2021 06:40:48 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:34508 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236323AbhG2Kkq (ORCPT ); Thu, 29 Jul 2021 06:40:46 -0400 Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 584083F226 for ; Thu, 29 Jul 2021 10:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555242; bh=So1uUDkE721+BEqMeRM8NOIaRYftuFanUkfPQdOA99A=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DbF2ZXKWL2ZjowC+P+66F0i9AmExNlu4XnN2YRnEGYtKi+1nRR4PtnWKxVrHnqOi7 2WWd0yKlmMWk5PsguM/zKjGrG17IXiPskbQMT6zh0cIXYS72pYFBHTVxtcOtjFxUDc vG6dRhUGxyM+f7OaIpWcGrK16y7a6ukjfZoULdpHZy4oyEYKwdOl/tmNZH/zSyH6LV Lwe8a/6D2W4rc/DrR100WCuNQ7Z/WttHFAQPdAd17W3iEmsemRIiRdoXVhpvF8NKWH CHLkR00QIl83Bs9yR7loGcM9v2qZMqLOSkvTurKooZfV6DGcrtXbMwlJn86TiWZr3D HAWb3OBg5PbSQ== Received: by mail-ed1-f72.google.com with SMTP id c20-20020a0564021014b029039994f9cab9so1286997edu.22 for ; Thu, 29 Jul 2021 03:40:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=So1uUDkE721+BEqMeRM8NOIaRYftuFanUkfPQdOA99A=; b=S23q8wbWK2vKYWsvp/LTCMXs2buyh3g4iSWAsOOQSjDlQV8gO4BUneFzyfQWp9loPi FumDfKCJluhc/Vzc4oyYk7adDRjN13b0gflOUs1SI9yAGNe/EYZmR2bpwaeUf34WmG32 /OiCk6e/RCy3SgN2AwaQZT+FvnUN3guT4FLVXLtLxQFnQhg2W7UwoZ1QE4naySFgwJay m82NVkiXjg6BCJId479zbmsZGk9YweEA8oYhPuTu5Vh5Tfa0Xjjf7A68EsjQiG2n7Bw1 vlXFuRCuO2kJhWpkXejhshI0TyE5yYFItOScQ/wF4zpstOx3uSmIUNSlAqcs45BqaylB zfmA== X-Gm-Message-State: AOAM532KM45OyZKvIM3FQ+byAa8la7fCOdtQmtDuMAJ4FBOjrARPU3Y4 zph+tSTvLQOQiEb4YAJlpD0E4kd/TLDGJSpAdUIzurLtQi59nMw+GbjjzSAUnq8ATgxMeLC5We/ G0V6/mu3M02pfc22Rclo961iiKoM7RTC3Eec7K7ek3hBP X-Received: by 2002:a05:6402:cb9:: with SMTP id cn25mr4576416edb.271.1627555240172; Thu, 29 Jul 2021 03:40:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwg8gQFeBPTWOxeoK6KYjuQRUdToXFwmH6p9ZgcYdRRS/mw4BXtIUndBzQfGalBkLacI2jz9A== X-Received: by 2002:a05:6402:cb9:: with SMTP id cn25mr4576407edb.271.1627555240070; Thu, 29 Jul 2021 03:40:40 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:39 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 05/12] nfc: virtual_ncidev: constify pointer to nfc_dev Date: Thu, 29 Jul 2021 12:40:15 +0200 Message-Id: <20210729104022.47761-6-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org virtual_ncidev_ioctl() does not modify struct nfc_dev, so local variable can be a pointer to const. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/virtual_ncidev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nfc/virtual_ncidev.c b/drivers/nfc/virtual_ncidev.c index b914ab2c2109..2ee0ec4bb739 100644 --- a/drivers/nfc/virtual_ncidev.c +++ b/drivers/nfc/virtual_ncidev.c @@ -170,7 +170,7 @@ static int virtual_ncidev_close(struct inode *inode, struct file *file) static long virtual_ncidev_ioctl(struct file *flip, unsigned int cmd, unsigned long arg) { - struct nfc_dev *nfc_dev = ndev->nfc_dev; + const struct nfc_dev *nfc_dev = ndev->nfc_dev; void __user *p = (void __user *)arg; if (cmd != IOCTL_GET_NCIDEV_IDX) From patchwork Thu Jul 29 10:40:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489676 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEEFDC432BE for ; Thu, 29 Jul 2021 10:41:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 993C260C51 for ; Thu, 29 Jul 2021 10:41:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236676AbhG2KlT (ORCPT ); Thu, 29 Jul 2021 06:41:19 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:47800 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236285AbhG2Kkp (ORCPT ); Thu, 29 Jul 2021 06:40:45 -0400 Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id 72D4B3F110 for ; Thu, 29 Jul 2021 10:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555241; bh=Cti8DGqbNI8YPSuGsMvGoiLdXe5FLuXImkkJsU3HkS0=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=f5A+RajiHfLk8wB2DyLPhBFhc9RkwBvXKx/WWTqFq5DD0TpG5TO/5JATW0U6TrlAs VuJAHlSB/36DAUBtsLmGmCSvilO5mvu/KYBwZRwj5Bw9fCeI5Zlm41niNssE0insmk 9u7akXzfUgCvB7qNSz/sN6BVXpkddyNK13irLfKaA57Moch5+Z9ZflH5b75RM9z3K1 1dFn+t6+ZHVhJ/wVTACcziT/pNXgV2VoJZhOR4KyodfZf/Kiy/snG0SHfpZccc7fsA /i6opkVnifNa8GH/0YjGBlZbndhSczJ0BzxLhvOG4CWGIkFz5aROslMJkFQ3uRGUJR mWH43JvF656xA== Received: by mail-ed1-f69.google.com with SMTP id n24-20020aa7c7980000b02903bb4e1d45aaso2724995eds.15 for ; Thu, 29 Jul 2021 03:40:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cti8DGqbNI8YPSuGsMvGoiLdXe5FLuXImkkJsU3HkS0=; b=lWd8HtthgE4YZxxfFSlSYuk/7Lc8NQ1tWNsKu5P+H692O31GS6dD3Ag7KdxcR4MGay 9BLeOe+XeVP9CFwbTNoP52as1XcqfTSNf/Z0JFCoy6QJLMcRamMnC6S3rVf4Uxotgd0q e/eFjKpO/K8GyYFmZjQEPiNjHgnW1V+tfUNh8p7Fw1cAOE1uTtolW5/Xtmni+d4BL4xM 3xTUPT+J8TdJmmwzo514hwTp7ANHgpEtKknyP8IHEKR9tiLtoLZNYrU2yhjvrSU1DydP Z4S6LLI4tYt2XXA4BdgvsaKewsJacewVoNPPJ1QrPfsdwblrTC3MClGMISt15IWQO9OS ax5g== X-Gm-Message-State: AOAM532IHwgkaBD7kT3KQfEYLr1iaPqTmkgwoqGTRFcocBswOr3bCdGO es8okWPmu3bG5VB3pViL9sq7u/TnG8zEe/dTbR/rDOJtkCfCBQtHxCwQHMC5hg31tgUfXmM4GGe I3I+t1ACAiM/Qe7eJKL3cjnwvL3QJ+u54GqpLTpe+Q4vv X-Received: by 2002:aa7:d342:: with SMTP id m2mr5302488edr.40.1627555241274; Thu, 29 Jul 2021 03:40:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjxgKl6WmnwX+WqFoKb6oCeo3LEsCBOoKuWEW0W2jjhEWMO4WBVPwCw/S6BOn4eM0m2lGmgg== X-Received: by 2002:aa7:d342:: with SMTP id m2mr5302475edr.40.1627555241166; Thu, 29 Jul 2021 03:40:41 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:40 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 06/12] nfc: nfcsim: constify drvdata (struct nfcsim) Date: Thu, 29 Jul 2021 12:40:16 +0200 Message-Id: <20210729104022.47761-7-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org nfcsim_abort_cmd() does not modify struct nfcsim, so local variable can be a pointer to const. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/nfcsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nfc/nfcsim.c b/drivers/nfc/nfcsim.c index 143dc49b815b..15754671eb4d 100644 --- a/drivers/nfc/nfcsim.c +++ b/drivers/nfc/nfcsim.c @@ -240,7 +240,7 @@ static int nfcsim_send(struct nfc_digital_dev *ddev, struct sk_buff *skb, static void nfcsim_abort_cmd(struct nfc_digital_dev *ddev) { - struct nfcsim *dev = nfc_digital_get_drvdata(ddev); + const struct nfcsim *dev = nfc_digital_get_drvdata(ddev); nfcsim_link_recv_cancel(dev->link_in); } From patchwork Thu Jul 29 10:40:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489107 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0B7FC4320A for ; Thu, 29 Jul 2021 10:40:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D904D6069E for ; Thu, 29 Jul 2021 10:40:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236711AbhG2Kkv (ORCPT ); Thu, 29 Jul 2021 06:40:51 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:34534 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236224AbhG2Kkr (ORCPT ); Thu, 29 Jul 2021 06:40:47 -0400 Received: from mail-ej1-f72.google.com (mail-ej1-f72.google.com [209.85.218.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 5B0063F224 for ; Thu, 29 Jul 2021 10:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555243; bh=KXmULC4yNLbjXfZilnwZUymI+qeRnrLMQ/vMczDuSm8=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=FjHwBMnKcyKdPC27zPWz3DoMtR3VOrhaGR2XO58hHDUJeciLFNhdhj3Hnt6IrgWQ6 vpSbslqTwxHjDmcQ3izfnhwWo1kEd+tGQp+TiK2PF5y5ZS5H2m/gWQ/FLmKGCZKXiL wZZsW5VdkBYycNd4JNwvdWfXV28wgkeU9y+w+4QyHnqZFSt8LVNIdpLqw9X7vR/+GQ QrsbRqjUnCsmZKipnWuM39cwmk+rzasEJ4IBAKeEhmcTWoT4O81/ctqUvBFCAwDOYw tFZmJKY3NVNGNmyhwYa6Dv4BUSj/H+oRF0F6hXVt9I1DKN0PqjRi7mBZ8v6cIpqMgx exYBmQLvbybYQ== Received: by mail-ej1-f72.google.com with SMTP id a19-20020a1709063e93b0290551ea218ea2so1842575ejj.5 for ; Thu, 29 Jul 2021 03:40:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KXmULC4yNLbjXfZilnwZUymI+qeRnrLMQ/vMczDuSm8=; b=eVXiStkiArbdEGiFEaUG9mMELaodGnsgDoLlnFr0lGakjnW7CRo7yRmGo9wzKMlGFv FSk9BovShhLTm4k4P6pKaTAIkHfUL9AtrS8Q11KUSzyawx3dhzy55BZIIpR1TgVNH+E1 +MrlrMiefGokCbEgovSLKVP4ezbg4IgaJ4uMWhnmxCnoQy9FXNdRCyXGQh7aiPhnsSEp df+oBTJFufZOq5keCu8VXycfpuNvWjSDgv5nyt2uQJYhgJNVyRVJWvA61SuztmORanAL qrdY1797xhGlvkUSJGF7LGIGn7EMppbJgS/wHhYQfaPqthNQA+ac4ydvChuu6n9X31lf E90Q== X-Gm-Message-State: AOAM5338wWGvH2nrkNMjLpsEg90ZbxgrcPzhttBLB/kwXwM+kVM51mbZ C3Zf1gQ2mYqu2njJvQZp7L/DH812BbGi4TGuHwID+920HmIVegDdDDBgPhUybesUDGSB31z4HGO JLVTr0nuTpx5aNFH8KauZDEHIfrTB/mvQvcyTrBRcqf8/ X-Received: by 2002:a05:6402:1cb6:: with SMTP id cz22mr5180754edb.148.1627555242546; Thu, 29 Jul 2021 03:40:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjW5Qyti3uGsJQhjyg9e0Vg9hnF5ajD1dE9uX/LfyH7AIvIxTCmpWZpCLut6Hz/YpkiUBGxg== X-Received: by 2002:a05:6402:1cb6:: with SMTP id cz22mr5180746edb.148.1627555242430; Thu, 29 Jul 2021 03:40:42 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:42 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 07/12] nfc: fdp: drop unneeded cast for printing firmware size in dev_dbg() Date: Thu, 29 Jul 2021 12:40:17 +0200 Message-Id: <20210729104022.47761-8-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Size of firmware is a type of size_t, so print it directly instead of casting to int. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/fdp/fdp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c index 3e542b7389cb..650a140bea46 100644 --- a/drivers/nfc/fdp/fdp.c +++ b/drivers/nfc/fdp/fdp.c @@ -276,8 +276,8 @@ static int fdp_nci_request_firmware(struct nci_dev *ndev) (data[FDP_FW_HEADER_SIZE + 2] << 16) | (data[FDP_FW_HEADER_SIZE + 3] << 24); - dev_dbg(dev, "RAM patch version: %d, size: %d\n", - info->ram_patch_version, (int) info->ram_patch->size); + dev_dbg(dev, "RAM patch version: %d, size: %zu\n", + info->ram_patch_version, info->ram_patch->size); r = request_firmware(&info->otp_patch, FDP_OTP_PATCH_NAME, dev); @@ -293,8 +293,8 @@ static int fdp_nci_request_firmware(struct nci_dev *ndev) (data[FDP_FW_HEADER_SIZE+2] << 16) | (data[FDP_FW_HEADER_SIZE+3] << 24); - dev_dbg(dev, "OTP patch version: %d, size: %d\n", - info->otp_patch_version, (int) info->otp_patch->size); + dev_dbg(dev, "OTP patch version: %d, size: %zu\n", + info->otp_patch_version, info->otp_patch->size); return 0; } From patchwork Thu Jul 29 10:40:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489105 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72479C4338F for ; Thu, 29 Jul 2021 10:41:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5CAEB6069E for ; Thu, 29 Jul 2021 10:41:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236559AbhG2KlR (ORCPT ); Thu, 29 Jul 2021 06:41:17 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:47840 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236430AbhG2Kkr (ORCPT ); Thu, 29 Jul 2021 06:40:47 -0400 Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id DD1CE3F114 for ; Thu, 29 Jul 2021 10:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555243; bh=vQB6RRzmQQRlWh6S5blKR75hWps+lidsZcEbJz9OF3k=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=nml0jDSXVy3lXLhxTJ8QN4KV0wYeNSWSr68dcZw6YBXHAj3kOn5Wdr7b2OBtWDLhZ 4CmrfjLIEmWIF0CDcXcU2pqGh87u0rIhe9+fDPv0J5OUdZNra7JuYnr0+FFqHHK2Yn l4Z6sZp3SvVsi5BYE0/GPZQjjriuj2nY+zETK8CNo0GlqEx1uBfwAT1MhH3899+cyQ fnqJs5qMwxPnj0tVkXnSqAADuzI/aTemgJaJJkK+utVvbUT46CPwEQIooZNGe6LgF0 7mfdfd5stXg/O5HnVDsmz0q51+j1sXhjV7qVE7wgMl3Lfmvg1uogOVwW94LiEsE5tQ yOEMgSm/rfMhQ== Received: by mail-ej1-f69.google.com with SMTP id qf6-20020a1709077f06b029057e66b6665aso1840958ejc.18 for ; Thu, 29 Jul 2021 03:40:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vQB6RRzmQQRlWh6S5blKR75hWps+lidsZcEbJz9OF3k=; b=Fm5n/NiJjHets3nrqh/V4nSoC04vrUWxLuAnXIET3FjO60cLXvUXhjNDCOuI9XwWns Gj3BnBjo6SDsYtq+ywcOTaI9WOwmc20mAX5KHi3WhlDXHOXYw5JZaKaV3TdmLMeQ7OSg ci4MtAkzuycmOmgz9Cuoah+nNhOI5CEqArGgV+yabWu90rFMUthC2CJTpjEoQDIxRy12 fQn0pxQSWegDcQOE0x7dgiTuNw2xEY76a0g4AHq4KKF5XfEuvBRr1IDY6xIJYOFek4Z4 d/00oWaPISXmTKmOrvqsCvT9WqqnQNwgDxJWJHynTQAVxQ3D7L7V05XLw/V3dFD3Gx5B jQFg== X-Gm-Message-State: AOAM530E+YGAryUs4kve55jSaGSgashw3JPvtFd236uj2v4HHuRDdJpw DII1NM7cAcLj8cqEfl8gTVVr0ISLka+fcxm33VHQLkcRsyXDEABlsdk+2SGgSzfsRWOL2gJdGt/ V8ZYZfdjYiKluXzbQyOdM9siJoDjTDiA4786AxbcFjEUl X-Received: by 2002:a50:da0e:: with SMTP id z14mr5301144edj.73.1627555243684; Thu, 29 Jul 2021 03:40:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwijoO/q/+k8GRTBBEBcEUFMonWljYAnQQgqcZHQasMq3+MlfMPzmN1xs3UX4P2zxHnMrP0CQ== X-Received: by 2002:a50:da0e:: with SMTP id z14mr5301127edj.73.1627555243524; Thu, 29 Jul 2021 03:40:43 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:43 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 08/12] nfc: fdp: use unsigned int as loop iterator Date: Thu, 29 Jul 2021 12:40:18 +0200 Message-Id: <20210729104022.47761-9-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Loop iterators are simple integers, no point to optimize the size and use u8. It only raises the question whether the variable is used in some other context. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/fdp/fdp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c index 650a140bea46..3f5fba922c4d 100644 --- a/drivers/nfc/fdp/fdp.c +++ b/drivers/nfc/fdp/fdp.c @@ -611,7 +611,8 @@ static int fdp_nci_core_get_config_rsp_packet(struct nci_dev *ndev, struct fdp_nci_info *info = nci_get_drvdata(ndev); struct device *dev = &info->phy->i2c_dev->dev; struct nci_core_get_config_rsp *rsp = (void *) skb->data; - u8 i, *p; + unsigned int i; + u8 *p; if (rsp->status == NCI_STATUS_OK) { From patchwork Thu Jul 29 10:40:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CF18C4338F for ; Thu, 29 Jul 2021 10:41:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1025E6069E for ; Thu, 29 Jul 2021 10:41:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236610AbhG2KlB (ORCPT ); Thu, 29 Jul 2021 06:41:01 -0400 Received: from smtp-relay-canonical-0.canonical.com ([185.125.188.120]:34562 "EHLO smtp-relay-canonical-0.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236567AbhG2Kks (ORCPT ); Thu, 29 Jul 2021 06:40:48 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 3D22D3F22C for ; Thu, 29 Jul 2021 10:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555245; bh=Sx96q8yhgGgqfl73oRuy2iNKHvqsaGaKbhbfDQ9JbsY=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=D7FGa5TdVvn2PInqdMXQ5H23yiOBrCuY9YO0aailRj00NKMkq/BZsiaSh0KX0tpws E7dMWTYE7Stn+ZBijsbUkcCTO9CqH7QUg+OjFOam8XfsbyBjq8BckfuRgJ2hrw63nB n8GJpCvGWHJ93Um6fcpgotu5XgjjDNjdkoKFDMq2kabU8hcpFzd2dCwPv1HXC7Qk40 7+ceddb1tBphIl/5sQ4W5jz/ez2W4KE9NoLbKWTKyCUWazQFc25NZVHJMppGI7kJKl U/0vW49+8UNRaxRWZ5rFp7DHdL7aM9GtzFyNmR/02QWQQhb1BgG07aPxdCQIAF3IpV jfzJN1Qcucxmw== Received: by mail-ej1-f70.google.com with SMTP id o16-20020a1709066010b0290593804ff1e1so191527ejj.19 for ; Thu, 29 Jul 2021 03:40:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Sx96q8yhgGgqfl73oRuy2iNKHvqsaGaKbhbfDQ9JbsY=; b=eAucscitYgOYnH16YkpqmUKV7ozeXQVMioHmsP5SWkBsAMDYU+TkHz7l3Q15rh8l+t hXFTne/E6Or/iGnYXz57KfGCtkerPRvVFFC3j3hkZiaHH1B+6Dm2fB7Bx6m2vd1PW0ZT fUO8SI7WAOKLwKV+D2wz0B3icC7VuyAjdgtfH530jhhjJemsn1jpHGyB3hncadsMiFWd ojPag1hd8QOWS6GhH14HVE3xVx4FHdywhJDUI8RYs8mE+PWj/emlgKYwcjh6ptJ8P6ND vt3GBI2+vkj/UozsELVjrmrohq7BWqsG7kTdaZ3yb3ydfMGa7LMGeE069YzZHK6U2Qwf gbFQ== X-Gm-Message-State: AOAM532LGoTr03RJa6C1MDLFcnNzYMf6vlRRCOhcS+FoPwagpgZ/FKI/ nEotnvAZtYuONV9WuQJJPiAhEII1KA2iLybWbxWbizI5plZqZlfMjggB5LnRnkfXMCk39xb6JA5 /pXv+S+zv58SmzQqI/2hrbLIUmShzAhHkPQ6vX90Ap2iq X-Received: by 2002:aa7:d899:: with SMTP id u25mr5235991edq.151.1627555244990; Thu, 29 Jul 2021 03:40:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMKAksyF3AW0hIGXPExSWFsWMbbCfBv5+3b/l89XwAlprPzNEk1BKJXCgyG6dSfPdtfqSgng== X-Received: by 2002:aa7:d899:: with SMTP id u25mr5235980edq.151.1627555244811; Thu, 29 Jul 2021 03:40:44 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:44 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 09/12] nfc: fdp: constify several pointers Date: Thu, 29 Jul 2021 12:40:19 +0200 Message-Id: <20210729104022.47761-10-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Several functions do not modify pointed data so arguments and local variables can be const for correctness and safety. This allows also making file-scope nci_core_get_config_otp_ram_version array const. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/fdp/fdp.c | 18 +++++++++--------- drivers/nfc/fdp/fdp.h | 2 +- drivers/nfc/fdp/i2c.c | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/nfc/fdp/fdp.c b/drivers/nfc/fdp/fdp.c index 3f5fba922c4d..c6b3334f24c9 100644 --- a/drivers/nfc/fdp/fdp.c +++ b/drivers/nfc/fdp/fdp.c @@ -52,7 +52,7 @@ struct fdp_nci_info { u32 limited_otp_version; u8 key_index; - u8 *fw_vsc_cfg; + const u8 *fw_vsc_cfg; u8 clock_type; u32 clock_freq; @@ -65,7 +65,7 @@ struct fdp_nci_info { wait_queue_head_t setup_wq; }; -static u8 nci_core_get_config_otp_ram_version[5] = { +static const u8 nci_core_get_config_otp_ram_version[5] = { 0x04, NCI_PARAM_ID_FW_RAM_VERSION, NCI_PARAM_ID_FW_OTP_VERSION, @@ -111,7 +111,7 @@ static inline int fdp_nci_patch_cmd(struct nci_dev *ndev, u8 type) } static inline int fdp_nci_set_production_data(struct nci_dev *ndev, u8 len, - char *data) + const char *data) { return nci_prop_cmd(ndev, NCI_OP_PROP_SET_PDATA_OID, len, data); } @@ -236,7 +236,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type) static int fdp_nci_open(struct nci_dev *ndev) { - struct fdp_nci_info *info = nci_get_drvdata(ndev); + const struct fdp_nci_info *info = nci_get_drvdata(ndev); return info->phy_ops->enable(info->phy); } @@ -260,7 +260,7 @@ static int fdp_nci_request_firmware(struct nci_dev *ndev) { struct fdp_nci_info *info = nci_get_drvdata(ndev); struct device *dev = &info->phy->i2c_dev->dev; - u8 *data; + const u8 *data; int r; r = request_firmware(&info->ram_patch, FDP_RAM_PATCH_NAME, dev); @@ -269,7 +269,7 @@ static int fdp_nci_request_firmware(struct nci_dev *ndev) return r; } - data = (u8 *) info->ram_patch->data; + data = info->ram_patch->data; info->ram_patch_version = data[FDP_FW_HEADER_SIZE] | (data[FDP_FW_HEADER_SIZE + 1] << 8) | @@ -610,9 +610,9 @@ static int fdp_nci_core_get_config_rsp_packet(struct nci_dev *ndev, { struct fdp_nci_info *info = nci_get_drvdata(ndev); struct device *dev = &info->phy->i2c_dev->dev; - struct nci_core_get_config_rsp *rsp = (void *) skb->data; + const struct nci_core_get_config_rsp *rsp = (void *) skb->data; unsigned int i; - u8 *p; + const u8 *p; if (rsp->status == NCI_STATUS_OK) { @@ -691,7 +691,7 @@ static const struct nci_ops nci_ops = { int fdp_nci_probe(struct fdp_i2c_phy *phy, const struct nfc_phy_ops *phy_ops, struct nci_dev **ndevp, int tx_headroom, int tx_tailroom, u8 clock_type, u32 clock_freq, - u8 *fw_vsc_cfg) + const u8 *fw_vsc_cfg) { struct device *dev = &phy->i2c_dev->dev; struct fdp_nci_info *info; diff --git a/drivers/nfc/fdp/fdp.h b/drivers/nfc/fdp/fdp.h index dc048d4b977e..2e9161a4d7bf 100644 --- a/drivers/nfc/fdp/fdp.h +++ b/drivers/nfc/fdp/fdp.h @@ -23,7 +23,7 @@ struct fdp_i2c_phy { int fdp_nci_probe(struct fdp_i2c_phy *phy, const struct nfc_phy_ops *phy_ops, struct nci_dev **ndev, int tx_headroom, int tx_tailroom, - u8 clock_type, u32 clock_freq, u8 *fw_vsc_cfg); + u8 clock_type, u32 clock_freq, const u8 *fw_vsc_cfg); void fdp_nci_remove(struct nci_dev *ndev); #endif /* __LOCAL_FDP_H_ */ diff --git a/drivers/nfc/fdp/i2c.c b/drivers/nfc/fdp/i2c.c index 98e1876c9468..051c43a2a52f 100644 --- a/drivers/nfc/fdp/i2c.c +++ b/drivers/nfc/fdp/i2c.c @@ -36,7 +36,7 @@ print_hex_dump(KERN_DEBUG, prefix": ", DUMP_PREFIX_OFFSET, \ 16, 1, (skb)->data, (skb)->len, 0) -static void fdp_nci_i2c_reset(struct fdp_i2c_phy *phy) +static void fdp_nci_i2c_reset(const struct fdp_i2c_phy *phy) { /* Reset RST/WakeUP for at least 100 micro-second */ gpiod_set_value_cansleep(phy->power_gpio, FDP_POWER_OFF); @@ -47,7 +47,7 @@ static void fdp_nci_i2c_reset(struct fdp_i2c_phy *phy) static int fdp_nci_i2c_enable(void *phy_id) { - struct fdp_i2c_phy *phy = phy_id; + const struct fdp_i2c_phy *phy = phy_id; fdp_nci_i2c_reset(phy); @@ -56,7 +56,7 @@ static int fdp_nci_i2c_enable(void *phy_id) static void fdp_nci_i2c_disable(void *phy_id) { - struct fdp_i2c_phy *phy = phy_id; + const struct fdp_i2c_phy *phy = phy_id; fdp_nci_i2c_reset(phy); } From patchwork Thu Jul 29 10:40:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489106 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F11EC4320A for ; Thu, 29 Jul 2021 10:40:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 143E260C41 for ; Thu, 29 Jul 2021 10:40:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236544AbhG2Kk7 (ORCPT ); Thu, 29 Jul 2021 06:40:59 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:47886 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236619AbhG2Kku (ORCPT ); Thu, 29 Jul 2021 06:40:50 -0400 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id 773D83F23B for ; Thu, 29 Jul 2021 10:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555246; bh=BZIMPFV8uXC9L/K0xzDgkM9m6seQbMO32c9dNbfWa80=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BTaP1d8ydrV0hgqkvf/+UhufeiCSWdGIGAW4o196Prd6ZEqDC2WF3iYjM848wn9Dj VPKZ8ix+0RfiaO26QLgqT7Z/1agpsiRaeCzPIDc0jHdLJiHnmltOES+3nX113AcY88 +9XVJP0/1JjYJRM/nSMyX2LE7f615J6AwEZ5nXupdTkR5itCw5mz66kXyZpHPcGBLf 7rS9vDW9u8VlblQ0tv8KO25uGVKV/GU21bs4JxY77fjIaBCJ+MIo8nWAzep7v78vAn zsvgWkvLVPIgGMNqKzHht81g6NPRQxwWcEhaWWYlvOLySc15W0153dZ6YFCDSDaOt+ mclQZNrRELrLA== Received: by mail-ej1-f71.google.com with SMTP id x5-20020a1709064bc5b02905305454f5d1so1824426ejv.10 for ; Thu, 29 Jul 2021 03:40:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BZIMPFV8uXC9L/K0xzDgkM9m6seQbMO32c9dNbfWa80=; b=rvSnTLorUe+9llMw397CUtWWYrWPkNbV0qrkLZ/7uVbv/N07EZXWxUX5WHwiDxPVAC wMRxCyfK3TdlYtBEUR+yJNl6ePGWmkTb3aZmRmv6jeKKSPG0fjuIHlFHbDKXH9NH6b2d qJYWpAe7WjBC/3IjC2Hf3+msIueOIHvWr6LXQS6r5GHH6zhLYYnbjx9SzJwWbuJY6T52 rK6eZVal2T1ZJfEaDJR67IUlQkSl5DR/QJFZkcAbtfqVVrF6lJVx0WkiUOaofReQ/g3C XknKtknAHJdQPqZhEQN6MTDeL15F+cFhgUOmsD+BpzLVIN82CQ52jHUwMUYlBJo8vNCM caAQ== X-Gm-Message-State: AOAM5309+64ffcSpcIXVEs8sQbkH5WbU+IB2/yx6N/lxLZXE4fQuDiz9 8ivCBtdHmF722KEmSlBA8e7HkCWag3UWca2RBV5W4m+yEp7uXInSJ4dFVv63uDpoGC0sPNrF3lq Q1LBFlVmRoTzxrPci0PTjh0CGGNOHTcWyB+6K0c05hSPt X-Received: by 2002:a17:906:b0c5:: with SMTP id bk5mr3881342ejb.428.1627555246144; Thu, 29 Jul 2021 03:40:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJygcbnz2mL1I+EM9Bv/vZsYeICNIGIdcaZXywSSZmph4zECffAhqDCrnUSC3LB/1TyQegjgiQ== X-Received: by 2002:a17:906:b0c5:: with SMTP id bk5mr3881326ejb.428.1627555246020; Thu, 29 Jul 2021 03:40:46 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:45 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 10/12] nfc: microread: constify several pointers Date: Thu, 29 Jul 2021 12:40:20 +0200 Message-Id: <20210729104022.47761-11-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Several functions do not modify pointed data so arguments and local variables can be const for correctness and safety. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/microread/i2c.c | 2 +- drivers/nfc/microread/microread.c | 4 ++-- drivers/nfc/microread/microread.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/nfc/microread/i2c.c b/drivers/nfc/microread/i2c.c index f91760c78455..86f593c73ed6 100644 --- a/drivers/nfc/microread/i2c.c +++ b/drivers/nfc/microread/i2c.c @@ -73,7 +73,7 @@ static void microread_i2c_remove_len_crc(struct sk_buff *skb) skb_trim(skb, MICROREAD_I2C_FRAME_TAILROOM); } -static int check_crc(struct sk_buff *skb) +static int check_crc(const struct sk_buff *skb) { int i; u8 crc = 0; diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c index 8e847524937c..9d83ccebd434 100644 --- a/drivers/nfc/microread/microread.c +++ b/drivers/nfc/microread/microread.c @@ -358,7 +358,7 @@ static int microread_complete_target_discovered(struct nfc_hci_dev *hdev, static void microread_im_transceive_cb(void *context, struct sk_buff *skb, int err) { - struct microread_info *info = context; + const struct microread_info *info = context; switch (info->async_cb_type) { case MICROREAD_CB_TYPE_READER_ALL: @@ -642,7 +642,7 @@ static const struct nfc_hci_ops microread_hci_ops = { }; int microread_probe(void *phy_id, const struct nfc_phy_ops *phy_ops, - char *llc_name, int phy_headroom, int phy_tailroom, + const char *llc_name, int phy_headroom, int phy_tailroom, int phy_payload, struct nfc_hci_dev **hdev) { struct microread_info *info; diff --git a/drivers/nfc/microread/microread.h b/drivers/nfc/microread/microread.h index 76152d7aa53c..2ee7ccfa22dd 100644 --- a/drivers/nfc/microread/microread.h +++ b/drivers/nfc/microread/microread.h @@ -11,7 +11,7 @@ #define DRIVER_DESC "NFC driver for microread" int microread_probe(void *phy_id, const struct nfc_phy_ops *phy_ops, - char *llc_name, int phy_headroom, int phy_tailroom, + const char *llc_name, int phy_headroom, int phy_tailroom, int phy_payload, struct nfc_hci_dev **hdev); void microread_remove(struct nfc_hci_dev *hdev); From patchwork Thu Jul 29 10:40:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489678 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25A13C4338F for ; Thu, 29 Jul 2021 10:40:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0D3916069E for ; Thu, 29 Jul 2021 10:40:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236661AbhG2Kk6 (ORCPT ); Thu, 29 Jul 2021 06:40:58 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:47840 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236686AbhG2Kkv (ORCPT ); Thu, 29 Jul 2021 06:40:51 -0400 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id 305183F0B8 for ; Thu, 29 Jul 2021 10:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555248; bh=6LhaqEyE6YM7qc+DvvBC/izK9f7my9CENZwOkswScoM=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DZEvd42wLQFPfzp9BcHelNFTA+e+fKXktDcoAuVrtISExfMPCcDMoPvvTLdBQRT7y cbhBYREL7bzPVLUmhSxGalTwjbNSnFK21ti2I5JV3QnnpjFwv6vI6d96bEdCufhyS5 S7wkXGrsuI211iQMNQS36NYndBZhGmROk2dS24jBs4SYL7SCqFo1Ef55Car4YYCD6R wqtIm0z9rsGm7KE98dt+Afu/RgG1in2f5oOtPjMdTOqKCmdrTyHxTtJ2UD8WJsLocg osCWx/8VKe5gmJNxCSw1JJTXYq17vp9fIBGrFUXRfALWT/imPQ/Tb5z09J4jIn4C1N QuyXK5sUFO7WQ== Received: by mail-ed1-f71.google.com with SMTP id c1-20020aa7df010000b02903bb5c6f746eso2723477edy.10 for ; Thu, 29 Jul 2021 03:40:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6LhaqEyE6YM7qc+DvvBC/izK9f7my9CENZwOkswScoM=; b=Kf6C0XHyCYJ9V3bOQj6POztH4g5w1tw1B8tHiwds8MS+7Chx17kIKUZ52pkFhrJj+F r+IL4+vN4kqccmG88flisYiaPt/y33LMQMgBCABwGjDOpV6i3ShcMt6Lty28rn7X0IRR InTT0KK8NXe/NKI9AblTXXqqt4v0Z+P35zDiyfO+HprkKa6TLvrxNSdeZ30eTZvd0RRN TeKqySk2ZhnZrDkUaJVXmRgIr3/T3VwKjrecv2N62U9NMivvuSFiHnRG1/g/bjZTsSz3 4Ib+alSFNcyaKnqmrjXPtfYlLXZ6wx5ZUIWJyEaSyAQBYRjHy5YxzryBSQeF8Kf1xw4H x2kg== X-Gm-Message-State: AOAM532jWMTns4+Bd7/ibNvTAaSOXNrNL+Zg4K1R66/ONUH6QyV0T7s2 Pj2khUdXY5jFe1laK+19P7mP3Lcxu1AW4gP+zBKEFYWnzCrE1HSMJnA/grg/9xJDHbVDXZrYqWK fQcZeQuqozV0n+a4b3BiqfRTmGerwTIIw7IswQsq7DfKW X-Received: by 2002:a05:6402:d2:: with SMTP id i18mr5264560edu.17.1627555247739; Thu, 29 Jul 2021 03:40:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyU2Ka89Z3Qjr8Tzvk3IIGX+JEzwdx0FNyuEdwHjyphht6T2bpxMENgCaQjv8QxWPsttQOLJw== X-Received: by 2002:a05:6402:d2:: with SMTP id i18mr5264543edu.17.1627555247595; Thu, 29 Jul 2021 03:40:47 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id c14sm824475ejb.78.2021.07.29.03.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:40:46 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 11/12] nfc: mrvl: constify several pointers Date: Thu, 29 Jul 2021 12:40:21 +0200 Message-Id: <20210729104022.47761-12-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Several functions do not modify pointed data so arguments and local variables can be const for correctness and safety. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/nfcmrvl/fw_dnld.c | 16 +++++++++------- drivers/nfc/nfcmrvl/i2c.c | 2 +- drivers/nfc/nfcmrvl/main.c | 2 +- drivers/nfc/nfcmrvl/nfcmrvl.h | 2 +- drivers/nfc/nfcmrvl/spi.c | 4 ++-- drivers/nfc/nfcmrvl/uart.c | 2 +- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c index aaccb8b76b3e..edac56b01fd1 100644 --- a/drivers/nfc/nfcmrvl/fw_dnld.c +++ b/drivers/nfc/nfcmrvl/fw_dnld.c @@ -129,7 +129,7 @@ static void fw_dnld_timeout(struct timer_list *t) } static int process_state_reset(struct nfcmrvl_private *priv, - struct sk_buff *skb) + const struct sk_buff *skb) { if (sizeof(nci_pattern_core_reset_ntf) != skb->len || memcmp(skb->data, nci_pattern_core_reset_ntf, @@ -145,7 +145,8 @@ static int process_state_reset(struct nfcmrvl_private *priv, return 0; } -static int process_state_init(struct nfcmrvl_private *priv, struct sk_buff *skb) +static int process_state_init(struct nfcmrvl_private *priv, + const struct sk_buff *skb) { struct nci_core_set_config_cmd cmd; @@ -175,7 +176,7 @@ static void create_lc(struct nfcmrvl_private *priv) } static int process_state_set_ref_clock(struct nfcmrvl_private *priv, - struct sk_buff *skb) + const struct sk_buff *skb) { struct nci_core_set_config_cmd cmd; @@ -221,7 +222,7 @@ static int process_state_set_ref_clock(struct nfcmrvl_private *priv, } static int process_state_set_hi_config(struct nfcmrvl_private *priv, - struct sk_buff *skb) + const struct sk_buff *skb) { if (sizeof(nci_pattern_core_set_config_rsp) != skb->len || memcmp(skb->data, nci_pattern_core_set_config_rsp, skb->len)) @@ -232,7 +233,7 @@ static int process_state_set_hi_config(struct nfcmrvl_private *priv, } static int process_state_open_lc(struct nfcmrvl_private *priv, - struct sk_buff *skb) + const struct sk_buff *skb) { if (sizeof(nci_pattern_core_conn_create_rsp) >= skb->len || memcmp(skb->data, nci_pattern_core_conn_create_rsp, @@ -347,7 +348,7 @@ static int process_state_fw_dnld(struct nfcmrvl_private *priv, } static int process_state_close_lc(struct nfcmrvl_private *priv, - struct sk_buff *skb) + const struct sk_buff *skb) { if (sizeof(nci_pattern_core_conn_close_rsp) != skb->len || memcmp(skb->data, nci_pattern_core_conn_close_rsp, skb->len)) @@ -358,7 +359,8 @@ static int process_state_close_lc(struct nfcmrvl_private *priv, return 0; } -static int process_state_boot(struct nfcmrvl_private *priv, struct sk_buff *skb) +static int process_state_boot(struct nfcmrvl_private *priv, + const struct sk_buff *skb) { if (sizeof(nci_pattern_proprietary_boot_rsp) != skb->len || memcmp(skb->data, nci_pattern_proprietary_boot_rsp, skb->len)) diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c index 59a529e72d96..6e659e77c8a2 100644 --- a/drivers/nfc/nfcmrvl/i2c.c +++ b/drivers/nfc/nfcmrvl/i2c.c @@ -182,8 +182,8 @@ static int nfcmrvl_i2c_parse_dt(struct device_node *node, static int nfcmrvl_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { + const struct nfcmrvl_platform_data *pdata; struct nfcmrvl_i2c_drv_data *drv_data; - struct nfcmrvl_platform_data *pdata; struct nfcmrvl_platform_data config; int ret; diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c index 6e9e7ce8792c..d8e48bdaf652 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c @@ -93,7 +93,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, void *drv_data, struct nfcmrvl_if_ops *ops, struct device *dev, - struct nfcmrvl_platform_data *pdata) + const struct nfcmrvl_platform_data *pdata) { struct nfcmrvl_private *priv; int rc; diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h index a715543bc9bf..84fafa95965e 100644 --- a/drivers/nfc/nfcmrvl/nfcmrvl.h +++ b/drivers/nfc/nfcmrvl/nfcmrvl.h @@ -94,7 +94,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, void *drv_data, struct nfcmrvl_if_ops *ops, struct device *dev, - struct nfcmrvl_platform_data *pdata); + const struct nfcmrvl_platform_data *pdata); void nfcmrvl_chip_reset(struct nfcmrvl_private *priv); diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c index 66696321c645..7b015bb33fc9 100644 --- a/drivers/nfc/nfcmrvl/spi.c +++ b/drivers/nfc/nfcmrvl/spi.c @@ -106,7 +106,7 @@ static struct nfcmrvl_if_ops spi_ops = { .nci_update_config = nfcmrvl_spi_nci_update_config, }; -static int nfcmrvl_spi_parse_dt(struct device_node *node, +static int nfcmrvl_spi_parse_dt(const struct device_node *node, struct nfcmrvl_platform_data *pdata) { int ret; @@ -129,7 +129,7 @@ static int nfcmrvl_spi_parse_dt(struct device_node *node, static int nfcmrvl_spi_probe(struct spi_device *spi) { - struct nfcmrvl_platform_data *pdata; + const struct nfcmrvl_platform_data *pdata; struct nfcmrvl_platform_data config; struct nfcmrvl_spi_drv_data *drv_data; int ret = 0; diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c index 50d86c90b9dd..63ac434675c8 100644 --- a/drivers/nfc/nfcmrvl/uart.c +++ b/drivers/nfc/nfcmrvl/uart.c @@ -98,8 +98,8 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node, static int nfcmrvl_nci_uart_open(struct nci_uart *nu) { struct nfcmrvl_private *priv; - struct nfcmrvl_platform_data *pdata = NULL; struct nfcmrvl_platform_data config; + const struct nfcmrvl_platform_data *pdata = NULL; struct device *dev = nu->tty->dev; /* From patchwork Thu Jul 29 10:42:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 489675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBCAEC4338F for ; Thu, 29 Jul 2021 10:42:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 979B960C41 for ; Thu, 29 Jul 2021 10:42:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235966AbhG2Kmx (ORCPT ); Thu, 29 Jul 2021 06:42:53 -0400 Received: from smtp-relay-canonical-1.canonical.com ([185.125.188.121]:48052 "EHLO smtp-relay-canonical-1.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235679AbhG2Kmw (ORCPT ); Thu, 29 Jul 2021 06:42:52 -0400 Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-1.canonical.com (Postfix) with ESMTPS id 910873F10E for ; Thu, 29 Jul 2021 10:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1627555368; bh=1aqWonZ1UVeYrgP40WWguDTIwwMWBTXMW2a73Xqk2/I=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=fTaOL6yTA1N+j0b4PUpgzWYos85Rpw0HlW0/TgjfeqewNixyjGNfObfDbsVVve1bV yydbMj9K5Ccic8BYEPXdTA4fkQWUWx7oJkgK/ZE65F4lEb/LuC3WVjJmC1AffOmwA1 sGu1k8b6HYE9IzZyrbjGgGc+UubqOQ2+eXU6evx/KPw39ESOd7+97h8+GRCB06Mrl7 +igO0k3WafwE2vQOrr3evhhnc/jFz2vKZ4rOP/1zt5kbkapY8/rZSQ3V7pAeoLDpbz Wz7HRQtEPwtjuNJStAMXPRCC/E2OFNve8/u1A5YWbdQJm8IQeyp/KlLsZmT8d9XkZS vHHNwVaZWX8vA== Received: by mail-ej1-f70.google.com with SMTP id lu19-20020a170906fad3b029058768348f55so1849132ejb.12 for ; Thu, 29 Jul 2021 03:42:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1aqWonZ1UVeYrgP40WWguDTIwwMWBTXMW2a73Xqk2/I=; b=SphBuCpLUHgtr4jst1tql7TielPtwS14rYct9KmpdTa/J4bOGjpDIQ9ggfa0F9hEI+ XZSl1tiz7TEL+a0JH0Bk2vvsWMnjXmu9jrVeNgpiJP/yylqitjzhENVbmQEtyCY6Zo1R bYN4xq9jdhg5tNKyxE0yPoBf4ssteLqBmVd79qGysiQy2MoWZH/en+DniBaZ7edK7PbA GfhnLgqic3F48Cv7lRhlcjvJZ5evKArF+i2IAiob6MYbNG2IiIop2Zo/g6rw+Dey16eF coax6wF/3jGgBgPAXCqHRHBnwoqE9cFmvJSJVYL6Kuajp0pKJcJb0PBwinWLBygXB/eT /Gmg== X-Gm-Message-State: AOAM532MGzzc9R/YFMK2McTium8F3mStQ+Xrhs3p1tMUwDWBTZNC/3l1 UBUUb5c+QibWvbqyxfXwe0ejDQw3pMSSNCmdQHsoMVqupj9HdgiWA32smI2cGyDPvBt+oK5+M19 hiukDWHocXk5mnXFApg+HjjEs6oofDo309bzNyXuiGpYC X-Received: by 2002:a17:907:1b02:: with SMTP id mp2mr4104322ejc.196.1627555368311; Thu, 29 Jul 2021 03:42:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy7aV8dzqZZfnsgycbu2nLiwhd9HngRE7rGbZygUqpYd4zH2xG3lNFXnZlVjoxsJ3E/BKLvUA== X-Received: by 2002:a17:907:1b02:: with SMTP id mp2mr4104308ejc.196.1627555368118; Thu, 29 Jul 2021 03:42:48 -0700 (PDT) Received: from localhost.localdomain ([86.32.47.9]) by smtp.gmail.com with ESMTPSA id e7sm1048472edk.3.2021.07.29.03.42.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 03:42:47 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Mark Greer , Bongsu Jeon , "David S. Miller" , Jakub Kicinski , linux-nfc@lists.01.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org Subject: [PATCH 12/12] nfc: mrvl: constify static nfcmrvl_if_ops Date: Thu, 29 Jul 2021 12:42:41 +0200 Message-Id: <20210729104241.48086-1-krzysztof.kozlowski@canonical.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> References: <20210729104022.47761-1-krzysztof.kozlowski@canonical.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org File-scope struct nfcmrvl_if_ops is not modified so can be made const. Signed-off-by: Krzysztof Kozlowski --- drivers/nfc/nfcmrvl/i2c.c | 2 +- drivers/nfc/nfcmrvl/main.c | 2 +- drivers/nfc/nfcmrvl/nfcmrvl.h | 4 ++-- drivers/nfc/nfcmrvl/spi.c | 2 +- drivers/nfc/nfcmrvl/uart.c | 2 +- drivers/nfc/nfcmrvl/usb.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/nfc/nfcmrvl/i2c.c b/drivers/nfc/nfcmrvl/i2c.c index 6e659e77c8a2..c38b228006fd 100644 --- a/drivers/nfc/nfcmrvl/i2c.c +++ b/drivers/nfc/nfcmrvl/i2c.c @@ -146,7 +146,7 @@ static void nfcmrvl_i2c_nci_update_config(struct nfcmrvl_private *priv, { } -static struct nfcmrvl_if_ops i2c_ops = { +static const struct nfcmrvl_if_ops i2c_ops = { .nci_open = nfcmrvl_i2c_nci_open, .nci_close = nfcmrvl_i2c_nci_close, .nci_send = nfcmrvl_i2c_nci_send, diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c index d8e48bdaf652..2fcf545012b1 100644 --- a/drivers/nfc/nfcmrvl/main.c +++ b/drivers/nfc/nfcmrvl/main.c @@ -91,7 +91,7 @@ static const struct nci_ops nfcmrvl_nci_ops = { struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, void *drv_data, - struct nfcmrvl_if_ops *ops, + const struct nfcmrvl_if_ops *ops, struct device *dev, const struct nfcmrvl_platform_data *pdata) { diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h index 84fafa95965e..165bd0a95190 100644 --- a/drivers/nfc/nfcmrvl/nfcmrvl.h +++ b/drivers/nfc/nfcmrvl/nfcmrvl.h @@ -77,7 +77,7 @@ struct nfcmrvl_private { /* PHY type */ enum nfcmrvl_phy phy; /* Low level driver ops */ - struct nfcmrvl_if_ops *if_ops; + const struct nfcmrvl_if_ops *if_ops; }; struct nfcmrvl_if_ops { @@ -92,7 +92,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv); int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb); struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy, void *drv_data, - struct nfcmrvl_if_ops *ops, + const struct nfcmrvl_if_ops *ops, struct device *dev, const struct nfcmrvl_platform_data *pdata); diff --git a/drivers/nfc/nfcmrvl/spi.c b/drivers/nfc/nfcmrvl/spi.c index 7b015bb33fc9..d64abd0c4df3 100644 --- a/drivers/nfc/nfcmrvl/spi.c +++ b/drivers/nfc/nfcmrvl/spi.c @@ -99,7 +99,7 @@ static void nfcmrvl_spi_nci_update_config(struct nfcmrvl_private *priv, drv_data->nci_spi->xfer_speed_hz = config->clk; } -static struct nfcmrvl_if_ops spi_ops = { +static const struct nfcmrvl_if_ops spi_ops = { .nci_open = nfcmrvl_spi_nci_open, .nci_close = nfcmrvl_spi_nci_close, .nci_send = nfcmrvl_spi_nci_send, diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c index 63ac434675c8..9c92cbdc42f0 100644 --- a/drivers/nfc/nfcmrvl/uart.c +++ b/drivers/nfc/nfcmrvl/uart.c @@ -49,7 +49,7 @@ static void nfcmrvl_uart_nci_update_config(struct nfcmrvl_private *priv, config->flow_control); } -static struct nfcmrvl_if_ops uart_ops = { +static const struct nfcmrvl_if_ops uart_ops = { .nci_open = nfcmrvl_uart_nci_open, .nci_close = nfcmrvl_uart_nci_close, .nci_send = nfcmrvl_uart_nci_send, diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c index 9d649b45300b..a99aedff795d 100644 --- a/drivers/nfc/nfcmrvl/usb.c +++ b/drivers/nfc/nfcmrvl/usb.c @@ -264,7 +264,7 @@ static int nfcmrvl_usb_nci_send(struct nfcmrvl_private *priv, return err; } -static struct nfcmrvl_if_ops usb_ops = { +static const struct nfcmrvl_if_ops usb_ops = { .nci_open = nfcmrvl_usb_nci_open, .nci_close = nfcmrvl_usb_nci_close, .nci_send = nfcmrvl_usb_nci_send,