Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 186506
b: refs/heads/master
c: cb13887
h: refs/heads/master
v: v3
  • Loading branch information
Thiago Farina authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent 0cc0260 commit 1127d9b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 29 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: bb0bfc2a6b3bc0a680b45690e8e427515cf229a7
refs/heads/master: cb13887657ec7130ff3e4ea7f78cda2e8a943b30
53 changes: 25 additions & 28 deletions trunk/drivers/staging/otus/apdbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,27 @@ struct zdap_ioctl {

#endif

char hex(char);
unsigned char asctohex(char *str);
static char hex(char v)
{
if (isdigit(v))
return v - '0';
else if (isxdigit(v))
return tolower(v) - 'a' + 10;
else
return 0;
}

static unsigned char asctohex(char *str)
{
unsigned char value;

value = hex(*str) & 0x0f;
value = value << 4;
str++;
value |= hex(*str) & 0x0f;

return value;
}

char *prgname;

Expand All @@ -109,10 +128,10 @@ int set_ioctl(int sock, struct ifreq *req)

int read_reg(int sock, struct ifreq *req)
{
struct zdap_ioctl *zdreq = 0;
struct zdap_ioctl *zdreq = NULL;

if (!set_ioctl(sock, req))
return -1;
return -1;

/*
* zdreq = (struct zdap_ioctl *)req->ifr_data;
Expand All @@ -125,7 +144,7 @@ int read_reg(int sock, struct ifreq *req)

int read_mem(int sock, struct ifreq *req)
{
struct zdap_ioctl *zdreq = 0;
struct zdap_ioctl *zdreq = NULL;
int i;

if (!set_ioctl(sock, req))
Expand Down Expand Up @@ -368,7 +387,7 @@ int main(int argc, char **argv)

zdreq.addr = addr;
zdreq.cmd = ZM_IOCTL_SET_PIBSS_MODE;
} else {
} else {
fprintf(stderr, "error action\n");
exit(1);
}
Expand All @@ -380,25 +399,3 @@ int main(int argc, char **argv)
exit(0);
}

unsigned char asctohex(char *str)
{
unsigned char value;

value = hex(*str) & 0x0f;
value = value << 4;
str++;
value |= hex(*str) & 0x0f;

return value;
}

char hex(char v)
{
if (isdigit(v))
return v - '0';
else if (isxdigit(v))
return tolower(v) - 'a' + 10;
else
return 0;
}

0 comments on commit 1127d9b

Please sign in to comment.