summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2014-05-25 22:46:58 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2014-07-23 00:49:37 +0200
commitfb92ff78f85b6c1a6f1277f7dd04a3762ba725ef (patch)
treead7bf74be08739ac750aa831c269e473fb21b3a7
parentbb15b2170c80b96ea78c0f8c8a6e0ed75fa91c10 (diff)
downloadblackbird-op-linux-fb92ff78f85b6c1a6f1277f7dd04a3762ba725ef.tar.gz
blackbird-op-linux-fb92ff78f85b6c1a6f1277f7dd04a3762ba725ef.zip
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>
-rw-r--r--drivers/nfc/st21nfcb/i2c.c16
-rw-r--r--include/linux/platform_data/st21nfcb.h4
2 files changed, 10 insertions, 10 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,
u8 buf[ST21NFCB_NCI_I2C_MAX_SIZE];
struct i2c_client *client = phy->i2c_dev;
- r = i2c_master_recv(client, buf, 4);
+ r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE);
if (r == -EREMOTEIO) { /* Retry, chip was in standby */
usleep_range(1000, 4000);
- r = i2c_master_recv(client, buf, 4);
- } else if (r != 4) {
+ r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE);
+ } else if (r != ST21NFCB_NCI_I2C_MIN_SIZE) {
nfc_err(&client->dev, "cannot read ndlc & nci header\n");
return -EREMOTEIO;
}
@@ -179,13 +179,13 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy,
return -EBADMSG;
}
- *skb = alloc_skb(4 + len, GFP_KERNEL);
+ *skb = alloc_skb(ST21NFCB_NCI_I2C_MIN_SIZE + len, GFP_KERNEL);
if (*skb == NULL)
return -ENOMEM;
- skb_reserve(*skb, 4);
- skb_put(*skb, 4);
- memcpy((*skb)->data, buf, 4);
+ skb_reserve(*skb, ST21NFCB_NCI_I2C_MIN_SIZE);
+ skb_put(*skb, ST21NFCB_NCI_I2C_MIN_SIZE);
+ memcpy((*skb)->data, buf, ST21NFCB_NCI_I2C_MIN_SIZE);
if (!len)
return 0;
@@ -197,7 +197,7 @@ static int st21nfcb_nci_i2c_read(struct st21nfcb_i2c_phy *phy,
}
skb_put(*skb, len);
- memcpy((*skb)->data + 4, buf, len);
+ memcpy((*skb)->data + ST21NFCB_NCI_I2C_MIN_SIZE, buf, len);
I2C_DUMP_SKB("i2c frame read", *skb);
diff --git a/include/linux/platform_data/st21nfcb.h b/include/linux/platform_data/st21nfcb.h
index 2a7b769c714d..2d11f1f5efab 100644
--- a/include/linux/platform_data/st21nfcb.h
+++ b/include/linux/platform_data/st21nfcb.h
@@ -16,8 +16,8 @@
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef _ST21NFCA_HCI_H_
-#define _ST21NFCA_HCI_H_
+#ifndef _ST21NFCB_NCI_H_
+#define _ST21NFCB_NCI_H_
#include <linux/i2c.h>
OpenPOWER on IntegriCloud