#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 {
* 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;
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 {
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
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;
/* 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;
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;