i2c.c (d58ff35122847a83ba55394e2ae3a1527b6febf5) i2c.c (634fef61076d644b989b86abc2f560d81a089a31)
1/*
2 * I2C Link Layer for PN544 HCI based Driver
3 *
4 * Copyright (C) 2012 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.

--- 273 unchanged lines hidden (view full) ---

282 u16 crc;
283 int len;
284
285 len = skb->len + 2;
286 *(u8 *)skb_push(skb, 1) = len;
287
288 crc = crc_ccitt(0xffff, skb->data, skb->len);
289 crc = ~crc;
1/*
2 * I2C Link Layer for PN544 HCI based Driver
3 *
4 * Copyright (C) 2012 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.

--- 273 unchanged lines hidden (view full) ---

282 u16 crc;
283 int len;
284
285 len = skb->len + 2;
286 *(u8 *)skb_push(skb, 1) = len;
287
288 crc = crc_ccitt(0xffff, skb->data, skb->len);
289 crc = ~crc;
290 *(u8 *)skb_put(skb, 1) = crc & 0xff;
291 *(u8 *)skb_put(skb, 1) = crc >> 8;
290 skb_put_u8(skb, crc & 0xff);
291 skb_put_u8(skb, crc >> 8);
292}
293
294static void pn544_hci_i2c_remove_len_crc(struct sk_buff *skb)
295{
296 skb_pull(skb, PN544_I2C_FRAME_HEADROOM);
297 skb_trim(skb, PN544_I2C_FRAME_TAILROOM);
298}
299

--- 86 unchanged lines hidden (view full) ---

386 }
387
388 *skb = alloc_skb(1 + len, GFP_KERNEL);
389 if (*skb == NULL) {
390 r = -ENOMEM;
391 goto flush;
392 }
393
292}
293
294static void pn544_hci_i2c_remove_len_crc(struct sk_buff *skb)
295{
296 skb_pull(skb, PN544_I2C_FRAME_HEADROOM);
297 skb_trim(skb, PN544_I2C_FRAME_TAILROOM);
298}
299

--- 86 unchanged lines hidden (view full) ---

386 }
387
388 *skb = alloc_skb(1 + len, GFP_KERNEL);
389 if (*skb == NULL) {
390 r = -ENOMEM;
391 goto flush;
392 }
393
394 *(u8 *)skb_put(*skb, 1) = len;
394 skb_put_u8(*skb, len);
395
396 r = i2c_master_recv(client, skb_put(*skb, len), len);
397 if (r != len) {
398 kfree_skb(*skb);
399 return -EREMOTEIO;
400 }
401
402 I2C_DUMP_SKB("i2c frame read", *skb);

--- 583 unchanged lines hidden ---
395
396 r = i2c_master_recv(client, skb_put(*skb, len), len);
397 if (r != len) {
398 kfree_skb(*skb);
399 return -EREMOTEIO;
400 }
401
402 I2C_DUMP_SKB("i2c frame read", *skb);

--- 583 unchanged lines hidden ---