nfc: constify data structures
Subsystems (8)
cover nfc: constify data structures
Hi,
Constify pointers to several data structures which are not modified by NFC core or by drivers to make it slightly safer. No functional impact expected.
Best regards,
Krzysztof
Krzysztof Kozlowski (12):
nfc: constify payload argument in nci_send_cmd()
nfc: constify nci_ops
nfc: s3fwrn5: constify nci_ops
nfc: constify nci_driver_ops (prop_ops and core_ops)
nfc: constify nfc_phy_ops
nfc: st21nfca: constify file-scope arrays
nfc: constify pointer to nfc_vendor_cmd
nfc: constify nfc_hci_gate
nfc: constify nfc_ops
nfc: constify nfc_hci_ops
nfc: constify nfc_llc_ops
nfc: constify nfc_digital_ops
Documentation/driver-api/nfc/nfc-hci.rst | 2 +- drivers/nfc/fdp/fdp.c | 11 ++++++----- drivers/nfc/fdp/fdp.h | 2 +- drivers/nfc/fdp/i2c.c | 2 +- drivers/nfc/mei_phy.c | 2 +- drivers/nfc/mei_phy.h | 2 +- drivers/nfc/microread/i2c.c | 2 +- drivers/nfc/microread/microread.c | 12 ++++++------ drivers/nfc/microread/microread.h | 6 +++--- drivers/nfc/nfcmrvl/main.c | 2 +- drivers/nfc/nfcsim.c | 2 +- drivers/nfc/nxp-nci/core.c | 2 +- drivers/nfc/pn533/pn533.c | 2 +- drivers/nfc/pn544/i2c.c | 2 +- drivers/nfc/pn544/pn544.c | 13 ++++++------ drivers/nfc/pn544/pn544.h | 7 ++++--- drivers/nfc/port100.c | 2 +- drivers/nfc/s3fwrn5/core.c | 7 +++---- drivers/nfc/s3fwrn5/nci.c | 8 +------- drivers/nfc/s3fwrn5/nci.h | 2 +- drivers/nfc/st-nci/core.c | 5 +++-- drivers/nfc/st-nci/i2c.c | 2 +- drivers/nfc/st-nci/ndlc.c | 6 +++--- drivers/nfc/st-nci/ndlc.h | 8 ++++---- drivers/nfc/st-nci/spi.c | 2 +- drivers/nfc/st-nci/vendor_cmds.c | 2 +- drivers/nfc/st21nfca/core.c | 6 +++--- drivers/nfc/st21nfca/i2c.c | 6 +++--- drivers/nfc/st21nfca/st21nfca.h | 4 ++-- drivers/nfc/st21nfca/vendor_cmds.c | 2 +- drivers/nfc/st95hf/core.c | 2 +- drivers/nfc/trf7970a.c | 2 +- drivers/nfc/virtual_ncidev.c | 2 +- include/net/nfc/digital.h | 4 ++-- include/net/nfc/hci.h | 6 +++--- include/net/nfc/nci_core.h | 12 ++++++------ include/net/nfc/nfc.h | 8 ++++---- net/nfc/core.c | 2 +- net/nfc/digital_core.c | 4 ++-- net/nfc/hci/core.c | 6 +++--- net/nfc/hci/llc.c | 2 +- net/nfc/hci/llc.h | 6 +++--- net/nfc/hci/llc_nop.c | 2 +- net/nfc/hci/llc_shdlc.c | 2 +- net/nfc/nci/core.c | 25 ++++++++++++------------ net/nfc/netlink.c | 2 +- 46 files changed, 108 insertions(+), 112 deletions(-)
Signature · 1 line
2.27.0
PATCH 1/12 nfc: constify payload argument in nci_send_cmd()
The nci_send_cmd() payload argument is passed directly to skb_put_data() which already accepts a pointer to const, so make it const as well for correctness and safety.
--- include/net/nfc/nci_core.h | 2 +- net/nfc/nci/core.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/net/nfc/nci_core.h +1 -1
@@ -360,7 +360,7 @@ int nci_core_rsp_packet(struct nci_dev *ndev, __u16 opcode,int nci_core_ntf_packet (struct nci_dev *ndev,__u16 opcode,struct sk_buff *skb);void nci_rx_data_packet (struct nci_dev *ndev,struct sk_buff *skb); -int nci_send_cmd (struct nci_dev *ndev,__u16 opcode,__u8 plen,void *payload); +int nci_send_cmd (struct nci_dev *ndev,__u16 opcode,__u8 plen,const void *payload);int nci_send_data (struct nci_dev *ndev,__u8 conn_id,struct sk_buff *skb);int nci_conn_max_data_pkt_payload_size (struct nci_dev *ndev,__u8 conn_id); void nci_data_exchange_complete(struct nci_dev *ndev, struct sk_buff *skb,
net/nfc/nci/core.c +1 -1
@@ -1332,7 +1332,7 @@ int nci_send_frame(struct nci_dev *ndev, struct sk_buff *skb)EXPORT_SYMBOL (nci_send_frame);/* Send NCI command */ -int nci_send_cmd (struct nci_dev *ndev,__u16 opcode,__u8 plen,void *payload) +int nci_send_cmd (struct nci_dev *ndev,__u16 opcode,__u8 plen,const void *payload) {struct nci_ctrl_hdr *hdr;struct sk_buff *skb;
Signature · 1 line
2.27.0
PATCH 2/12 nfc: constify nci_ops
In reply to Krzysztof KozlowskiThe struct nci_ops is modified by NFC core in only one case:nci_allocate_device() receives too many proprietary commands (prop_ops) to configure. This is a build time known constrain, so a graceful handling of such case is not necessary.
Instead, fail the nci_allocate_device() and add BUILD_BUG_ON() to places which set these.
This allows to constify the struct nci_ops (consisting of function pointers) for correctness and safety.
--- drivers/nfc/fdp/fdp.c | 3 ++- drivers/nfc/nfcmrvl/main.c | 2 +- drivers/nfc/nxp-nci/core.c | 2 +- drivers/nfc/st-nci/core.c | 3 ++- drivers/nfc/virtual_ncidev.c | 2 +- include/net/nfc/nci_core.h | 4 ++-- net/nfc/nci/core.c | 5 ++--- 7 files changed, 11 insertions(+), 10 deletions(-)
drivers/nfc/fdp/fdp.c +2 -1
@@ -675,7 +675,7 @@ static struct nci_driver_ops fdp_prop_ops[] = { }, }; -static struct nci_ops nci_ops = { +static const struct nci_ops nci_ops = { .open = fdp_nci_open, .close = fdp_nci_close, .send = fdp_nci_send,
@@ -718,6 +718,7 @@ int fdp_nci_probe(struct fdp_i2c_phy *phy, struct nfc_phy_ops *phy_ops,NFC_PROTO_NFC_DEP_MASK |NFC_PROTO_ISO15693_MASK ; +BUILD_BUG_ON (ARRAY_SIZE (fdp_prop_ops) >NCI_MAX_PROPRIETARY_CMD ); ndev =nci_allocate_device (&nci_ops, protocols, tx_headroom, tx_tailroom);if (!ndev) {
drivers/nfc/nfcmrvl/main.c +1 -1
@@ -81,7 +81,7 @@ static int nfcmrvl_nci_fw_download(struct nci_dev *ndev,return nfcmrvl_fw_dnld_start (ndev, firmware_name); } -static struct nci_ops nfcmrvl_nci_ops = { +static const struct nci_ops nfcmrvl_nci_ops = { .open = nfcmrvl_nci_open, .close = nfcmrvl_nci_close, .send = nfcmrvl_nci_send,
drivers/nfc/nxp-nci/core.c +1 -1
@@ -83,7 +83,7 @@ static int nxp_nci_send(struct nci_dev *ndev, struct sk_buff *skb)return r; } -static struct nci_ops nxp_nci_ops = { +static const struct nci_ops nxp_nci_ops = { .open = nxp_nci_open, .close = nxp_nci_close, .send = nxp_nci_send,
drivers/nfc/st-nci/core.c +2 -1
@@ -94,7 +94,7 @@ static struct nci_driver_ops st_nci_prop_ops[] = { }, }; -static struct nci_ops st_nci_ops = { +static const struct nci_ops st_nci_ops = { .init = st_nci_init, .open = st_nci_open, .close = st_nci_close,
@@ -131,6 +131,7 @@ int st_nci_probe(struct llt_ndlc *ndlc, int phy_headroom, | NFC_PROTO_ISO15693_MASK |NFC_PROTO_NFC_DEP_MASK ; +BUILD_BUG_ON (ARRAY_SIZE (st_nci_prop_ops) >NCI_MAX_PROPRIETARY_CMD ); ndlc->ndev =nci_allocate_device (&st_nci_ops, protocols, phy_headroom, phy_tailroom);if (!ndlc->ndev) {
drivers/nfc/virtual_ncidev.c +1 -1
@@ -65,7 +65,7 @@ static int virtual_nci_send(struct nci_dev *ndev, struct sk_buff *skb)return 0 ; } -static struct nci_ops virtual_nci_ops = { +static const struct nci_ops virtual_nci_ops = { .open = virtual_nci_open, .close = virtual_nci_close, .send = virtual_nci_send
include/net/nfc/nci_core.h +2 -2
@@ -194,7 +194,7 @@ struct nci_hci_dev {/* NCI Core structures */ struct nci_dev {struct nfc_dev *nfc_dev; -struct nci_ops *ops; +const struct nci_ops *ops;struct nci_hci_dev *hci_dev;int tx_headroom;
@@ -267,7 +267,7 @@ struct nci_dev { };/* ----- NCI Devices ----- */ -struct nci_dev *nci_allocate_device (struct nci_ops *ops, +struct nci_dev *nci_allocate_device (const struct nci_ops *ops,__u32 supported_protocols,int tx_headroom,int tx_tailroom);
net/nfc/nci/core.c +2 -3
@@ -1129,7 +1129,7 @@ static struct nfc_ops nci_nfc_ops = {* @tx_headroom: Reserved space at beginning of skb * @tx_tailroom: Reserved space at end of skb */ -struct nci_dev *nci_allocate_device (struct nci_ops *ops, +struct nci_dev *nci_allocate_device (const struct nci_ops *ops,__u32 supported_protocols,int tx_headroom,int tx_tailroom) {
@@ -1152,8 +1152,7 @@ struct nci_dev *nci_allocate_device(struct nci_ops *ops,if (ops->n_prop_ops >NCI_MAX_PROPRIETARY_CMD ) {pr_err ("Too many proprietary commands: %zd\n" , ops->n_prop_ops); - ops->prop_ops =NULL ; - ops->n_prop_ops =0 ; + goto free_nci; } ndev->tx_headroom = tx_headroom;
Signature · 1 line
2.27.0
PATCH 3/12 nfc: s3fwrn5: constify nci_ops
In reply to Krzysztof Kozlowskis3fwrn5 driver modifies static struct nci_ops only to set prop_ops. Since prop_ops is build time constant with known size, it can be made const. This allows to removeo the function setting the prop_ops - s3fwrn5_nci_get_prop_ops().
--- drivers/nfc/s3fwrn5/core.c | 7 +++---- drivers/nfc/s3fwrn5/nci.c | 8 +------- drivers/nfc/s3fwrn5/nci.h | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-)
drivers/nfc/s3fwrn5/core.c +3 -4
@@ -143,11 +143,13 @@ static int s3fwrn5_nci_post_setup(struct nci_dev *ndev)return nci_core_init (info->ndev); } -static struct nci_ops s3fwrn5_nci_ops = { +static const struct nci_ops s3fwrn5_nci_ops = { .open = s3fwrn5_nci_open, .close = s3fwrn5_nci_close, .send = s3fwrn5_nci_send, .post_setup = s3fwrn5_nci_post_setup, + .prop_ops = s3fwrn5_nci_prop_ops, + .n_prop_ops =ARRAY_SIZE (s3fwrn5_nci_prop_ops), }; int s3fwrn5_probe(struct nci_dev **ndev, void *phy_id, struct device *pdev,
@@ -167,9 +169,6 @@ int s3fwrn5_probe(struct nci_dev **ndev, void *phy_id, struct device *pdev,s3fwrn5_set_mode (info,S3FWRN5_MODE_COLD ); -s3fwrn5_nci_get_prop_ops (&s3fwrn5_nci_ops.prop_ops, - &s3fwrn5_nci_ops.n_prop_ops); - info->ndev =nci_allocate_device (&s3fwrn5_nci_ops,S3FWRN5_NFC_PROTOCOLS ,0 ,0 );if (!info->ndev)
drivers/nfc/s3fwrn5/nci.c +1 -7
@@ -20,7 +20,7 @@ static int s3fwrn5_nci_prop_rsp(struct nci_dev *ndev, struct sk_buff *skb)return 0 ; } -static struct nci_driver_ops s3fwrn5_nci_prop_ops[] = { +struct nci_driver_ops s3fwrn5_nci_prop_ops[4 ] = { { .opcode =nci_opcode_pack (NCI_GID_PROPRIETARY ,NCI_PROP_SET_RFREG ),
@@ -43,12 +43,6 @@ static struct nci_driver_ops s3fwrn5_nci_prop_ops[] = { }, }; -void s3fwrn5_nci_get_prop_ops (struct nci_driver_ops **ops,size_t *n) -{ - *ops = s3fwrn5_nci_prop_ops; - *n =ARRAY_SIZE (s3fwrn5_nci_prop_ops); -} -#define S3FWRN5_RFREG_SECTION_SIZE 252int s3fwrn5_nci_rf_configure (struct s3fwrn5_info *info,const char *fw_name)
drivers/nfc/s3fwrn5/nci.h +1 -1
@@ -50,7 +50,7 @@ struct nci_prop_fw_cfg_rsp { __u8 status; }; -void s3fwrn5_nci_get_prop_ops (struct nci_driver_ops **ops,size_t *n); +extern struct nci_driver_ops s3fwrn5_nci_prop_ops[4 ];int s3fwrn5_nci_rf_configure (struct s3fwrn5_info *info,const char *fw_name);#endif /* __LOCAL_S3FWRN5_NCI_H_ */
Signature · 1 line
2.27.0
PATCH 4/12 nfc: constify nci_driver_ops (prop_ops and core_ops)
In reply to Krzysztof KozlowskiNeither the core nor the drivers modify the passed pointer to struct nci_driver_ops (consisting of function pointers), so make it a pointer to const for correctness and safety.
--- drivers/nfc/fdp/fdp.c | 4 ++-- drivers/nfc/s3fwrn5/nci.c | 2 +- drivers/nfc/s3fwrn5/nci.h | 2 +- drivers/nfc/st-nci/core.c | 2 +- include/net/nfc/nci_core.h | 4 ++-- net/nfc/nci/core.c | 16 ++++++++-------- 6 files changed, 15 insertions(+), 15 deletions(-)
drivers/nfc/fdp/fdp.c +2 -2
@@ -651,7 +651,7 @@ static int fdp_nci_core_get_config_rsp_packet(struct nci_dev *ndev,return 0 ; } -static struct nci_driver_ops fdp_core_ops[] = { +static const struct nci_driver_ops fdp_core_ops[] = { { .opcode =NCI_OP_CORE_GET_CONFIG_RSP , .rsp = fdp_nci_core_get_config_rsp_packet,
@@ -662,7 +662,7 @@ static struct nci_driver_ops fdp_core_ops[] = { }, }; -static struct nci_driver_ops fdp_prop_ops[] = { +static const struct nci_driver_ops fdp_prop_ops[] = { { .opcode =nci_opcode_pack (NCI_GID_PROP ,NCI_OP_PROP_PATCH_OID ), .rsp = fdp_nci_prop_patch_rsp_packet,
drivers/nfc/s3fwrn5/nci.c +1 -1
@@ -20,7 +20,7 @@ static int s3fwrn5_nci_prop_rsp(struct nci_dev *ndev, struct sk_buff *skb)return 0 ; } -struct nci_driver_ops s3fwrn5_nci_prop_ops[4 ] = { +const struct nci_driver_ops s3fwrn5_nci_prop_ops[4 ] = { { .opcode =nci_opcode_pack (NCI_GID_PROPRIETARY ,NCI_PROP_SET_RFREG ),
drivers/nfc/s3fwrn5/nci.h +1 -1
@@ -50,7 +50,7 @@ struct nci_prop_fw_cfg_rsp { __u8 status; }; -extern struct nci_driver_ops s3fwrn5_nci_prop_ops[4 ]; +extern const struct nci_driver_ops s3fwrn5_nci_prop_ops[4 ];int s3fwrn5_nci_rf_configure (struct s3fwrn5_info *info,const char *fw_name);#endif /* __LOCAL_S3FWRN5_NCI_H_ */
drivers/nfc/st-nci/core.c +1 -1
@@ -86,7 +86,7 @@ static int st_nci_prop_rsp_packet(struct nci_dev *ndev,return 0 ; } -static struct nci_driver_ops st_nci_prop_ops[] = { +static const struct nci_driver_ops st_nci_prop_ops[] = { { .opcode =nci_opcode_pack (NCI_GID_PROPRIETARY ,ST_NCI_CORE_PROP ),
include/net/nfc/nci_core.h +2 -2
@@ -82,10 +82,10 @@ struct nci_ops {void (*hci_cmd_received)(struct nci_dev *ndev,u8 pipe,u8 cmd,struct sk_buff *skb); -struct nci_driver_ops *prop_ops; +const struct nci_driver_ops *prop_ops;size_t n_prop_ops; -struct nci_driver_ops *core_ops; +const struct nci_driver_ops *core_ops;size_t n_core_ops; };
net/nfc/nci/core.c +8 -8
@@ -1363,12 +1363,12 @@ int nci_send_cmd(struct nci_dev *ndev, __u16 opcode, __u8 plen, const void *paylEXPORT_SYMBOL (nci_send_cmd);/* Proprietary commands API */ -static struct nci_driver_ops *ops_cmd_lookup (struct nci_driver_ops *ops, -size_t n_ops, -__u16 opcode) +static const struct nci_driver_ops *ops_cmd_lookup (const struct nci_driver_ops *ops, +size_t n_ops, +__u16 opcode) {size_t i; -struct nci_driver_ops *op; +const struct nci_driver_ops *op;if (!ops || !n_ops)return NULL ;
@@ -1383,10 +1383,10 @@ static struct nci_driver_ops *ops_cmd_lookup(struct nci_driver_ops *ops, }static int nci_op_rsp_packet (struct nci_dev *ndev,__u16 rsp_opcode, -struct sk_buff *skb,struct nci_driver_ops *ops, +struct sk_buff *skb,const struct nci_driver_ops *ops,size_t n_ops) { -struct nci_driver_ops *op; +const struct nci_driver_ops *op; op =ops_cmd_lookup (ops, n_ops, rsp_opcode);if (!op || !op->rsp)
@@ -1396,10 +1396,10 @@ static int nci_op_rsp_packet(struct nci_dev *ndev, __u16 rsp_opcode, }static int nci_op_ntf_packet (struct nci_dev *ndev,__u16 ntf_opcode, -struct sk_buff *skb,struct nci_driver_ops *ops, +struct sk_buff *skb,const struct nci_driver_ops *ops,size_t n_ops) { -struct nci_driver_ops *op; +const struct nci_driver_ops *op; op =ops_cmd_lookup (ops, n_ops, ntf_opcode);if (!op || !op->ntf)
Signature · 1 line
2.27.0
PATCH 5/12 nfc: constify nfc_phy_ops
In reply to Krzysztof KozlowskiNeither the core nor the drivers modify the passed pointer to struct nfc_phy_ops (consisting of function pointers), so make it a pointer to const for correctness and safety.
--- drivers/nfc/fdp/fdp.c | 4 ++-- drivers/nfc/fdp/fdp.h | 2 +- drivers/nfc/fdp/i2c.c | 2 +- drivers/nfc/mei_phy.c | 2 +- drivers/nfc/mei_phy.h | 2 +- drivers/nfc/microread/i2c.c | 2 +- drivers/nfc/microread/microread.c | 8 ++++---- drivers/nfc/microread/microread.h | 6 +++--- drivers/nfc/pn544/i2c.c | 2 +- drivers/nfc/pn544/pn544.c | 9 +++++---- drivers/nfc/pn544/pn544.h | 7 ++++--- drivers/nfc/st-nci/i2c.c | 2 +- drivers/nfc/st-nci/ndlc.c | 6 +++--- drivers/nfc/st-nci/ndlc.h | 8 ++++---- drivers/nfc/st-nci/spi.c | 2 +- drivers/nfc/st21nfca/core.c | 2 +- drivers/nfc/st21nfca/i2c.c | 2 +- drivers/nfc/st21nfca/st21nfca.h | 4 ++-- 18 files changed, 37 insertions(+), 35 deletions(-)
drivers/nfc/fdp/fdp.c +2 -2
@@ -38,7 +38,7 @@#define NCI_OP_PROP_SET_PDATA_OID 0x23struct fdp_nci_info { -struct nfc_phy_ops *phy_ops; +const struct nfc_phy_ops *phy_ops;struct fdp_i2c_phy *phy;struct nci_dev *ndev;
@@ -687,7 +687,7 @@ static const struct nci_ops nci_ops = { .n_core_ops = ARRAY_SIZE(fdp_core_ops), }; -int fdp_nci_probe (struct fdp_i2c_phy *phy,struct nfc_phy_ops *phy_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)
drivers/nfc/fdp/fdp.h +1 -1
@@ -21,7 +21,7 @@ struct fdp_i2c_phy {uint16_t next_read_size; }; -int fdp_nci_probe (struct fdp_i2c_phy *phy,struct nfc_phy_ops *phy_ops, +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);void fdp_nci_remove (struct nci_dev *ndev);
drivers/nfc/fdp/i2c.c +1 -1
@@ -120,7 +120,7 @@ static int fdp_nci_i2c_write(void *phy_id, struct sk_buff *skb)return r; } -static struct nfc_phy_ops i2c_phy_ops = { +static const struct nfc_phy_ops i2c_phy_ops = { .write = fdp_nci_i2c_write, .enable = fdp_nci_i2c_enable, .disable = fdp_nci_i2c_disable,
drivers/nfc/mei_phy.c +1 -1
@@ -362,7 +362,7 @@ static void nfc_mei_phy_disable(void *phy_id) phy->powered =0 ; } -struct nfc_phy_ops mei_phy_ops = { +const struct nfc_phy_ops mei_phy_ops = { .write = nfc_mei_phy_write, .enable = nfc_mei_phy_enable, .disable = nfc_mei_phy_disable,
drivers/nfc/mei_phy.h +1 -1
@@ -45,7 +45,7 @@ struct nfc_mei_phy {int hard_fault; }; -extern struct nfc_phy_ops mei_phy_ops; +extern const struct nfc_phy_ops mei_phy_ops;struct nfc_mei_phy *nfc_mei_phy_alloc (struct mei_cl_device *device);void nfc_mei_phy_free (struct nfc_mei_phy *phy);
drivers/nfc/microread/i2c.c +1 -1
@@ -225,7 +225,7 @@ static irqreturn_t microread_i2c_irq_thread_fn(int irq, void *phy_id)return IRQ_HANDLED ; } -static struct nfc_phy_ops i2c_phy_ops = { +static const struct nfc_phy_ops i2c_phy_ops = { .write = microread_i2c_write, .enable = microread_i2c_enable, .disable = microread_i2c_disable,
drivers/nfc/microread/microread.c +4 -4
@@ -152,7 +152,7 @@ static struct nfc_hci_gate microread_gates[] = {#define MICROREAD_CMD_TAILROOM 2struct microread_info { -struct nfc_phy_ops *phy_ops; +const struct nfc_phy_ops *phy_ops;void *phy_id;struct nfc_hci_dev *hdev;
@@ -641,9 +641,9 @@ static struct nfc_hci_ops microread_hci_ops = { .event_received = microread_event_received, }; -int microread_probe (void *phy_id,struct nfc_phy_ops *phy_ops,char *llc_name, -int phy_headroom,int phy_tailroom,int phy_payload, -struct nfc_hci_dev **hdev) +int microread_probe (void *phy_id,const struct nfc_phy_ops *phy_ops, +char *llc_name,int phy_headroom,int phy_tailroom, +int phy_payload,struct nfc_hci_dev **hdev) {struct microread_info *info;unsigned long quirks =0 ;
drivers/nfc/microread/microread.h +3 -3
@@ -10,9 +10,9 @@#define DRIVER_DESC "NFC driver for microread" -int microread_probe (void *phy_id,struct nfc_phy_ops *phy_ops,char *llc_name, -int phy_headroom,int phy_tailroom,int phy_payload, -struct nfc_hci_dev **hdev); +int microread_probe (void *phy_id,const struct nfc_phy_ops *phy_ops, +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);
drivers/nfc/pn544/i2c.c +1 -1
@@ -515,7 +515,7 @@ static irqreturn_t pn544_hci_i2c_irq_thread_fn(int irq, void *phy_id)return IRQ_HANDLED ; } -static struct nfc_phy_ops i2c_phy_ops = { +static const struct nfc_phy_ops i2c_phy_ops = { .write = pn544_hci_i2c_write, .enable = pn544_hci_i2c_enable, .disable = pn544_hci_i2c_disable,
drivers/nfc/pn544/pn544.c +5 -4
@@ -108,7 +108,7 @@ static struct nfc_hci_gate pn544_gates[] = {#define PN544_CMDS_HEADROOM 2struct pn544_hci_info { -struct nfc_phy_ops *phy_ops; +const struct nfc_phy_ops *phy_ops;void *phy_id;struct nfc_hci_dev *hdev;
@@ -901,9 +901,10 @@ static struct nfc_hci_ops pn544_hci_ops = { .disable_se = pn544_hci_disable_se, }; -int pn544_hci_probe (void *phy_id,struct nfc_phy_ops *phy_ops,char *llc_name, -int phy_headroom,int phy_tailroom,int phy_payload, -fw_download_t fw_download,struct nfc_hci_dev **hdev) +int pn544_hci_probe (void *phy_id,const struct nfc_phy_ops *phy_ops, +char *llc_name,int phy_headroom,int phy_tailroom, +int phy_payload,fw_download_t fw_download, +struct nfc_hci_dev **hdev) {struct pn544_hci_info *info;u32 protocols;
drivers/nfc/pn544/pn544.h +4 -3
@@ -16,9 +16,10 @@typedef int (*fw_download_t )(void *context,const char *firmware_name,u8 hw_variant); -int pn544_hci_probe (void *phy_id,struct nfc_phy_ops *phy_ops,char *llc_name, -int phy_headroom,int phy_tailroom,int phy_payload, -fw_download_t fw_download,struct nfc_hci_dev **hdev); +int pn544_hci_probe (void *phy_id,const struct nfc_phy_ops *phy_ops, +char *llc_name,int phy_headroom,int phy_tailroom, +int phy_payload,fw_download_t fw_download, +struct nfc_hci_dev **hdev);void pn544_hci_remove (struct nfc_hci_dev *hdev);#endif /* __LOCAL_PN544_H_ */
drivers/nfc/st-nci/i2c.c +1 -1
@@ -186,7 +186,7 @@ static irqreturn_t st_nci_irq_thread_fn(int irq, void *phy_id)return IRQ_HANDLED ; } -static struct nfc_phy_ops i2c_phy_ops = { +static const struct nfc_phy_ops i2c_phy_ops = { .write = st_nci_i2c_write, .enable = st_nci_i2c_enable, .disable = st_nci_i2c_disable,
drivers/nfc/st-nci/ndlc.c +3 -3
@@ -253,9 +253,9 @@ static void ndlc_t2_timeout(struct timer_list *t)schedule_work (&ndlc->sm_work); } -int ndlc_probe (void *phy_id,struct nfc_phy_ops *phy_ops,struct device *dev, -int phy_headroom,int phy_tailroom,struct llt_ndlc **ndlc_id, -struct st_nci_se_status *se_status) +int ndlc_probe (void *phy_id,const struct nfc_phy_ops *phy_ops, +struct device *dev,int phy_headroom,int phy_tailroom, +struct llt_ndlc **ndlc_id,struct st_nci_se_status *se_status) {struct llt_ndlc *ndlc;
drivers/nfc/st-nci/ndlc.h +4 -4
@@ -16,7 +16,7 @@ struct st_nci_se_status;/* Low Level Transport description */ struct llt_ndlc {struct nci_dev *ndev; -struct nfc_phy_ops *ops; +const struct nfc_phy_ops *ops;void *phy_id;struct timer_list t1_timer;
@@ -45,8 +45,8 @@ int ndlc_open(struct llt_ndlc *ndlc);void ndlc_close (struct llt_ndlc *ndlc);int ndlc_send (struct llt_ndlc *ndlc,struct sk_buff *skb);void ndlc_recv (struct llt_ndlc *ndlc,struct sk_buff *skb); -int ndlc_probe (void *phy_id,struct nfc_phy_ops *phy_ops,struct device *dev, -int phy_headroom,int phy_tailroom,struct llt_ndlc **ndlc_id, -struct st_nci_se_status *se_status); +int ndlc_probe (void *phy_id,const struct nfc_phy_ops *phy_ops, +struct device *dev,int phy_headroom,int phy_tailroom, +struct llt_ndlc **ndlc_id,struct st_nci_se_status *se_status);void ndlc_remove (struct llt_ndlc *ndlc);#endif /* __LOCAL_NDLC_H__ */
drivers/nfc/st-nci/spi.c +1 -1
@@ -198,7 +198,7 @@ static irqreturn_t st_nci_irq_thread_fn(int irq, void *phy_id)return IRQ_HANDLED ; } -static struct nfc_phy_ops spi_phy_ops = { +static const struct nfc_phy_ops spi_phy_ops = { .write = st_nci_spi_write, .enable = st_nci_spi_enable, .disable = st_nci_spi_disable,
drivers/nfc/st21nfca/core.c +1 -1
@@ -935,7 +935,7 @@ static struct nfc_hci_ops st21nfca_hci_ops = { .se_io = st21nfca_hci_se_io, }; -int st21nfca_hci_probe (void *phy_id,struct nfc_phy_ops *phy_ops, +int st21nfca_hci_probe (void *phy_id,const struct nfc_phy_ops *phy_ops,char *llc_name,int phy_headroom,int phy_tailroom,int phy_payload,struct nfc_hci_dev **hdev,struct st21nfca_se_status *se_status)
drivers/nfc/st21nfca/i2c.c +1 -1
@@ -482,7 +482,7 @@ static irqreturn_t st21nfca_hci_irq_thread_fn(int irq, void *phy_id)return IRQ_HANDLED ; } -static struct nfc_phy_ops i2c_phy_ops = { +static const struct nfc_phy_ops i2c_phy_ops = { .write = st21nfca_hci_i2c_write, .enable = st21nfca_hci_i2c_enable, .disable = st21nfca_hci_i2c_disable,
drivers/nfc/st21nfca/st21nfca.h +2 -2
@@ -144,7 +144,7 @@ struct st21nfca_se_info { };struct st21nfca_hci_info { -struct nfc_phy_ops *phy_ops; +const struct nfc_phy_ops *phy_ops;void *phy_id;struct nfc_hci_dev *hdev;
@@ -163,7 +163,7 @@ struct st21nfca_hci_info {struct st21nfca_vendor_info vendor_info; }; -int st21nfca_hci_probe (void *phy_id,struct nfc_phy_ops *phy_ops, +int st21nfca_hci_probe (void *phy_id,const struct nfc_phy_ops *phy_ops,char *llc_name,int phy_headroom,int phy_tailroom,int phy_payload,struct nfc_hci_dev **hdev,struct st21nfca_se_status *se_status);
Signature · 1 line
2.27.0
PATCH 6/12 nfc: st21nfca: constify file-scope arrays
In reply to Krzysztof KozlowskiDriver only reads len_seq and wait_tab variables.
--- drivers/nfc/st21nfca/i2c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nfc/st21nfca/i2c.c +2 -2
@@ -76,8 +76,8 @@ struct st21nfca_i2c_phy {struct mutex phy_lock; }; -static u8 len_seq[] = {16 ,24 ,12 ,29 }; -static u16 wait_tab[] = {2 ,3 ,5 ,15 ,20 ,40 }; +static const u8 len_seq[] = {16 ,24 ,12 ,29 }; +static const u16 wait_tab[] = {2 ,3 ,5 ,15 ,20 ,40 };#define I2C_DUMP_SKB (info, skb) \ do { \
Signature · 1 line
2.27.0
PATCH 7/12 nfc: constify pointer to nfc_vendor_cmd
In reply to Krzysztof KozlowskiNeither 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.
--- drivers/nfc/st-nci/vendor_cmds.c | 2 +- drivers/nfc/st21nfca/vendor_cmds.c | 2 +- include/net/nfc/hci.h | 2 +- include/net/nfc/nci_core.h | 2 +- include/net/nfc/nfc.h | 4 ++-- net/nfc/netlink.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-)
drivers/nfc/st-nci/vendor_cmds.c +1 -1
@@ -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 ,
drivers/nfc/st21nfca/vendor_cmds.c +1 -1
@@ -295,7 +295,7 @@ static int st21nfca_hci_loopback(struct nfc_dev *dev, void *data,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 ,
include/net/nfc/hci.h +1 -1
@@ -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);
include/net/nfc/nci_core.h +1 -1
@@ -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);
include/net/nfc/nfc.h +2 -2
@@ -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)
net/nfc/netlink.c +1 -1
@@ -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;
Signature · 1 line
2.27.0
PATCH 8/12 nfc: constify nfc_hci_gate
In reply to Krzysztof KozlowskiNeither the core nor the drivers modify the passed pointer to struct nfc_hci_gate, so make it a pointer to const for correctness and safety.
--- drivers/nfc/microread/microread.c | 2 +- drivers/nfc/pn544/pn544.c | 2 +- drivers/nfc/st21nfca/core.c | 2 +- net/nfc/hci/core.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/nfc/microread/microread.c +1 -1
@@ -131,7 +131,7 @@#define MICROREAD_ELT_ID_SE2 0x04#define MICROREAD_ELT_ID_SE3 0x05 -static struct nfc_hci_gate microread_gates[] = { +static const struct nfc_hci_gate microread_gates[] = { {MICROREAD_GATE_ID_ADM ,MICROREAD_PIPE_ID_ADMIN }, {MICROREAD_GATE_ID_LOOPBACK ,MICROREAD_PIPE_ID_HDS_LOOPBACK }, {MICROREAD_GATE_ID_IDT ,MICROREAD_PIPE_ID_HDS_IDT },
drivers/nfc/pn544/pn544.c +1 -1
@@ -86,7 +86,7 @@ enum pn544_state {#define PN544_HCI_CMD_ATTREQUEST 0x12#define PN544_HCI_CMD_CONTINUE_ACTIVATION 0x13 -static struct nfc_hci_gate pn544_gates[] = { +static const struct nfc_hci_gate pn544_gates[] = { {NFC_HCI_ADMIN_GATE ,NFC_HCI_INVALID_PIPE }, {NFC_HCI_LOOPBACK_GATE ,NFC_HCI_INVALID_PIPE }, {NFC_HCI_ID_MGMT_GATE ,NFC_HCI_INVALID_PIPE },
drivers/nfc/st21nfca/core.c +1 -1
@@ -72,7 +72,7 @@ static DECLARE_BITMAP(dev_mask, ST21NFCA_NUM_DEVICES); -static struct nfc_hci_gate st21nfca_gates[] = { +static const struct nfc_hci_gate st21nfca_gates[] = { {NFC_HCI_ADMIN_GATE ,NFC_HCI_ADMIN_PIPE }, {NFC_HCI_LINK_MGMT_GATE ,NFC_HCI_LINK_MGMT_PIPE }, {ST21NFCA_DEVICE_MGNT_GATE ,ST21NFCA_DEVICE_MGNT_PIPE },
net/nfc/hci/core.c +1 -1
@@ -447,7 +447,7 @@ static void nfc_hci_cmd_timeout(struct timer_list *t) }static int hci_dev_connect_gates (struct nfc_hci_dev *hdev,u8 gate_count, -struct nfc_hci_gate *gates) +const struct nfc_hci_gate *gates) {int r;while (gate_count--) {
Signature · 1 line
2.27.0
PATCH 9/12 nfc: constify nfc_ops
In reply to Krzysztof KozlowskiNeither the core nor the drivers modify the passed pointer to struct nfc_ops, so make it a pointer to const for correctness and safety.
--- drivers/nfc/pn533/pn533.c | 2 +- include/net/nfc/nfc.h | 4 ++-- net/nfc/core.c | 2 +- net/nfc/digital_core.c | 2 +- net/nfc/hci/core.c | 2 +- net/nfc/nci/core.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-)
drivers/nfc/pn533/pn533.c +1 -1
@@ -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,
include/net/nfc/nfc.h +2 -2
@@ -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);
net/nfc/core.c +1 -1
@@ -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) {
net/nfc/digital_core.c +1 -1
@@ -732,7 +732,7 @@ static int digital_in_send(struct nfc_dev *nfc_dev, struct nfc_target *target,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,
net/nfc/hci/core.c +1 -1
@@ -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,
net/nfc/nci/core.c +1 -1
@@ -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,
Signature · 1 line
2.27.0
PATCH 10/12 nfc: constify nfc_hci_ops
In reply to Krzysztof KozlowskiNeither 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.
--- drivers/nfc/microread/microread.c | 2 +- drivers/nfc/pn544/pn544.c | 2 +- drivers/nfc/st21nfca/core.c | 2 +- include/net/nfc/hci.h | 4 ++-- net/nfc/hci/core.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/nfc/microread/microread.c +1 -1
@@ -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,
drivers/nfc/pn544/pn544.c +1 -1
@@ -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,
drivers/nfc/st21nfca/core.c +1 -1
@@ -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,
include/net/nfc/hci.h +2 -2
@@ -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;
@@ -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,
net/nfc/hci/core.c +1 -1
@@ -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,
Signature · 1 line
2.27.0
PATCH 11/12 nfc: constify nfc_llc_ops
In reply to Krzysztof KozlowskiNeither 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.
--- Documentation/driver-api/nfc/nfc-hci.rst | 2 +- net/nfc/hci/llc.c | 2 +- net/nfc/hci/llc.h | 6 +++--- net/nfc/hci/llc_nop.c | 2 +- net/nfc/hci/llc_shdlc.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
Documentation/driver-api/nfc/nfc-hci.rst +1 -1
@@ -181,7 +181,7 @@ xmit_from_hci(): The llc must be registered with nfc before it can be used. Do that by calling:: - nfc_llc_register(const char *name, struct nfc_llc_ops *ops); + nfc_llc_register(const char *name, const struct nfc_llc_ops *ops); Again, note that the llc does not handle the physical link. It is thus very easy to mix any physical link with any llc for a given chip driver.
net/nfc/hci/llc.c +1 -1
@@ -41,7 +41,7 @@ void nfc_llc_exit(void) } } -int nfc_llc_register (const char *name,struct nfc_llc_ops *ops) +int nfc_llc_register (const char *name,const struct nfc_llc_ops *ops) {struct nfc_llc_engine *llc_engine;
net/nfc/hci/llc.h +3 -3
@@ -26,20 +26,20 @@ struct nfc_llc_ops {struct nfc_llc_engine {const char *name; -struct nfc_llc_ops *ops; +const struct nfc_llc_ops *ops;struct list_head entry; };struct nfc_llc {void *data; -struct nfc_llc_ops *ops; +const struct nfc_llc_ops *ops;int rx_headroom;int rx_tailroom; };void *nfc_llc_get_data (struct nfc_llc *llc); -int nfc_llc_register (const char *name,struct nfc_llc_ops *ops); +int nfc_llc_register (const char *name,const struct nfc_llc_ops *ops);void nfc_llc_unregister (const char *name);int nfc_llc_nop_register (void );
net/nfc/hci/llc_nop.c +1 -1
@@ -71,7 +71,7 @@ static int llc_nop_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb)return llc_nop->xmit_to_drv (llc_nop->hdev, skb); } -static struct nfc_llc_ops llc_nop_ops = { +static const struct nfc_llc_ops llc_nop_ops = { .init = llc_nop_init, .deinit = llc_nop_deinit, .start = llc_nop_start,
net/nfc/hci/llc_shdlc.c +1 -1
@@ -820,7 +820,7 @@ static int llc_shdlc_xmit_from_hci(struct nfc_llc *llc, struct sk_buff *skb)return 0 ; } -static struct nfc_llc_ops llc_shdlc_ops = { +static const struct nfc_llc_ops llc_shdlc_ops = { .init = llc_shdlc_init, .deinit = llc_shdlc_deinit, .start = llc_shdlc_start,
Signature · 1 line
2.27.0
PATCH 12/12 nfc: constify nfc_digital_ops
In reply to Krzysztof KozlowskiNeither the core nor the drivers modify the passed pointer to struct nfc_digital_ops, so make it a pointer to const for correctness and safety.
--- drivers/nfc/nfcsim.c | 2 +- drivers/nfc/port100.c | 2 +- drivers/nfc/st95hf/core.c | 2 +- drivers/nfc/trf7970a.c | 2 +- include/net/nfc/digital.h | 4 ++-- net/nfc/digital_core.c | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-)
drivers/nfc/nfcsim.c +1 -1
@@ -320,7 +320,7 @@ static int nfcsim_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,return nfcsim_send (ddev,NULL , timeout, cb, arg); } -static struct nfc_digital_ops nfcsim_digital_ops = { +static const struct nfc_digital_ops nfcsim_digital_ops = { .in_configure_hw = nfcsim_in_configure_hw, .in_send_cmd = nfcsim_in_send_cmd,
drivers/nfc/port100.c +1 -1
@@ -1463,7 +1463,7 @@ static int port100_listen(struct nfc_digital_dev *ddev, u16 timeout,return port100_tg_send_cmd (ddev, skb, timeout, cb, arg); } -static struct nfc_digital_ops port100_digital_ops = { +static const struct nfc_digital_ops port100_digital_ops = { .in_configure_hw = port100_in_configure_hw, .in_send_cmd = port100_in_send_cmd,
drivers/nfc/st95hf/core.c +1 -1
@@ -1037,7 +1037,7 @@ static void st95hf_abort_cmd(struct nfc_digital_dev *ddev) { } -static struct nfc_digital_ops st95hf_nfc_digital_ops = { +static const struct nfc_digital_ops st95hf_nfc_digital_ops = { .in_configure_hw = st95hf_in_configure_hw, .in_send_cmd = st95hf_in_send_cmd,
drivers/nfc/trf7970a.c +1 -1
@@ -1861,7 +1861,7 @@ static void trf7970a_abort_cmd(struct nfc_digital_dev *ddev)mutex_unlock (&trf->lock); } -static struct nfc_digital_ops trf7970a_nfc_ops = { +static const struct nfc_digital_ops trf7970a_nfc_ops = { .in_configure_hw = trf7970a_in_configure_hw, .in_send_cmd = trf7970a_send_cmd, .tg_configure_hw = trf7970a_tg_configure_hw,
include/net/nfc/digital.h +2 -2
@@ -191,7 +191,7 @@ struct digital_poll_tech {struct nfc_digital_dev {struct nfc_dev *nfc_dev; -struct nfc_digital_ops *ops; +const struct nfc_digital_ops *ops;u32 protocols;
@@ -236,7 +236,7 @@ struct nfc_digital_dev {void (*skb_add_crc)(struct sk_buff *skb); }; -struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops, +struct nfc_digital_dev *nfc_digital_allocate_device(const struct nfc_digital_ops *ops, __u32 supported_protocols, __u32 driver_capabilities, int tx_headroom,
net/nfc/digital_core.c +1 -1
@@ -745,7 +745,7 @@ static const struct nfc_ops digital_nfc_ops = { .im_transceive = digital_in_send, }; -struct nfc_digital_dev *nfc_digital_allocate_device (struct nfc_digital_ops *ops, +struct nfc_digital_dev *nfc_digital_allocate_device (const struct nfc_digital_ops *ops,__u32 supported_protocols,__u32 driver_capabilities,int tx_headroom,int tx_tailroom)
Signature · 1 line
2.27.0
This series was applied to netdev/net-next.git (refs/heads/master):
Hello:
This series was applied to netdev/net-next.git (refs/heads/master):
Quoted 10 lines · On Sat, 24 Jul 2021 23:47:31 +0200 you wrote:
Hi,
Constify pointers to several data structures which are not modified by NFC core or by drivers to make it slightly safer. No functional impact expected.
Best regards,
Krzysztof[...]
Here is the summary with links:
- [01/12] nfc: constify payload argument in nci_send_cmd()
https://git.kernel.org/netdev/net-next/c/48d5440393d3 - [02/12] nfc: constify nci_ops https://git.kernel.org/netdev/net-next/c/b9c28286d8f1 - [03/12] nfc: s3fwrn5: constify nci_ops https://git.kernel.org/netdev/net-next/c/d08ba0fdeaba - [04/12] nfc: constify nci_driver_ops (prop_ops and core_ops) https://git.kernel.org/netdev/net-next/c/cb8caa3c6c04 - [05/12] nfc: constify nfc_phy_ops https://git.kernel.org/netdev/net-next/c/7a5e98daf6bd - [06/12] nfc: st21nfca: constify file-scope arrays https://git.kernel.org/netdev/net-next/c/0f20ae9bb96b - [07/12] nfc: constify pointer to nfc_vendor_cmd https://git.kernel.org/netdev/net-next/c/15944ad2e5a1 - [08/12] nfc: constify nfc_hci_gate https://git.kernel.org/netdev/net-next/c/5f3e63933793 - [09/12] nfc: constify nfc_ops https://git.kernel.org/netdev/net-next/c/f6c802a726ae - [10/12] nfc: constify nfc_hci_ops https://git.kernel.org/netdev/net-next/c/094c45c84d79 - [11/12] nfc: constify nfc_llc_ops https://git.kernel.org/netdev/net-next/c/49545357bf7e - [12/12] nfc: constify nfc_digital_ops https://git.kernel.org/netdev/net-next/c/7186aac9c22d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html