Skip to content

Commit

Permalink
nfc: constify nfc_hci_ops
Browse files Browse the repository at this point in the history
Neither the core nor the drivers modify the passed pointer to struct
nfc_hci_ops, so make it a pointer to const for correctness and safety.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
krzk authored and davem330 committed Jul 25, 2021
1 parent f6c802a commit 094c45c
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/nfc/microread/microread.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ static int microread_event_received(struct nfc_hci_dev *hdev, u8 pipe,
return r;
}

static struct nfc_hci_ops microread_hci_ops = {
static const struct nfc_hci_ops microread_hci_ops = {
.open = microread_open,
.close = microread_close,
.hci_ready = microread_hci_ready,
Expand Down
2 changes: 1 addition & 1 deletion drivers/nfc/pn544/pn544.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ static int pn544_hci_disable_se(struct nfc_hci_dev *hdev, u32 se_idx)
}
}

static struct nfc_hci_ops pn544_hci_ops = {
static const struct nfc_hci_ops pn544_hci_ops = {
.open = pn544_hci_open,
.close = pn544_hci_close,
.hci_ready = pn544_hci_ready,
Expand Down
2 changes: 1 addition & 1 deletion drivers/nfc/st21nfca/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,7 +912,7 @@ static int st21nfca_hci_event_received(struct nfc_hci_dev *hdev, u8 pipe,
}
}

static struct nfc_hci_ops st21nfca_hci_ops = {
static const struct nfc_hci_ops st21nfca_hci_ops = {
.open = st21nfca_hci_open,
.close = st21nfca_hci_close,
.load_session = st21nfca_hci_load_session,
Expand Down
4 changes: 2 additions & 2 deletions include/net/nfc/hci.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ struct nfc_hci_dev {

struct sk_buff_head msg_rx_queue;

struct nfc_hci_ops *ops;
const struct nfc_hci_ops *ops;

struct nfc_llc *llc;

Expand Down Expand Up @@ -151,7 +151,7 @@ struct nfc_hci_dev {
};

/* hci device allocation */
struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
struct nfc_hci_dev *nfc_hci_allocate_device(const struct nfc_hci_ops *ops,
struct nfc_hci_init_data *init_data,
unsigned long quirks,
u32 protocols,
Expand Down
2 changes: 1 addition & 1 deletion net/nfc/hci/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ static const struct nfc_ops hci_nfc_ops = {
.se_io = hci_se_io,
};

struct nfc_hci_dev *nfc_hci_allocate_device(struct nfc_hci_ops *ops,
struct nfc_hci_dev *nfc_hci_allocate_device(const struct nfc_hci_ops *ops,
struct nfc_hci_init_data *init_data,
unsigned long quirks,
u32 protocols,
Expand Down

0 comments on commit 094c45c

Please sign in to comment.