Commit 658e6b16 authored by David S. Miller's avatar David S. Miller
Browse files

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: default avatarDavid S. Miller <davem@davemloft.net>
parents 8cb79af5 26955037
Loading
Loading
Loading
Loading
+14 −13
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ struct fdp_nci_info {
	u32 limited_otp_version;
	u8 key_index;

	u8 *fw_vsc_cfg;
	const u8 *fw_vsc_cfg;
	u8 clock_type;
	u32 clock_freq;

@@ -65,7 +65,7 @@ struct fdp_nci_info {
	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,
	NCI_PARAM_ID_FW_RAM_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,
					      char *data)
					      const char *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)
{
	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);
}
@@ -260,7 +260,7 @@ static int fdp_nci_request_firmware(struct nci_dev *ndev)
{
	struct fdp_nci_info *info = nci_get_drvdata(ndev);
	struct device *dev = &info->phy->i2c_dev->dev;
	u8 *data;
	const u8 *data;
	int r;

	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;
	}

	data = (u8 *) info->ram_patch->data;
	data = info->ram_patch->data;
	info->ram_patch_version =
		data[FDP_FW_HEADER_SIZE] |
		(data[FDP_FW_HEADER_SIZE + 1] << 8) |
		(data[FDP_FW_HEADER_SIZE + 2] << 16) |
		(data[FDP_FW_HEADER_SIZE + 3] << 24);

	dev_dbg(dev, "RAM patch version: %d, size: %d\n",
		  info->ram_patch_version, (int) info->ram_patch->size);
	dev_dbg(dev, "RAM patch version: %d, size: %zu\n",
		  info->ram_patch_version, info->ram_patch->size);


	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+3] << 24);

	dev_dbg(dev, "OTP patch version: %d, size: %d\n",
		 info->otp_patch_version, (int) info->otp_patch->size);
	dev_dbg(dev, "OTP patch version: %d, size: %zu\n",
		 info->otp_patch_version, info->otp_patch->size);
	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 device *dev = &info->phy->i2c_dev->dev;
	struct nci_core_get_config_rsp *rsp = (void *) skb->data;
	u8 i, *p;
	const struct nci_core_get_config_rsp *rsp = (void *) skb->data;
	unsigned int i;
	const u8 *p;

	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,
			struct nci_dev **ndevp, int tx_headroom,
			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 fdp_nci_info *info;
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ struct fdp_i2c_phy {

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);
		  u8 clock_type, u32 clock_freq, const u8 *fw_vsc_cfg);
void fdp_nci_remove(struct nci_dev *ndev);

#endif /* __LOCAL_FDP_H_ */
+3 −3
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@
	print_hex_dump(KERN_DEBUG, prefix": ", DUMP_PREFIX_OFFSET,	\
		       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 */
	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)
{
	struct fdp_i2c_phy *phy = phy_id;
	const struct fdp_i2c_phy *phy = phy_id;

	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)
{
	struct fdp_i2c_phy *phy = phy_id;
	const struct fdp_i2c_phy *phy = phy_id;

	fdp_nci_i2c_reset(phy);
}
+1 −1
Original line number Diff line number Diff line
@@ -202,7 +202,7 @@ static int mei_nfc_connect(struct nfc_mei_phy *phy)
	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;
	u8 *mei_buf;
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ static void microread_i2c_remove_len_crc(struct sk_buff *skb)
	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;
	u8 crc = 0;
Loading