Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Christophe Ricard and committed by
Samuel Ortiz
fb92ff78 bb15b217

+10 -10
+8 -8
drivers/nfc/st21nfcb/i2c.c
··· 164 164 u8 buf[ST21NFCB_NCI_I2C_MAX_SIZE]; 165 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 168 if (r == -EREMOTEIO) { /* Retry, chip was in standby */ 169 169 usleep_range(1000, 4000); 170 - r = i2c_master_recv(client, buf, 4); 171 - } else if (r != 4) { 170 + r = i2c_master_recv(client, buf, ST21NFCB_NCI_I2C_MIN_SIZE); 171 + } else if (r != ST21NFCB_NCI_I2C_MIN_SIZE) { 172 172 nfc_err(&client->dev, "cannot read ndlc & nci header\n"); 173 173 return -EREMOTEIO; 174 174 } ··· 179 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 183 if (*skb == NULL) 184 184 return -ENOMEM; 185 185 186 - skb_reserve(*skb, 4); 187 - skb_put(*skb, 4); 188 - memcpy((*skb)->data, buf, 4); 186 + skb_reserve(*skb, ST21NFCB_NCI_I2C_MIN_SIZE); 187 + skb_put(*skb, ST21NFCB_NCI_I2C_MIN_SIZE); 188 + memcpy((*skb)->data, buf, ST21NFCB_NCI_I2C_MIN_SIZE); 189 189 190 190 if (!len) 191 191 return 0; ··· 197 197 } 198 198 199 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 202 I2C_DUMP_SKB("i2c frame read", *skb); 203 203
+2 -2
include/linux/platform_data/st21nfcb.h
··· 16 16 * along with this program; if not, see <http://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - #ifndef _ST21NFCA_HCI_H_ 20 - #define _ST21NFCA_HCI_H_ 19 + #ifndef _ST21NFCB_NCI_H_ 20 + #define _ST21NFCB_NCI_H_ 21 21 22 22 #include <linux/i2c.h> 23 23