Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nfc: constify nfc_llc_ops

Neither the core nor the drivers modify the passed pointer to struct
nfc_llc_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>

authored by

Krzysztof Kozlowski and committed by
David S. Miller
49545357 094c45c8

+7 -7
+1 -1
Documentation/driver-api/nfc/nfc-hci.rst
··· 181 181 The llc must be registered with nfc before it can be used. Do that by 182 182 calling:: 183 183 184 - nfc_llc_register(const char *name, struct nfc_llc_ops *ops); 184 + nfc_llc_register(const char *name, const struct nfc_llc_ops *ops); 185 185 186 186 Again, note that the llc does not handle the physical link. It is thus very 187 187 easy to mix any physical link with any llc for a given chip driver.
+1 -1
net/nfc/hci/llc.c
··· 41 41 } 42 42 } 43 43 44 - int nfc_llc_register(const char *name, struct nfc_llc_ops *ops) 44 + int nfc_llc_register(const char *name, const struct nfc_llc_ops *ops) 45 45 { 46 46 struct nfc_llc_engine *llc_engine; 47 47
+3 -3
net/nfc/hci/llc.h
··· 26 26 27 27 struct nfc_llc_engine { 28 28 const char *name; 29 - struct nfc_llc_ops *ops; 29 + const struct nfc_llc_ops *ops; 30 30 struct list_head entry; 31 31 }; 32 32 33 33 struct nfc_llc { 34 34 void *data; 35 - struct nfc_llc_ops *ops; 35 + const struct nfc_llc_ops *ops; 36 36 int rx_headroom; 37 37 int rx_tailroom; 38 38 }; 39 39 40 40 void *nfc_llc_get_data(struct nfc_llc *llc); 41 41 42 - int nfc_llc_register(const char *name, struct nfc_llc_ops *ops); 42 + int nfc_llc_register(const char *name, const struct nfc_llc_ops *ops); 43 43 void nfc_llc_unregister(const char *name); 44 44 45 45 int nfc_llc_nop_register(void);
+1 -1
net/nfc/hci/llc_nop.c
··· 71 71 return llc_nop->xmit_to_drv(llc_nop->hdev, skb); 72 72 } 73 73 74 - static struct nfc_llc_ops llc_nop_ops = { 74 + static const struct nfc_llc_ops llc_nop_ops = { 75 75 .init = llc_nop_init, 76 76 .deinit = llc_nop_deinit, 77 77 .start = llc_nop_start,
+1 -1
net/nfc/hci/llc_shdlc.c
··· 820 820 return 0; 821 821 } 822 822 823 - static struct nfc_llc_ops llc_shdlc_ops = { 823 + static const struct nfc_llc_ops llc_shdlc_ops = { 824 824 .init = llc_shdlc_init, 825 825 .deinit = llc_shdlc_deinit, 826 826 .start = llc_shdlc_start,