2019-04-21 09:21:25

by Tomas Winkler

[permalink] [raw]
Subject: [PATCH 0/2] nfc: compilation cleanups

Two compilation cleanups.

Tomas Winkler (2):
nfc/pn544: fix inconsistent indenting
nfc/microread: use correct casting in microread_target_discovered()

drivers/nfc/microread/microread.c | 6 +++---
drivers/nfc/pn544/pn544.c | 7 ++++---
2 files changed, 7 insertions(+), 6 deletions(-)

--
2.20.1



2019-04-21 09:21:27

by Tomas Winkler

[permalink] [raw]
Subject: [PATCH 1/2] nfc/pn544: fix inconsistent indenting

Drop redunant space in indentation.

Signed-off-by: Tomas Winkler <[email protected]>
---
drivers/nfc/pn544/pn544.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/pn544/pn544.c b/drivers/nfc/pn544/pn544.c
index 70e898e38b16..2aaf521f367c 100644
--- a/drivers/nfc/pn544/pn544.c
+++ b/drivers/nfc/pn544/pn544.c
@@ -704,9 +704,10 @@ static int pn544_hci_check_presence(struct nfc_hci_dev *hdev,
target->nfcid1_len != 10)
return -EOPNOTSUPP;

- return nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE,
- PN544_RF_READER_CMD_ACTIVATE_NEXT,
- target->nfcid1, target->nfcid1_len, NULL);
+ return nfc_hci_send_cmd(hdev, NFC_HCI_RF_READER_A_GATE,
+ PN544_RF_READER_CMD_ACTIVATE_NEXT,
+ target->nfcid1, target->nfcid1_len,
+ NULL);
} else if (target->supported_protocols & (NFC_PROTO_JEWEL_MASK |
NFC_PROTO_FELICA_MASK)) {
return -EOPNOTSUPP;
--
2.20.1


2019-04-21 09:21:28

by Tomas Winkler

[permalink] [raw]
Subject: [PATCH 2/2] nfc/microread: use correct casting in microread_target_discovered()

Fix sparse warnings:

drivers/nfc/microread/microread.c:502:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:502:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:502:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:502:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:516:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:516:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:516:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:516:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:534:25: warning: cast to restricted __le16

Signed-off-by: Tomas Winkler <[email protected]>
---
drivers/nfc/microread/microread.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
index e5d5d2d97409..cc1fc8d2b04d 100644
--- a/drivers/nfc/microread/microread.c
+++ b/drivers/nfc/microread/microread.c
@@ -499,7 +499,7 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,
targets->supported_protocols =
nfc_hci_sak_to_protocol(skb->data[MICROREAD_EMCF_A_SAK]);
targets->sens_res =
- be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA]);
+ be16_to_cpup((__be16 *)&skb->data[MICROREAD_EMCF_A_ATQA]);
targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK];
targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN];
if (targets->nfcid1_len > sizeof(targets->nfcid1)) {
@@ -513,7 +513,7 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,
targets->supported_protocols =
nfc_hci_sak_to_protocol(skb->data[MICROREAD_EMCF_A3_SAK]);
targets->sens_res =
- be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]);
+ be16_to_cpup((__be16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]);
targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK];
targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN];
if (targets->nfcid1_len > sizeof(targets->nfcid1)) {
@@ -531,7 +531,7 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,
case MICROREAD_GATE_ID_MREAD_NFC_T1:
targets->supported_protocols = NFC_PROTO_JEWEL_MASK;
targets->sens_res =
- le16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_T1_ATQA]);
+ le16_to_cpup((__le16 *)&skb->data[MICROREAD_EMCF_T1_ATQA]);
memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_T1_UID], 4);
targets->nfcid1_len = 4;
break;
--
2.20.1