mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 06:52:07 +00:00
Merge branch 'nfc-const'
Krzysztof Kozlowski says: ==================== nfc: constify, continued (part 2) On top of: nfc: constify pointed data https://lore.kernel.org/lkml/20210726145224.146006-1-krzysztof.kozlowski@canonical.com/ ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
658e6b1612
19 changed files with 78 additions and 71 deletions
|
@ -52,7 +52,7 @@ struct fdp_nci_info {
|
||||||
u32 limited_otp_version;
|
u32 limited_otp_version;
|
||||||
u8 key_index;
|
u8 key_index;
|
||||||
|
|
||||||
u8 *fw_vsc_cfg;
|
const u8 *fw_vsc_cfg;
|
||||||
u8 clock_type;
|
u8 clock_type;
|
||||||
u32 clock_freq;
|
u32 clock_freq;
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ struct fdp_nci_info {
|
||||||
wait_queue_head_t setup_wq;
|
wait_queue_head_t setup_wq;
|
||||||
};
|
};
|
||||||
|
|
||||||
static u8 nci_core_get_config_otp_ram_version[5] = {
|
static const u8 nci_core_get_config_otp_ram_version[5] = {
|
||||||
0x04,
|
0x04,
|
||||||
NCI_PARAM_ID_FW_RAM_VERSION,
|
NCI_PARAM_ID_FW_RAM_VERSION,
|
||||||
NCI_PARAM_ID_FW_OTP_VERSION,
|
NCI_PARAM_ID_FW_OTP_VERSION,
|
||||||
|
@ -111,7 +111,7 @@ static inline int fdp_nci_patch_cmd(struct nci_dev *ndev, u8 type)
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int fdp_nci_set_production_data(struct nci_dev *ndev, u8 len,
|
static inline int fdp_nci_set_production_data(struct nci_dev *ndev, u8 len,
|
||||||
char *data)
|
const char *data)
|
||||||
{
|
{
|
||||||
return nci_prop_cmd(ndev, NCI_OP_PROP_SET_PDATA_OID, len, data);
|
return nci_prop_cmd(ndev, NCI_OP_PROP_SET_PDATA_OID, len, data);
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ static int fdp_nci_send_patch(struct nci_dev *ndev, u8 conn_id, u8 type)
|
||||||
|
|
||||||
static int fdp_nci_open(struct nci_dev *ndev)
|
static int fdp_nci_open(struct nci_dev *ndev)
|
||||||
{
|
{
|
||||||
struct fdp_nci_info *info = nci_get_drvdata(ndev);
|
const struct fdp_nci_info *info = nci_get_drvdata(ndev);
|
||||||
|
|
||||||
return info->phy_ops->enable(info->phy);
|
return info->phy_ops->enable(info->phy);
|
||||||
}
|
}
|
||||||
|
@ -260,7 +260,7 @@ static int fdp_nci_request_firmware(struct nci_dev *ndev)
|
||||||
{
|
{
|
||||||
struct fdp_nci_info *info = nci_get_drvdata(ndev);
|
struct fdp_nci_info *info = nci_get_drvdata(ndev);
|
||||||
struct device *dev = &info->phy->i2c_dev->dev;
|
struct device *dev = &info->phy->i2c_dev->dev;
|
||||||
u8 *data;
|
const u8 *data;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
r = request_firmware(&info->ram_patch, FDP_RAM_PATCH_NAME, dev);
|
r = request_firmware(&info->ram_patch, FDP_RAM_PATCH_NAME, dev);
|
||||||
|
@ -269,15 +269,15 @@ static int fdp_nci_request_firmware(struct nci_dev *ndev)
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = (u8 *) info->ram_patch->data;
|
data = info->ram_patch->data;
|
||||||
info->ram_patch_version =
|
info->ram_patch_version =
|
||||||
data[FDP_FW_HEADER_SIZE] |
|
data[FDP_FW_HEADER_SIZE] |
|
||||||
(data[FDP_FW_HEADER_SIZE + 1] << 8) |
|
(data[FDP_FW_HEADER_SIZE + 1] << 8) |
|
||||||
(data[FDP_FW_HEADER_SIZE + 2] << 16) |
|
(data[FDP_FW_HEADER_SIZE + 2] << 16) |
|
||||||
(data[FDP_FW_HEADER_SIZE + 3] << 24);
|
(data[FDP_FW_HEADER_SIZE + 3] << 24);
|
||||||
|
|
||||||
dev_dbg(dev, "RAM patch version: %d, size: %d\n",
|
dev_dbg(dev, "RAM patch version: %d, size: %zu\n",
|
||||||
info->ram_patch_version, (int) info->ram_patch->size);
|
info->ram_patch_version, info->ram_patch->size);
|
||||||
|
|
||||||
|
|
||||||
r = request_firmware(&info->otp_patch, FDP_OTP_PATCH_NAME, dev);
|
r = request_firmware(&info->otp_patch, FDP_OTP_PATCH_NAME, dev);
|
||||||
|
@ -293,8 +293,8 @@ static int fdp_nci_request_firmware(struct nci_dev *ndev)
|
||||||
(data[FDP_FW_HEADER_SIZE+2] << 16) |
|
(data[FDP_FW_HEADER_SIZE+2] << 16) |
|
||||||
(data[FDP_FW_HEADER_SIZE+3] << 24);
|
(data[FDP_FW_HEADER_SIZE+3] << 24);
|
||||||
|
|
||||||
dev_dbg(dev, "OTP patch version: %d, size: %d\n",
|
dev_dbg(dev, "OTP patch version: %d, size: %zu\n",
|
||||||
info->otp_patch_version, (int) info->otp_patch->size);
|
info->otp_patch_version, info->otp_patch->size);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,8 +610,9 @@ static int fdp_nci_core_get_config_rsp_packet(struct nci_dev *ndev,
|
||||||
{
|
{
|
||||||
struct fdp_nci_info *info = nci_get_drvdata(ndev);
|
struct fdp_nci_info *info = nci_get_drvdata(ndev);
|
||||||
struct device *dev = &info->phy->i2c_dev->dev;
|
struct device *dev = &info->phy->i2c_dev->dev;
|
||||||
struct nci_core_get_config_rsp *rsp = (void *) skb->data;
|
const struct nci_core_get_config_rsp *rsp = (void *) skb->data;
|
||||||
u8 i, *p;
|
unsigned int i;
|
||||||
|
const u8 *p;
|
||||||
|
|
||||||
if (rsp->status == NCI_STATUS_OK) {
|
if (rsp->status == NCI_STATUS_OK) {
|
||||||
|
|
||||||
|
@ -690,7 +691,7 @@ static const struct nci_ops nci_ops = {
|
||||||
int fdp_nci_probe(struct fdp_i2c_phy *phy, const 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,
|
struct nci_dev **ndevp, int tx_headroom,
|
||||||
int tx_tailroom, u8 clock_type, u32 clock_freq,
|
int tx_tailroom, u8 clock_type, u32 clock_freq,
|
||||||
u8 *fw_vsc_cfg)
|
const u8 *fw_vsc_cfg)
|
||||||
{
|
{
|
||||||
struct device *dev = &phy->i2c_dev->dev;
|
struct device *dev = &phy->i2c_dev->dev;
|
||||||
struct fdp_nci_info *info;
|
struct fdp_nci_info *info;
|
||||||
|
|
|
@ -23,7 +23,7 @@ struct fdp_i2c_phy {
|
||||||
|
|
||||||
int fdp_nci_probe(struct fdp_i2c_phy *phy, const 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,
|
struct nci_dev **ndev, int tx_headroom, int tx_tailroom,
|
||||||
u8 clock_type, u32 clock_freq, u8 *fw_vsc_cfg);
|
u8 clock_type, u32 clock_freq, const u8 *fw_vsc_cfg);
|
||||||
void fdp_nci_remove(struct nci_dev *ndev);
|
void fdp_nci_remove(struct nci_dev *ndev);
|
||||||
|
|
||||||
#endif /* __LOCAL_FDP_H_ */
|
#endif /* __LOCAL_FDP_H_ */
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
print_hex_dump(KERN_DEBUG, prefix": ", DUMP_PREFIX_OFFSET, \
|
print_hex_dump(KERN_DEBUG, prefix": ", DUMP_PREFIX_OFFSET, \
|
||||||
16, 1, (skb)->data, (skb)->len, 0)
|
16, 1, (skb)->data, (skb)->len, 0)
|
||||||
|
|
||||||
static void fdp_nci_i2c_reset(struct fdp_i2c_phy *phy)
|
static void fdp_nci_i2c_reset(const struct fdp_i2c_phy *phy)
|
||||||
{
|
{
|
||||||
/* Reset RST/WakeUP for at least 100 micro-second */
|
/* Reset RST/WakeUP for at least 100 micro-second */
|
||||||
gpiod_set_value_cansleep(phy->power_gpio, FDP_POWER_OFF);
|
gpiod_set_value_cansleep(phy->power_gpio, FDP_POWER_OFF);
|
||||||
|
@ -47,7 +47,7 @@ static void fdp_nci_i2c_reset(struct fdp_i2c_phy *phy)
|
||||||
|
|
||||||
static int fdp_nci_i2c_enable(void *phy_id)
|
static int fdp_nci_i2c_enable(void *phy_id)
|
||||||
{
|
{
|
||||||
struct fdp_i2c_phy *phy = phy_id;
|
const struct fdp_i2c_phy *phy = phy_id;
|
||||||
|
|
||||||
fdp_nci_i2c_reset(phy);
|
fdp_nci_i2c_reset(phy);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ static int fdp_nci_i2c_enable(void *phy_id)
|
||||||
|
|
||||||
static void fdp_nci_i2c_disable(void *phy_id)
|
static void fdp_nci_i2c_disable(void *phy_id)
|
||||||
{
|
{
|
||||||
struct fdp_i2c_phy *phy = phy_id;
|
const struct fdp_i2c_phy *phy = phy_id;
|
||||||
|
|
||||||
fdp_nci_i2c_reset(phy);
|
fdp_nci_i2c_reset(phy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ err:
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mei_nfc_send(struct nfc_mei_phy *phy, u8 *buf, size_t length)
|
static int mei_nfc_send(struct nfc_mei_phy *phy, const u8 *buf, size_t length)
|
||||||
{
|
{
|
||||||
struct mei_nfc_hdr *hdr;
|
struct mei_nfc_hdr *hdr;
|
||||||
u8 *mei_buf;
|
u8 *mei_buf;
|
||||||
|
|
|
@ -73,7 +73,7 @@ static void microread_i2c_remove_len_crc(struct sk_buff *skb)
|
||||||
skb_trim(skb, MICROREAD_I2C_FRAME_TAILROOM);
|
skb_trim(skb, MICROREAD_I2C_FRAME_TAILROOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_crc(struct sk_buff *skb)
|
static int check_crc(const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
u8 crc = 0;
|
u8 crc = 0;
|
||||||
|
|
|
@ -358,7 +358,7 @@ static int microread_complete_target_discovered(struct nfc_hci_dev *hdev,
|
||||||
static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
|
static void microread_im_transceive_cb(void *context, struct sk_buff *skb,
|
||||||
int err)
|
int err)
|
||||||
{
|
{
|
||||||
struct microread_info *info = context;
|
const struct microread_info *info = context;
|
||||||
|
|
||||||
switch (info->async_cb_type) {
|
switch (info->async_cb_type) {
|
||||||
case MICROREAD_CB_TYPE_READER_ALL:
|
case MICROREAD_CB_TYPE_READER_ALL:
|
||||||
|
@ -642,7 +642,7 @@ static const struct nfc_hci_ops microread_hci_ops = {
|
||||||
};
|
};
|
||||||
|
|
||||||
int microread_probe(void *phy_id, const struct nfc_phy_ops *phy_ops,
|
int microread_probe(void *phy_id, const struct nfc_phy_ops *phy_ops,
|
||||||
char *llc_name, int phy_headroom, int phy_tailroom,
|
const char *llc_name, int phy_headroom, int phy_tailroom,
|
||||||
int phy_payload, struct nfc_hci_dev **hdev)
|
int phy_payload, struct nfc_hci_dev **hdev)
|
||||||
{
|
{
|
||||||
struct microread_info *info;
|
struct microread_info *info;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#define DRIVER_DESC "NFC driver for microread"
|
#define DRIVER_DESC "NFC driver for microread"
|
||||||
|
|
||||||
int microread_probe(void *phy_id, const struct nfc_phy_ops *phy_ops,
|
int microread_probe(void *phy_id, const struct nfc_phy_ops *phy_ops,
|
||||||
char *llc_name, int phy_headroom, int phy_tailroom,
|
const char *llc_name, int phy_headroom, int phy_tailroom,
|
||||||
int phy_payload, struct nfc_hci_dev **hdev);
|
int phy_payload, struct nfc_hci_dev **hdev);
|
||||||
|
|
||||||
void microread_remove(struct nfc_hci_dev *hdev);
|
void microread_remove(struct nfc_hci_dev *hdev);
|
||||||
|
|
|
@ -129,7 +129,7 @@ static void fw_dnld_timeout(struct timer_list *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_state_reset(struct nfcmrvl_private *priv,
|
static int process_state_reset(struct nfcmrvl_private *priv,
|
||||||
struct sk_buff *skb)
|
const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (sizeof(nci_pattern_core_reset_ntf) != skb->len ||
|
if (sizeof(nci_pattern_core_reset_ntf) != skb->len ||
|
||||||
memcmp(skb->data, nci_pattern_core_reset_ntf,
|
memcmp(skb->data, nci_pattern_core_reset_ntf,
|
||||||
|
@ -145,7 +145,8 @@ static int process_state_reset(struct nfcmrvl_private *priv,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_state_init(struct nfcmrvl_private *priv, struct sk_buff *skb)
|
static int process_state_init(struct nfcmrvl_private *priv,
|
||||||
|
const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct nci_core_set_config_cmd cmd;
|
struct nci_core_set_config_cmd cmd;
|
||||||
|
|
||||||
|
@ -175,7 +176,7 @@ static void create_lc(struct nfcmrvl_private *priv)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_state_set_ref_clock(struct nfcmrvl_private *priv,
|
static int process_state_set_ref_clock(struct nfcmrvl_private *priv,
|
||||||
struct sk_buff *skb)
|
const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
struct nci_core_set_config_cmd cmd;
|
struct nci_core_set_config_cmd cmd;
|
||||||
|
|
||||||
|
@ -221,7 +222,7 @@ static int process_state_set_ref_clock(struct nfcmrvl_private *priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_state_set_hi_config(struct nfcmrvl_private *priv,
|
static int process_state_set_hi_config(struct nfcmrvl_private *priv,
|
||||||
struct sk_buff *skb)
|
const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (sizeof(nci_pattern_core_set_config_rsp) != skb->len ||
|
if (sizeof(nci_pattern_core_set_config_rsp) != skb->len ||
|
||||||
memcmp(skb->data, nci_pattern_core_set_config_rsp, skb->len))
|
memcmp(skb->data, nci_pattern_core_set_config_rsp, skb->len))
|
||||||
|
@ -232,7 +233,7 @@ static int process_state_set_hi_config(struct nfcmrvl_private *priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_state_open_lc(struct nfcmrvl_private *priv,
|
static int process_state_open_lc(struct nfcmrvl_private *priv,
|
||||||
struct sk_buff *skb)
|
const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (sizeof(nci_pattern_core_conn_create_rsp) >= skb->len ||
|
if (sizeof(nci_pattern_core_conn_create_rsp) >= skb->len ||
|
||||||
memcmp(skb->data, nci_pattern_core_conn_create_rsp,
|
memcmp(skb->data, nci_pattern_core_conn_create_rsp,
|
||||||
|
@ -347,7 +348,7 @@ static int process_state_fw_dnld(struct nfcmrvl_private *priv,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_state_close_lc(struct nfcmrvl_private *priv,
|
static int process_state_close_lc(struct nfcmrvl_private *priv,
|
||||||
struct sk_buff *skb)
|
const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (sizeof(nci_pattern_core_conn_close_rsp) != skb->len ||
|
if (sizeof(nci_pattern_core_conn_close_rsp) != skb->len ||
|
||||||
memcmp(skb->data, nci_pattern_core_conn_close_rsp, skb->len))
|
memcmp(skb->data, nci_pattern_core_conn_close_rsp, skb->len))
|
||||||
|
@ -358,7 +359,8 @@ static int process_state_close_lc(struct nfcmrvl_private *priv,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_state_boot(struct nfcmrvl_private *priv, struct sk_buff *skb)
|
static int process_state_boot(struct nfcmrvl_private *priv,
|
||||||
|
const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
if (sizeof(nci_pattern_proprietary_boot_rsp) != skb->len ||
|
if (sizeof(nci_pattern_proprietary_boot_rsp) != skb->len ||
|
||||||
memcmp(skb->data, nci_pattern_proprietary_boot_rsp, skb->len))
|
memcmp(skb->data, nci_pattern_proprietary_boot_rsp, skb->len))
|
||||||
|
|
|
@ -146,7 +146,7 @@ static void nfcmrvl_i2c_nci_update_config(struct nfcmrvl_private *priv,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfcmrvl_if_ops i2c_ops = {
|
static const struct nfcmrvl_if_ops i2c_ops = {
|
||||||
.nci_open = nfcmrvl_i2c_nci_open,
|
.nci_open = nfcmrvl_i2c_nci_open,
|
||||||
.nci_close = nfcmrvl_i2c_nci_close,
|
.nci_close = nfcmrvl_i2c_nci_close,
|
||||||
.nci_send = nfcmrvl_i2c_nci_send,
|
.nci_send = nfcmrvl_i2c_nci_send,
|
||||||
|
@ -182,8 +182,8 @@ static int nfcmrvl_i2c_parse_dt(struct device_node *node,
|
||||||
static int nfcmrvl_i2c_probe(struct i2c_client *client,
|
static int nfcmrvl_i2c_probe(struct i2c_client *client,
|
||||||
const struct i2c_device_id *id)
|
const struct i2c_device_id *id)
|
||||||
{
|
{
|
||||||
|
const struct nfcmrvl_platform_data *pdata;
|
||||||
struct nfcmrvl_i2c_drv_data *drv_data;
|
struct nfcmrvl_i2c_drv_data *drv_data;
|
||||||
struct nfcmrvl_platform_data *pdata;
|
|
||||||
struct nfcmrvl_platform_data config;
|
struct nfcmrvl_platform_data config;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
|
@ -91,9 +91,9 @@ static const struct nci_ops nfcmrvl_nci_ops = {
|
||||||
|
|
||||||
struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
|
struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
|
||||||
void *drv_data,
|
void *drv_data,
|
||||||
struct nfcmrvl_if_ops *ops,
|
const struct nfcmrvl_if_ops *ops,
|
||||||
struct device *dev,
|
struct device *dev,
|
||||||
struct nfcmrvl_platform_data *pdata)
|
const struct nfcmrvl_platform_data *pdata)
|
||||||
{
|
{
|
||||||
struct nfcmrvl_private *priv;
|
struct nfcmrvl_private *priv;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
|
@ -77,7 +77,7 @@ struct nfcmrvl_private {
|
||||||
/* PHY type */
|
/* PHY type */
|
||||||
enum nfcmrvl_phy phy;
|
enum nfcmrvl_phy phy;
|
||||||
/* Low level driver ops */
|
/* Low level driver ops */
|
||||||
struct nfcmrvl_if_ops *if_ops;
|
const struct nfcmrvl_if_ops *if_ops;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct nfcmrvl_if_ops {
|
struct nfcmrvl_if_ops {
|
||||||
|
@ -92,9 +92,9 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv);
|
||||||
int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb);
|
int nfcmrvl_nci_recv_frame(struct nfcmrvl_private *priv, struct sk_buff *skb);
|
||||||
struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
|
struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
|
||||||
void *drv_data,
|
void *drv_data,
|
||||||
struct nfcmrvl_if_ops *ops,
|
const struct nfcmrvl_if_ops *ops,
|
||||||
struct device *dev,
|
struct device *dev,
|
||||||
struct nfcmrvl_platform_data *pdata);
|
const struct nfcmrvl_platform_data *pdata);
|
||||||
|
|
||||||
|
|
||||||
void nfcmrvl_chip_reset(struct nfcmrvl_private *priv);
|
void nfcmrvl_chip_reset(struct nfcmrvl_private *priv);
|
||||||
|
|
|
@ -99,14 +99,14 @@ static void nfcmrvl_spi_nci_update_config(struct nfcmrvl_private *priv,
|
||||||
drv_data->nci_spi->xfer_speed_hz = config->clk;
|
drv_data->nci_spi->xfer_speed_hz = config->clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfcmrvl_if_ops spi_ops = {
|
static const struct nfcmrvl_if_ops spi_ops = {
|
||||||
.nci_open = nfcmrvl_spi_nci_open,
|
.nci_open = nfcmrvl_spi_nci_open,
|
||||||
.nci_close = nfcmrvl_spi_nci_close,
|
.nci_close = nfcmrvl_spi_nci_close,
|
||||||
.nci_send = nfcmrvl_spi_nci_send,
|
.nci_send = nfcmrvl_spi_nci_send,
|
||||||
.nci_update_config = nfcmrvl_spi_nci_update_config,
|
.nci_update_config = nfcmrvl_spi_nci_update_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int nfcmrvl_spi_parse_dt(struct device_node *node,
|
static int nfcmrvl_spi_parse_dt(const struct device_node *node,
|
||||||
struct nfcmrvl_platform_data *pdata)
|
struct nfcmrvl_platform_data *pdata)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -129,7 +129,7 @@ static int nfcmrvl_spi_parse_dt(struct device_node *node,
|
||||||
|
|
||||||
static int nfcmrvl_spi_probe(struct spi_device *spi)
|
static int nfcmrvl_spi_probe(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
struct nfcmrvl_platform_data *pdata;
|
const struct nfcmrvl_platform_data *pdata;
|
||||||
struct nfcmrvl_platform_data config;
|
struct nfcmrvl_platform_data config;
|
||||||
struct nfcmrvl_spi_drv_data *drv_data;
|
struct nfcmrvl_spi_drv_data *drv_data;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
|
@ -49,7 +49,7 @@ static void nfcmrvl_uart_nci_update_config(struct nfcmrvl_private *priv,
|
||||||
config->flow_control);
|
config->flow_control);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfcmrvl_if_ops uart_ops = {
|
static const struct nfcmrvl_if_ops uart_ops = {
|
||||||
.nci_open = nfcmrvl_uart_nci_open,
|
.nci_open = nfcmrvl_uart_nci_open,
|
||||||
.nci_close = nfcmrvl_uart_nci_close,
|
.nci_close = nfcmrvl_uart_nci_close,
|
||||||
.nci_send = nfcmrvl_uart_nci_send,
|
.nci_send = nfcmrvl_uart_nci_send,
|
||||||
|
@ -98,8 +98,8 @@ static int nfcmrvl_uart_parse_dt(struct device_node *node,
|
||||||
static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
|
static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
|
||||||
{
|
{
|
||||||
struct nfcmrvl_private *priv;
|
struct nfcmrvl_private *priv;
|
||||||
struct nfcmrvl_platform_data *pdata = NULL;
|
|
||||||
struct nfcmrvl_platform_data config;
|
struct nfcmrvl_platform_data config;
|
||||||
|
const struct nfcmrvl_platform_data *pdata = NULL;
|
||||||
struct device *dev = nu->tty->dev;
|
struct device *dev = nu->tty->dev;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -264,7 +264,7 @@ done:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct nfcmrvl_if_ops usb_ops = {
|
static const struct nfcmrvl_if_ops usb_ops = {
|
||||||
.nci_open = nfcmrvl_usb_nci_open,
|
.nci_open = nfcmrvl_usb_nci_open,
|
||||||
.nci_close = nfcmrvl_usb_nci_close,
|
.nci_close = nfcmrvl_usb_nci_close,
|
||||||
.nci_send = nfcmrvl_usb_nci_send,
|
.nci_send = nfcmrvl_usb_nci_send,
|
||||||
|
|
|
@ -240,7 +240,7 @@ static int nfcsim_send(struct nfc_digital_dev *ddev, struct sk_buff *skb,
|
||||||
|
|
||||||
static void nfcsim_abort_cmd(struct nfc_digital_dev *ddev)
|
static void nfcsim_abort_cmd(struct nfc_digital_dev *ddev)
|
||||||
{
|
{
|
||||||
struct nfcsim *dev = nfc_digital_get_drvdata(ddev);
|
const struct nfcsim *dev = nfc_digital_get_drvdata(ddev);
|
||||||
|
|
||||||
nfcsim_link_recv_cancel(dev->link_in);
|
nfcsim_link_recv_cancel(dev->link_in);
|
||||||
}
|
}
|
||||||
|
|
|
@ -526,7 +526,7 @@ static inline u8 port100_checksum(u16 value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The rule: sum(data elements) + checksum = 0 */
|
/* The rule: sum(data elements) + checksum = 0 */
|
||||||
static u8 port100_data_checksum(u8 *data, int datalen)
|
static u8 port100_data_checksum(const u8 *data, int datalen)
|
||||||
{
|
{
|
||||||
u8 sum = 0;
|
u8 sum = 0;
|
||||||
int i;
|
int i;
|
||||||
|
@ -568,10 +568,10 @@ static void port100_tx_update_payload_len(void *_frame, int len)
|
||||||
le16_add_cpu(&frame->datalen, len);
|
le16_add_cpu(&frame->datalen, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool port100_rx_frame_is_valid(void *_frame)
|
static bool port100_rx_frame_is_valid(const void *_frame)
|
||||||
{
|
{
|
||||||
u8 checksum;
|
u8 checksum;
|
||||||
struct port100_frame *frame = _frame;
|
const struct port100_frame *frame = _frame;
|
||||||
|
|
||||||
if (frame->start_frame != cpu_to_be16(PORT100_FRAME_SOF) ||
|
if (frame->start_frame != cpu_to_be16(PORT100_FRAME_SOF) ||
|
||||||
frame->extended_frame != cpu_to_be16(PORT100_FRAME_EXT))
|
frame->extended_frame != cpu_to_be16(PORT100_FRAME_EXT))
|
||||||
|
@ -589,23 +589,24 @@ static bool port100_rx_frame_is_valid(void *_frame)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool port100_rx_frame_is_ack(struct port100_ack_frame *frame)
|
static bool port100_rx_frame_is_ack(const struct port100_ack_frame *frame)
|
||||||
{
|
{
|
||||||
return (frame->start_frame == cpu_to_be16(PORT100_FRAME_SOF) &&
|
return (frame->start_frame == cpu_to_be16(PORT100_FRAME_SOF) &&
|
||||||
frame->ack_frame == cpu_to_be16(PORT100_FRAME_ACK));
|
frame->ack_frame == cpu_to_be16(PORT100_FRAME_ACK));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int port100_rx_frame_size(void *frame)
|
static inline int port100_rx_frame_size(const void *frame)
|
||||||
{
|
{
|
||||||
struct port100_frame *f = frame;
|
const struct port100_frame *f = frame;
|
||||||
|
|
||||||
return sizeof(struct port100_frame) + le16_to_cpu(f->datalen) +
|
return sizeof(struct port100_frame) + le16_to_cpu(f->datalen) +
|
||||||
PORT100_FRAME_TAIL_LEN;
|
PORT100_FRAME_TAIL_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool port100_rx_frame_is_cmd_response(struct port100 *dev, void *frame)
|
static bool port100_rx_frame_is_cmd_response(const struct port100 *dev,
|
||||||
|
const void *frame)
|
||||||
{
|
{
|
||||||
struct port100_frame *f = frame;
|
const struct port100_frame *f = frame;
|
||||||
|
|
||||||
return (PORT100_FRAME_CMD(f) == PORT100_CMD_RESPONSE(dev->cmd->code));
|
return (PORT100_FRAME_CMD(f) == PORT100_CMD_RESPONSE(dev->cmd->code));
|
||||||
}
|
}
|
||||||
|
@ -655,7 +656,8 @@ sched_wq:
|
||||||
schedule_work(&dev->cmd_complete_work);
|
schedule_work(&dev->cmd_complete_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int port100_submit_urb_for_response(struct port100 *dev, gfp_t flags)
|
static int port100_submit_urb_for_response(const struct port100 *dev,
|
||||||
|
gfp_t flags)
|
||||||
{
|
{
|
||||||
dev->in_urb->complete = port100_recv_response;
|
dev->in_urb->complete = port100_recv_response;
|
||||||
|
|
||||||
|
@ -666,7 +668,7 @@ static void port100_recv_ack(struct urb *urb)
|
||||||
{
|
{
|
||||||
struct port100 *dev = urb->context;
|
struct port100 *dev = urb->context;
|
||||||
struct port100_cmd *cmd = dev->cmd;
|
struct port100_cmd *cmd = dev->cmd;
|
||||||
struct port100_ack_frame *in_frame;
|
const struct port100_ack_frame *in_frame;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
cmd->status = urb->status;
|
cmd->status = urb->status;
|
||||||
|
@ -708,7 +710,7 @@ sched_wq:
|
||||||
schedule_work(&dev->cmd_complete_work);
|
schedule_work(&dev->cmd_complete_work);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int port100_submit_urb_for_ack(struct port100 *dev, gfp_t flags)
|
static int port100_submit_urb_for_ack(const struct port100 *dev, gfp_t flags)
|
||||||
{
|
{
|
||||||
dev->in_urb->complete = port100_recv_ack;
|
dev->in_urb->complete = port100_recv_ack;
|
||||||
|
|
||||||
|
@ -753,8 +755,9 @@ static int port100_send_ack(struct port100 *dev)
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int port100_send_frame_async(struct port100 *dev, struct sk_buff *out,
|
static int port100_send_frame_async(struct port100 *dev,
|
||||||
struct sk_buff *in, int in_len)
|
const struct sk_buff *out,
|
||||||
|
const struct sk_buff *in, int in_len)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
@ -960,7 +963,7 @@ static void port100_abort_cmd(struct nfc_digital_dev *ddev)
|
||||||
usb_kill_urb(dev->in_urb);
|
usb_kill_urb(dev->in_urb);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sk_buff *port100_alloc_skb(struct port100 *dev, unsigned int size)
|
static struct sk_buff *port100_alloc_skb(const struct port100 *dev, unsigned int size)
|
||||||
{
|
{
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
|
|
||||||
|
@ -1152,7 +1155,7 @@ static int port100_in_configure_hw(struct nfc_digital_dev *ddev, int type,
|
||||||
static void port100_in_comm_rf_complete(struct port100 *dev, void *arg,
|
static void port100_in_comm_rf_complete(struct port100 *dev, void *arg,
|
||||||
struct sk_buff *resp)
|
struct sk_buff *resp)
|
||||||
{
|
{
|
||||||
struct port100_cb_arg *cb_arg = arg;
|
const struct port100_cb_arg *cb_arg = arg;
|
||||||
nfc_digital_cmd_complete_t cb = cb_arg->complete_cb;
|
nfc_digital_cmd_complete_t cb = cb_arg->complete_cb;
|
||||||
u32 status;
|
u32 status;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -1330,7 +1333,7 @@ static void port100_tg_comm_rf_complete(struct port100 *dev, void *arg,
|
||||||
struct sk_buff *resp)
|
struct sk_buff *resp)
|
||||||
{
|
{
|
||||||
u32 status;
|
u32 status;
|
||||||
struct port100_cb_arg *cb_arg = arg;
|
const struct port100_cb_arg *cb_arg = arg;
|
||||||
nfc_digital_cmd_complete_t cb = cb_arg->complete_cb;
|
nfc_digital_cmd_complete_t cb = cb_arg->complete_cb;
|
||||||
struct port100_tg_comm_rf_res *hdr;
|
struct port100_tg_comm_rf_res *hdr;
|
||||||
|
|
||||||
|
@ -1453,7 +1456,7 @@ static int port100_listen_mdaa(struct nfc_digital_dev *ddev,
|
||||||
static int port100_listen(struct nfc_digital_dev *ddev, u16 timeout,
|
static int port100_listen(struct nfc_digital_dev *ddev, u16 timeout,
|
||||||
nfc_digital_cmd_complete_t cb, void *arg)
|
nfc_digital_cmd_complete_t cb, void *arg)
|
||||||
{
|
{
|
||||||
struct port100 *dev = nfc_digital_get_drvdata(ddev);
|
const struct port100 *dev = nfc_digital_get_drvdata(ddev);
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
|
|
||||||
skb = port100_alloc_skb(dev, 0);
|
skb = port100_alloc_skb(dev, 0);
|
||||||
|
|
|
@ -643,7 +643,7 @@ static void trf7970a_send_err_upstream(struct trf7970a *trf, int errno)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
|
static int trf7970a_transmit(struct trf7970a *trf, struct sk_buff *skb,
|
||||||
unsigned int len, u8 *prefix,
|
unsigned int len, const u8 *prefix,
|
||||||
unsigned int prefix_len)
|
unsigned int prefix_len)
|
||||||
{
|
{
|
||||||
struct spi_transfer t[2];
|
struct spi_transfer t[2];
|
||||||
|
@ -1387,9 +1387,10 @@ static int trf7970a_is_iso15693_write_or_lock(u8 cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int trf7970a_per_cmd_config(struct trf7970a *trf, struct sk_buff *skb)
|
static int trf7970a_per_cmd_config(struct trf7970a *trf,
|
||||||
|
const struct sk_buff *skb)
|
||||||
{
|
{
|
||||||
u8 *req = skb->data;
|
const u8 *req = skb->data;
|
||||||
u8 special_fcn_reg1, iso_ctrl;
|
u8 special_fcn_reg1, iso_ctrl;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -1791,7 +1792,7 @@ out_err:
|
||||||
static int trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
|
static int trf7970a_tg_listen(struct nfc_digital_dev *ddev, u16 timeout,
|
||||||
nfc_digital_cmd_complete_t cb, void *arg)
|
nfc_digital_cmd_complete_t cb, void *arg)
|
||||||
{
|
{
|
||||||
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
|
const struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
|
||||||
|
|
||||||
dev_dbg(trf->dev, "Listen - state: %d, timeout: %d ms\n",
|
dev_dbg(trf->dev, "Listen - state: %d, timeout: %d ms\n",
|
||||||
trf->state, timeout);
|
trf->state, timeout);
|
||||||
|
@ -1803,7 +1804,7 @@ static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev,
|
||||||
u16 timeout, nfc_digital_cmd_complete_t cb,
|
u16 timeout, nfc_digital_cmd_complete_t cb,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
|
const struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
dev_dbg(trf->dev, "Listen MD - state: %d, timeout: %d ms\n",
|
dev_dbg(trf->dev, "Listen MD - state: %d, timeout: %d ms\n",
|
||||||
|
@ -1824,7 +1825,7 @@ static int trf7970a_tg_listen_md(struct nfc_digital_dev *ddev,
|
||||||
|
|
||||||
static int trf7970a_tg_get_rf_tech(struct nfc_digital_dev *ddev, u8 *rf_tech)
|
static int trf7970a_tg_get_rf_tech(struct nfc_digital_dev *ddev, u8 *rf_tech)
|
||||||
{
|
{
|
||||||
struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
|
const struct trf7970a *trf = nfc_digital_get_drvdata(ddev);
|
||||||
|
|
||||||
dev_dbg(trf->dev, "Get RF Tech - state: %d, rf_tech: %d\n",
|
dev_dbg(trf->dev, "Get RF Tech - state: %d, rf_tech: %d\n",
|
||||||
trf->state, trf->md_rf_tech);
|
trf->state, trf->md_rf_tech);
|
||||||
|
@ -1974,7 +1975,7 @@ static void trf7970a_shutdown(struct trf7970a *trf)
|
||||||
trf7970a_power_down(trf);
|
trf7970a_power_down(trf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int trf7970a_get_autosuspend_delay(struct device_node *np)
|
static int trf7970a_get_autosuspend_delay(const struct device_node *np)
|
||||||
{
|
{
|
||||||
int autosuspend_delay, ret;
|
int autosuspend_delay, ret;
|
||||||
|
|
||||||
|
@ -1987,7 +1988,7 @@ static int trf7970a_get_autosuspend_delay(struct device_node *np)
|
||||||
|
|
||||||
static int trf7970a_probe(struct spi_device *spi)
|
static int trf7970a_probe(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
struct device_node *np = spi->dev.of_node;
|
const struct device_node *np = spi->dev.of_node;
|
||||||
struct trf7970a *trf;
|
struct trf7970a *trf;
|
||||||
int uvolts, autosuspend_delay, ret;
|
int uvolts, autosuspend_delay, ret;
|
||||||
u32 clk_freq = TRF7970A_13MHZ_CLOCK_FREQUENCY;
|
u32 clk_freq = TRF7970A_13MHZ_CLOCK_FREQUENCY;
|
||||||
|
|
|
@ -170,7 +170,7 @@ static int virtual_ncidev_close(struct inode *inode, struct file *file)
|
||||||
static long virtual_ncidev_ioctl(struct file *flip, unsigned int cmd,
|
static long virtual_ncidev_ioctl(struct file *flip, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
struct nfc_dev *nfc_dev = ndev->nfc_dev;
|
const struct nfc_dev *nfc_dev = ndev->nfc_dev;
|
||||||
void __user *p = (void __user *)arg;
|
void __user *p = (void __user *)arg;
|
||||||
|
|
||||||
if (cmd != IOCTL_GET_NCIDEV_IDX)
|
if (cmd != IOCTL_GET_NCIDEV_IDX)
|
||||||
|
|
|
@ -245,7 +245,7 @@ static inline void nfc_set_drvdata(struct nfc_dev *dev, void *data)
|
||||||
*
|
*
|
||||||
* @dev: The nfc device
|
* @dev: The nfc device
|
||||||
*/
|
*/
|
||||||
static inline void *nfc_get_drvdata(struct nfc_dev *dev)
|
static inline void *nfc_get_drvdata(const struct nfc_dev *dev)
|
||||||
{
|
{
|
||||||
return dev_get_drvdata(&dev->dev);
|
return dev_get_drvdata(&dev->dev);
|
||||||
}
|
}
|
||||||
|
@ -255,7 +255,7 @@ static inline void *nfc_get_drvdata(struct nfc_dev *dev)
|
||||||
*
|
*
|
||||||
* @dev: The nfc device whose name to return
|
* @dev: The nfc device whose name to return
|
||||||
*/
|
*/
|
||||||
static inline const char *nfc_device_name(struct nfc_dev *dev)
|
static inline const char *nfc_device_name(const struct nfc_dev *dev)
|
||||||
{
|
{
|
||||||
return dev_name(&dev->dev);
|
return dev_name(&dev->dev);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue