]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/proc.c
Merge branch 'master' into can-usb1
[lincan.git] / lincan / src / proc.c
index a73f71e425ada6d1bc1cf3e4e1344499ea581f5b..aaab02819eb40200ed61987b1cf3b4bf2087f368 100644 (file)
@@ -1,11 +1,36 @@
-/* proc.c
- * Linux CAN-bus device driver.
- * Written by Arnaud Westenberg email:arnaud@wanadoo.nl
- * Rewritten for new CAN queues by Pavel Pisa - OCERA team member
- * email:pisa@cmp.felk.cvut.cz
- * This software is released under the GPL-License.
- * Version lincan-0.3  17 Jun 2004
- */
+/**************************************************************************/
+/* File: proc.c - proc filesystem entries for CAN driver                  */
+/*                                                                        */
+/* LinCAN - (Not only) Linux CAN bus driver                               */
+/* Copyright (C) 2002-2009 DCE FEE CTU Prague <http://dce.felk.cvut.cz>   */
+/* Copyright (C) 2002-2009 Pavel Pisa <pisa@cmp.felk.cvut.cz>             */
+/* Funded by OCERA and FRESCOR IST projects                               */
+/* Based on CAN driver code by Arnaud Westenberg <arnaud@wanadoo.nl>      */
+/*                                                                        */
+/* LinCAN is free software; you can redistribute it and/or modify it      */
+/* under terms of the GNU General Public License as published by the      */
+/* Free Software Foundation; either version 2, or (at your option) any    */
+/* later version.  LinCAN is distributed in the hope that it will be      */
+/* useful, but WITHOUT ANY WARRANTY; without even the implied warranty    */
+/* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU    */
+/* General Public License for more details. You should have received a    */
+/* copy of the GNU General Public License along with LinCAN; see file     */
+/* COPYING. If not, write to the Free Software Foundation, 675 Mass Ave,  */
+/* Cambridge, MA 02139, USA.                                              */
+/*                                                                        */
+/* To allow use of LinCAN in the compact embedded systems firmware        */
+/* and RT-executives (RTEMS for example), main authors agree with next    */
+/* special exception:                                                     */
+/*                                                                        */
+/* Including LinCAN header files in a file, instantiating LinCAN generics */
+/* or templates, or linking other files with LinCAN objects to produce    */
+/* an application image/executable, does not by itself cause the          */
+/* resulting application image/executable to be covered by                */
+/* the GNU General Public License.                                        */
+/* This exception does not however invalidate any other reasons           */
+/* why the executable file might be covered by the GNU Public License.    */
+/* Publication of enhanced or derived LinCAN files is required although.  */
+/**************************************************************************/
 
 #include "../include/can.h"
 #include "../include/can_sysdep.h"
@@ -27,6 +52,12 @@ int remove_object_from_procdir(int chip_nr);
 static int can_proc_readlink(struct proc_dir_entry *ent, char *page);
 #endif
 
+#if  LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
+#define CAN_PROC_ROOT (&proc_root)
+#else /* >= 2.6.26 */
+#define CAN_PROC_ROOT (NULL)
+#endif /* >= 2.6.26 */
+
 static int cc=0; /* static counter for each CAN chip */
 
 static struct canproc_t can_proc_base;
@@ -156,7 +187,7 @@ int can_init_procdir(void)
        mutex_init(&proc_mutex);
 
        base->can_proc_entry = can_create_proc_entry("can", S_IFDIR | S_IRUGO |
-                                       S_IXUGO, &proc_root);
+                                       S_IXUGO, CAN_PROC_ROOT);
        if (base->can_proc_entry == NULL)
                return -ENODEV;
 
@@ -186,7 +217,7 @@ int can_delete_procdir(void)
        if (remove_channels_from_procdir())
                return -ENODEV;
        /* name: "can" */
-       if (can_remove_proc_entry(base->can_proc_entry, &proc_root))
+       if (can_remove_proc_entry(base->can_proc_entry, CAN_PROC_ROOT))
                return -ENODEV;
 
        return 0;
@@ -211,9 +242,10 @@ static int can_chip_procinfo(char *buf, char **start, off_t offset,
        len += sprintf(buf+len,"type    : %s\n",chip->chip_type);
        len += sprintf(buf+len,"index   : %d\n",chip->chip_idx);
        len += sprintf(buf+len,"irq     : %d\n",chip->chip_irq);
-       len += sprintf(buf+len,"addr    : %lu\n",chip->chip_base_addr);
+       len += sprintf(buf+len,"addr    : %lu\n",
+                       can_ioptr2ulong(chip->chip_base_addr));
        len += sprintf(buf+len,"config  : %s\n",
-                      (chip->flags & CHIP_CONFIGURED) ? "yes":"no");
+                       (chip->flags & CHIP_CONFIGURED) ? "yes":"no");
        len += sprintf(buf+len,"clock   : %ld Hz\n",chip->clock);
        len += sprintf(buf+len,"baud    : %ld\n",chip->baudrate);
        len += sprintf(buf+len,"num obj : %d\n",chip->max_objects);