Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256500
b: refs/heads/master
c: 81fc70d
h: refs/heads/master
v: v3
  • Loading branch information
Andy Shevchenko authored and David S. Miller committed Jul 18, 2011
1 parent 6c8bf04 commit 49120e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 61b8013a114cb041db2c56f747953cac69637f26
refs/heads/master: 81fc70d86527a1450560709500ca5f52e661da1f
26 changes: 5 additions & 21 deletions trunk/drivers/net/can/slcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/can.h>

static __initdata const char banner[] =
Expand Down Expand Up @@ -142,21 +143,6 @@ static struct net_device **slcan_devs;
* STANDARD SLCAN DECAPSULATION *
************************************************************************/

static int asc2nibble(char c)
{

if ((c >= '0') && (c <= '9'))
return c - '0';

if ((c >= 'A') && (c <= 'F'))
return c - 'A' + 10;

if ((c >= 'a') && (c <= 'f'))
return c - 'a' + 10;

return 16; /* error */
}

/* Send one completely decapsulated can_frame to the network layer */
static void slc_bump(struct slcan *sl)
{
Expand Down Expand Up @@ -195,18 +181,16 @@ static void slc_bump(struct slcan *sl)
*(u64 *) (&cf.data) = 0; /* clear payload */

for (i = 0, dlc_pos++; i < cf.can_dlc; i++) {

tmp = asc2nibble(sl->rbuff[dlc_pos++]);
if (tmp > 0x0F)
tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
if (tmp < 0)
return;
cf.data[i] = (tmp << 4);
tmp = asc2nibble(sl->rbuff[dlc_pos++]);
if (tmp > 0x0F)
tmp = hex_to_bin(sl->rbuff[dlc_pos++]);
if (tmp < 0)
return;
cf.data[i] |= tmp;
}


skb = dev_alloc_skb(sizeof(struct can_frame));
if (!skb)
return;
Expand Down

0 comments on commit 49120e5

Please sign in to comment.