cleanup and fix warnings
This commit is contained in:
parent
63ccd87112
commit
5555a3d56d
5 changed files with 9 additions and 13 deletions
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void arch_enter(void *sp)
|
||||
{
|
||||
|
@ -20,13 +19,13 @@ void arch_enter(void *sp)
|
|||
int sc_ret;
|
||||
|
||||
if (sc_num > NSYSCALLS) {
|
||||
arch_syscall_set_rval(regs, -EINVAL);
|
||||
arch_syscall_set_rval(regs, -ENOSYS);
|
||||
return;
|
||||
}
|
||||
|
||||
handler = sys_table[sc_num];
|
||||
if (handler == NULL) {
|
||||
arch_syscall_set_rval(regs, -EINVAL);
|
||||
arch_syscall_set_rval(regs, -ENOSYS);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ struct arch_serial_interface arch_serial_default_interface = {
|
|||
.tx_current = NULL,
|
||||
.tx_next = NULL,
|
||||
.interface = {
|
||||
.tx = NULL,
|
||||
.rx = NULL,
|
||||
.id = 0,
|
||||
.baud = 0,
|
||||
|
@ -31,8 +30,6 @@ struct serial_interface *serial_default_interface = &arch_serial_default_interfa
|
|||
|
||||
int arch_serial_init(struct serial_interface *interface)
|
||||
{
|
||||
struct arch_serial_interface *arch_iface = to_arch_serial_interface(interface);
|
||||
|
||||
if (interface->baud <= 0 || interface->id != 0)
|
||||
return -1;
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ struct reg_snapshot {
|
|||
#define arch_syscall_arg5(reg_snap) ((reg_snap)->sw.r4)
|
||||
#define arch_syscall_arg6(reg_snap) ((reg_snap)->sw.r5)
|
||||
|
||||
#define arch_syscall_set_rval(reg_snap, val) ((reg_snap)->hw.r0 = (val));
|
||||
#define arch_syscall_set_rval(reg_snap, val) ((reg_snap)->hw.r0 = (word_t)(val));
|
||||
|
||||
/*
|
||||
* Real-time Timer (RTT)
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
#include <stddef.h>
|
||||
#include <toolchain.h>
|
||||
|
||||
int sys_write(int fd, __user const void *buf, size_t len, size_t off)
|
||||
ssize_t sys_write(int fd, __user const void *buf, size_t len, size_t off)
|
||||
{
|
||||
int ret;
|
||||
ssize_t ret;
|
||||
void *copy;
|
||||
|
||||
if (fd != 1) /* we only support stdout (serial console) right now ... */
|
||||
|
@ -23,10 +23,10 @@ int sys_write(int fd, __user const void *buf, size_t len, size_t off)
|
|||
copy = malloc(len);
|
||||
if (copy == NULL)
|
||||
return -ENOMEM;
|
||||
ret = (int)copy_from_user(copy, buf, len);
|
||||
ret = (ssize_t)copy_from_user(copy, buf, (size_t)len);
|
||||
|
||||
/* TODO: reschedule if blocking */
|
||||
ret = serial_write(serial_default_interface, copy, ret);
|
||||
ret = serial_write(serial_default_interface, copy, (size_t)ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -50,13 +50,13 @@ ssize_t serial_read(void *dest, struct serial_interface *interface, size_t len)
|
|||
|
||||
ssize_t serial_write(struct serial_interface *interface, const void *data, size_t len)
|
||||
{
|
||||
size_t ret;
|
||||
ssize_t ret;
|
||||
|
||||
atomic_enter();
|
||||
ret = arch_serial_write(interface, data, len);
|
||||
atomic_leave();
|
||||
|
||||
return (ssize_t)ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue