nfc: constify nfc_ops
authorKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Sat, 24 Jul 2021 21:49:25 +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_ops, 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/pn533/pn533.c
include/net/nfc/nfc.h
net/nfc/core.c
net/nfc/digital_core.c
net/nfc/hci/core.c
net/nfc/nci/core.c

index cd64bfe204025d8fec3294d815e2d9e8b8c7770c..2f3f3fe9a0baa8e2d148a0db6e05f4c3757e0b5a 100644 (file)
@@ -2623,7 +2623,7 @@ static int pn533_dev_down(struct nfc_dev *nfc_dev)
        return ret;
 }
 
-static struct nfc_ops pn533_nfc_ops = {
+static const struct nfc_ops pn533_nfc_ops = {
        .dev_up = pn533_dev_up,
        .dev_down = pn533_dev_down,
        .dep_link_up = pn533_dep_link_up,
index 31672021d0714b4db76a076093cbeb67f40908fa..85b698794b14aef7b31eb072636d422faec2916d 100644 (file)
@@ -191,14 +191,14 @@ struct nfc_dev {
        const struct nfc_vendor_cmd *vendor_cmds;
        int n_vendor_cmds;
 
-       struct nfc_ops *ops;
+       const struct nfc_ops *ops;
        struct genl_info *cur_cmd_info;
 };
 #define to_nfc_dev(_dev) container_of(_dev, struct nfc_dev, dev)
 
 extern struct class nfc_class;
 
-struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
+struct nfc_dev *nfc_allocate_device(const struct nfc_ops *ops,
                                    u32 supported_protocols,
                                    int tx_headroom,
                                    int tx_tailroom);
index 573c80c6ff7a161ceafdf70b8f14463b6fb5adff..6ade54149b739f7490ce5e322c7baa7847557444 100644 (file)
@@ -1048,7 +1048,7 @@ struct nfc_dev *nfc_get_device(unsigned int idx)
  * @tx_headroom: reserved space at beginning of skb
  * @tx_tailroom: reserved space at end of skb
  */
-struct nfc_dev *nfc_allocate_device(struct nfc_ops *ops,
+struct nfc_dev *nfc_allocate_device(const struct nfc_ops *ops,
                                    u32 supported_protocols,
                                    int tx_headroom, int tx_tailroom)
 {
index 5044c7db577eb20b611b7213c95121946c23e3b8..8f2572decccdf2160f59f8170bb84390f2d6f005 100644 (file)
@@ -732,7 +732,7 @@ exit:
        return rc;
 }
 
-static struct nfc_ops digital_nfc_ops = {
+static const struct nfc_ops digital_nfc_ops = {
        .dev_up = digital_dev_up,
        .dev_down = digital_dev_down,
        .start_poll = digital_start_poll,
index e37d30302b060d0ea827c12a7565dd6338bb2149..b33fe4ee1581b52122966481cedad46e88c70b9f 100644 (file)
@@ -928,7 +928,7 @@ static int hci_fw_download(struct nfc_dev *nfc_dev, const char *firmware_name)
        return hdev->ops->fw_download(hdev, firmware_name);
 }
 
-static struct nfc_ops hci_nfc_ops = {
+static const struct nfc_ops hci_nfc_ops = {
        .dev_up = hci_dev_up,
        .dev_down = hci_dev_down,
        .start_poll = hci_start_poll,
index 50c625940fa378044daa87ab559055ed26a960b9..400d66c4e210f336ccfe408956c0052a93fa82ec 100644 (file)
@@ -1102,7 +1102,7 @@ static int nci_fw_download(struct nfc_dev *nfc_dev, const char *firmware_name)
        return ndev->ops->fw_download(ndev, firmware_name);
 }
 
-static struct nfc_ops nci_nfc_ops = {
+static const struct nfc_ops nci_nfc_ops = {
        .dev_up = nci_dev_up,
        .dev_down = nci_dev_down,
        .start_poll = nci_start_poll,