* Version lincan-0.2 9 Jul 2003
*/
-#define __NO_VERSION__
-#include <linux/module.h>
-
-#include <linux/autoconf.h>
-
-#include <linux/version.h>
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0))
-#include <linux/malloc.h>
-#else
-#include <linux/slab.h>
-#endif
-#include <linux/version.h>
-#include <asm/uaccess.h>
-#include <asm/irq.h>
-
+#include "../include/can.h"
+#include "../include/can_sysdep.h"
#include "../include/main.h"
#include "../include/read.h"
#include "../include/ioctl.h"
inline ssize_t can_rtr_read(struct chip_t *chip, struct msgobj_t *obj,
char *buffer)
{
- unsigned long flags;
+ can_spin_irqflags_t flags;
struct rtr_id *rtr_current, *new_rtr_entry;
struct canmsg_t read_msg;
DEBUGMSG("Remote transmission request\n");
- spin_lock_irqsave(&hardware_p->rtr_lock, flags);
+ can_spin_lock_irqsave(&hardware_p->rtr_lock, flags);
if (hardware_p->rtr_queue == NULL) { //No remote messages pending
new_rtr_entry=(struct rtr_id *)kmalloc(sizeof(struct rtr_id),GFP_ATOMIC);
if (new_rtr_entry == NULL) {
- spin_unlock_irqrestore(&hardware_p->rtr_lock,
+ can_spin_unlock_irqrestore(&hardware_p->rtr_lock,
flags);
return -ENOMEM;
}
new_rtr_entry->rtr_message = &read_msg;
new_rtr_entry->next=NULL;
- spin_unlock_irqrestore(&hardware_p->rtr_lock, flags);
+ can_spin_unlock_irqrestore(&hardware_p->rtr_lock, flags);
/* Send remote transmission request */
chip->chipspecops->remote_request(chip,obj);
obj->ret = 0;
interruptible_sleep_on(&new_rtr_entry->rtr_wq);
- spin_lock_irqsave(&hardware_p->rtr_lock, flags);
+ can_spin_lock_irqsave(&hardware_p->rtr_lock, flags);
copy_to_user(buffer, &read_msg, sizeof(struct canmsg_t));
if (hardware_p->rtr_queue == new_rtr_entry) {
if (new_rtr_entry->next != NULL)
else
rtr_current->next=NULL;
}
- spin_unlock_irqrestore(&hardware_p->rtr_lock, flags);
+ can_spin_unlock_irqrestore(&hardware_p->rtr_lock, flags);
kfree(new_rtr_entry);
return obj->ret;
int ret=0;
if(!canuser || (canuser->magic != CAN_USER_MAGIC)){
- CANMSG("can_close: bad canuser magic\n");
+ CANMSG("can_read: bad canuser magic\n");
return -ENODEV;
}
DEBUGMSG("this will always return zero.\n");
return 0;
}
- if (length > 8 * sizeof(struct canmsg_t)) {
- DEBUGMSG("Reading more than 8 CAN messages, this is not supported.\n");
- DEBUGMSG("Defaulting to 8 messages.\n");
- length = 8 * sizeof(struct canmsg_t);
- }
/* Initialize hardware pointers */
obj = canuser->msgobj;
if (obj == NULL) {