]> www.infradead.org Git - users/willy/xarray.git/commitdiff
nfc: constify pointer to nfc_vendor_cmd
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Sat, 24 Jul 2021 21:49:23 +0000 (23:49 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 25 Jul 2021 08:21:21 +0000 (09:21 +0100)
Neither the core nor the drivers modify the passed pointer to struct
nfc_vendor_cmd, so make it a pointer to const for correctness and
safety.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/nfc/st-nci/vendor_cmds.c
drivers/nfc/st21nfca/vendor_cmds.c
include/net/nfc/hci.h
include/net/nfc/nci_core.h
include/net/nfc/nfc.h
net/nfc/netlink.c

index 94b600029a2a029195af4439176a2380b2c30b57..30d2912d1a05beacec6793d1f1e23cb74e193be2 100644 (file)
@@ -371,7 +371,7 @@ static int st_nci_manufacturer_specific(struct nfc_dev *dev, void *data,
        return nfc_vendor_cmd_reply(msg);
 }
 
-static struct nfc_vendor_cmd st_nci_vendor_cmds[] = {
+static const struct nfc_vendor_cmd st_nci_vendor_cmds[] = {
        {
                .vendor_id = ST_NCI_VENDOR_OUI,
                .subcmd = FACTORY_MODE,
index 62332ca915545d5cfcca137a503a1a5adda2058d..74882866dbaff27774dda00ffddf9f423b31e751 100644 (file)
@@ -295,7 +295,7 @@ exit:
        return r;
 }
 
-static struct nfc_vendor_cmd st21nfca_vendor_cmds[] = {
+static const struct nfc_vendor_cmd st21nfca_vendor_cmds[] = {
        {
                .vendor_id = ST21NFCA_VENDOR_OUI,
                .subcmd = FACTORY_MODE,
index b35f37a576864f1380aad5415fb9838ba17630d0..2daec8036be9f2a272e4aa2f8fd8fb72df3e6836 100644 (file)
@@ -168,7 +168,7 @@ void nfc_hci_set_clientdata(struct nfc_hci_dev *hdev, void *clientdata);
 void *nfc_hci_get_clientdata(struct nfc_hci_dev *hdev);
 
 static inline int nfc_hci_set_vendor_cmds(struct nfc_hci_dev *hdev,
-                                         struct nfc_vendor_cmd *cmds,
+                                         const struct nfc_vendor_cmd *cmds,
                                          int n_cmds)
 {
        return nfc_set_vendor_cmds(hdev->ndev, cmds, n_cmds);
index e7118e0cc3b1dfa5c7a638c7308380130144f10d..00f2c60971d72316b875fc2ed9ba0db3944715d4 100644 (file)
@@ -343,7 +343,7 @@ static inline void *nci_get_drvdata(struct nci_dev *ndev)
 }
 
 static inline int nci_set_vendor_cmds(struct nci_dev *ndev,
-                                     struct nfc_vendor_cmd *cmds,
+                                     const struct nfc_vendor_cmd *cmds,
                                      int n_cmds)
 {
        return nfc_set_vendor_cmds(ndev->nfc_dev, cmds, n_cmds);
index 2cd3a261bcbcf7720984eeda85d25f859222c05b..31672021d0714b4db76a076093cbeb67f40908fa 100644 (file)
@@ -188,7 +188,7 @@ struct nfc_dev {
 
        struct rfkill *rfkill;
 
-       struct nfc_vendor_cmd *vendor_cmds;
+       const struct nfc_vendor_cmd *vendor_cmds;
        int n_vendor_cmds;
 
        struct nfc_ops *ops;
@@ -297,7 +297,7 @@ void nfc_send_to_raw_sock(struct nfc_dev *dev, struct sk_buff *skb,
                          u8 payload_type, u8 direction);
 
 static inline int nfc_set_vendor_cmds(struct nfc_dev *dev,
-                                     struct nfc_vendor_cmd *cmds,
+                                     const struct nfc_vendor_cmd *cmds,
                                      int n_cmds)
 {
        if (dev->vendor_cmds || dev->n_vendor_cmds)
index 722f7ef891e16db2076d0ecd9c77dd7fc132844e..70467a82be8f3865e08a3097303b9da7ee04ad37 100644 (file)
@@ -1531,7 +1531,7 @@ static int nfc_genl_vendor_cmd(struct sk_buff *skb,
                               struct genl_info *info)
 {
        struct nfc_dev *dev;
-       struct nfc_vendor_cmd *cmd;
+       const struct nfc_vendor_cmd *cmd;
        u32 dev_idx, vid, subcmd;
        u8 *data;
        size_t data_len;