diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2014-05-25 16:46:58 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2014-07-22 18:49:37 -0400 |
commit | fb92ff78f85b6c1a6f1277f7dd04a3762ba725ef (patch) | |
tree | ad7bf74be08739ac750aa831c269e473fb21b3a7 /drivers/nfc | |
parent | bb15b2170c80b96ea78c0f8c8a6e0ed75fa91c10 (diff) |
NFC: st21nfcb: few code clean up
Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r-- | drivers/nfc/st21nfcb/i2c.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/nfc/st21nfcb/i2c.c b/drivers/nfc/st21nfcb/i2c.c index 0f690baaef7a..8af880ead5db 100644 --- a/drivers/nfc/st21nfcb/i2c.c +++ b/drivers/nfc/st21nfcb/i2c.c | |||
@@ -164,11 +164,11 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy, | |||
164 | u8 buf[ST21NFCB_NCI_I2C_MAX_SIZE]; | 164 | u8 buf[ST21NFCB_NCI_I2C_MAX_SIZE]; |
165 | struct i2c_client *client = phy->i2c_dev; | 165 | struct i2c_client *client = phy->i2c_dev; |
166 | 166 | ||
167 | r = i2c_master_recv(client, buf, 4); | 167 | r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE); |
168 | if (r == -EREMOTEIO) { /* Retry, chip was in standby */ | 168 | if (r == -EREMOTEIO) { /* Retry, chip was in standby */ |
169 | usleep_range(1000, 4000); | 169 | usleep_range(1000, 4000); |
170 | r = i2c_master_recv(client, buf, 4); | 170 | r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE); |
171 | } else if (r != 4) { | 171 | } else if (r != ST21NFCB_NCI_I2C_MIN_SIZE) { |
172 | nfc_err(&client->dev, "cannot read ndlc & nci header\n"); | 172 | nfc_err(&client->dev, "cannot read ndlc & nci header\n"); |
173 | return -EREMOTEIO; | 173 | return -EREMOTEIO; |
174 | } | 174 | } |
@@ -179,13 +179,13 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy, | |||
179 | return -EBADMSG; | 179 | return -EBADMSG; |
180 | } | 180 | } |
181 | 181 | ||
182 | *skb = alloc_skb(4 + len, GFP_KERNEL); | 182 | *skb = alloc_skb(ST21NFCB_NCI_I2C_MIN_SIZE + len, GFP_KERNEL); |
183 | if (*skb == NULL) | 183 | if (*skb == NULL) |
184 | return -ENOMEM; | 184 | return -ENOMEM; |
185 | 185 | ||
186 | skb_reserve(*skb, 4); | 186 | skb_reserve(*skb, ST21NFCB_NCI_I2C_MIN_SIZE); |
187 | skb_put(*skb, 4); | 187 | skb_put(*skb, ST21NFCB_NCI_I2C_MIN_SIZE); |
188 | memcpy((*skb)->data, buf, 4); | 188 | memcpy((*skb)->data, buf, ST21NFCB_NCI_I2C_MIN_SIZE); |
189 | 189 | ||
190 | if (!len) | 190 | if (!len) |
191 | return 0; | 191 | return 0; |
@@ -197,7 +197,7 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy, | |||
197 | } | 197 | } |
198 | 198 | ||
199 | skb_put(*skb, len); | 199 | skb_put(*skb, len); |
200 | memcpy((*skb)->data + 4, buf, len); | 200 | memcpy((*skb)->data + ST21NFCB_NCI_I2C_MIN_SIZE, buf, len); |
201 | 201 | ||
202 | I2C_DUMP_SKB("i2c frame read", *skb); | 202 | I2C_DUMP_SKB("i2c frame read", *skb); |
203 | 203 | ||