X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/4cf24de229090b1ab6279570a564d224e13dd706..786c7d54e8d820e89997e507c29ea716c0d55fd9:/lincan/include/main.h diff --git a/lincan/include/main.h b/lincan/include/main.h index 53fb783..c811d87 100644 --- a/lincan/include/main.h +++ b/lincan/include/main.h @@ -21,9 +21,17 @@ #define CANMSG(fmt,args...) printk(KERN_ERR "can.o: " fmt,##args) +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,7)) + #define MINOR_NR \ (MINOR(file->f_dentry->d_inode->i_rdev)) +#else /* Linux kernel > 2.5.7 */ + +#define MINOR_NR \ + (minor(file->f_dentry->d_inode->i_rdev)) +#endif /* Linux kernel > 2.5.7 */ + #define MSG_OFFSET(object) ((object)*0x10) struct canhardware_t { @@ -159,7 +167,7 @@ struct mem_addr { * The rx/tx_in_progress entries are used to determine whether the device is * already set up for transmission. */ -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19)) +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0)) struct canfifo_t { struct wait_queue *readq, *writeq; struct canmsg_t *buf_tx_entry; @@ -170,7 +178,7 @@ struct canfifo_t { struct canmsg_t *rx_readp; int rx_size, tx_size; volatile int rx_in_progress, tx_in_progress; - int head, tail; //TEMP!!! + /*int head, tail;*/ /* removed */ }; #else struct canfifo_t { @@ -184,7 +192,7 @@ struct canfifo_t { struct canmsg_t *rx_readp; int rx_size, tx_size; volatile int rx_in_progress, tx_in_progress; - int head, tail; //TEMP!!! + /*int head, tail;*/ /* removed */ }; #endif @@ -192,7 +200,7 @@ struct canfifo_t { struct rtr_id { unsigned long id; struct canmsg_t *rtr_message; -#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,2,19)) +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,3,0)) struct wait_queue *rtr_wq; #else struct __wait_queue_head rtr_wq; @@ -218,7 +226,7 @@ extern struct mem_addr *mem_head; /* Inline function to write to the hardware registers. The argument address is * relative to the memory map of the chip and not the absolute memory address. */ -extern inline void can_write_reg(struct chip_t *chip, unsigned char data, unsigned short address) +extern inline void can_write_reg(const struct chip_t *chip, unsigned char data, unsigned short address) { unsigned short segment_number; unsigned long address_to_write; @@ -233,7 +241,7 @@ extern inline void can_write_reg(struct chip_t *chip, unsigned char data, unsign chip->hostdevice->hwspecops->write_register(data, address_to_write); } -extern inline unsigned can_read_reg(struct chip_t *chip, unsigned short address) +extern inline unsigned can_read_reg(const struct chip_t *chip, unsigned short address) { unsigned short segment_number; unsigned long address_to_read;