Release 4.7 drivers/isdn/hardware/eicon/divamnt.c
/* $Id: divamnt.c,v 1.32.6.10 2005/02/11 19:40:25 armin Exp $
*
* Driver for Eicon DIVA Server ISDN cards.
* Maint module
*
* Copyright 2000-2003 by Armin Schindler (mac@melware.de)
* Copyright 2000-2003 Cytronics & Melware (info@melware.de)
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/poll.h>
#include <linux/mutex.h>
#include <asm/uaccess.h>
#include "platform.h"
#include "di_defs.h"
#include "divasync.h"
#include "debug_if.h"
static DEFINE_MUTEX(maint_mutex);
static char *main_revision = "$Revision: 1.32.6.10 $";
static int major;
MODULE_DESCRIPTION("Maint driver for Eicon DIVA Server cards");
MODULE_AUTHOR("Cytronics & Melware, Eicon Networks");
MODULE_SUPPORTED_DEVICE("DIVA card driver");
MODULE_LICENSE("GPL");
static int buffer_length = 128;
module_param(buffer_length, int, 0);
static unsigned long diva_dbg_mem = 0;
module_param(diva_dbg_mem, ulong, 0);
static char *DRIVERNAME =
"Eicon DIVA - MAINT module (http://www.melware.net)";
static char *DRIVERLNAME = "diva_mnt";
static char *DEVNAME = "DivasMAINT";
char *DRIVERRELEASE_MNT = "2.0";
static wait_queue_head_t msgwaitq;
static unsigned long opened;
extern int mntfunc_init(int *, void **, unsigned long);
extern void mntfunc_finit(void);
extern int maint_read_write(void __user *buf, int count);
/*
* helper functions
*/
static char *getrev(const char *revision)
{
char *rev;
char *p;
if ((p = strchr(revision, ':'))) {
rev = p + 2;
p = strchr(rev, '$');
*--p = 0;
} else
rev = "1.0";
return rev;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 64 | 100.00% | 1 | 100.00% |
| Total | 64 | 100.00% | 1 | 100.00% |
/*
* kernel/user space copy functions
*/
int diva_os_copy_to_user(void *os_handle, void __user *dst, const void *src,
int length)
{
return (copy_to_user(dst, src, length));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 33 | 97.06% | 1 | 50.00% |
al viro | al viro | 1 | 2.94% | 1 | 50.00% |
| Total | 34 | 100.00% | 2 | 100.00% |
int diva_os_copy_from_user(void *os_handle, void *dst, const void __user *src,
int length)
{
return (copy_from_user(dst, src, length));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 33 | 97.06% | 1 | 50.00% |
al viro | al viro | 1 | 2.94% | 1 | 50.00% |
| Total | 34 | 100.00% | 2 | 100.00% |
/*
* get time
*/
void diva_os_get_time(dword *sec, dword *usec)
{
struct timespec64 time;
ktime_get_ts64(&time);
*sec = (dword) time.tv_sec;
*usec = (dword) (time.tv_nsec / NSEC_PER_USEC);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 36 | 76.60% | 2 | 66.67% |
alison schofield | alison schofield | 11 | 23.40% | 1 | 33.33% |
| Total | 47 | 100.00% | 3 | 100.00% |
/*
* device node operations
*/
static unsigned int maint_poll(struct file *file, poll_table *wait)
{
unsigned int mask = 0;
poll_wait(file, &msgwaitq, wait);
mask = POLLOUT | POLLWRNORM;
if (file->private_data || diva_dbg_q_length()) {
mask |= POLLIN | POLLRDNORM;
}
return (mask);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 60 | 100.00% | 1 | 100.00% |
| Total | 60 | 100.00% | 1 | 100.00% |
static int maint_open(struct inode *ino, struct file *filep)
{
int ret;
mutex_lock(&maint_mutex);
/* only one open is allowed, so we test
it atomically */
if (test_and_set_bit(0, &opened))
ret = -EBUSY;
else {
filep->private_data = NULL;
ret = nonseekable_open(ino, filep);
}
mutex_unlock(&maint_mutex);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 35 | 51.47% | 2 | 33.33% |
jonathan corbet | jonathan corbet | 16 | 23.53% | 1 | 16.67% |
arnd bergmann | arnd bergmann | 10 | 14.71% | 1 | 16.67% |
linus torvalds | linus torvalds | 6 | 8.82% | 1 | 16.67% |
al viro | al viro | 1 | 1.47% | 1 | 16.67% |
| Total | 68 | 100.00% | 6 | 100.00% |
static int maint_close(struct inode *ino, struct file *filep)
{
if (filep->private_data) {
diva_os_free(0, filep->private_data);
filep->private_data = NULL;
}
/* clear 'used' flag */
clear_bit(0, &opened);
return (0);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 51 | 96.23% | 2 | 50.00% |
kai germaschewski | kai germaschewski | 1 | 1.89% | 1 | 25.00% |
al viro | al viro | 1 | 1.89% | 1 | 25.00% |
| Total | 53 | 100.00% | 4 | 100.00% |
static ssize_t divas_maint_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
return (maint_read_write((char __user *) buf, (int) count));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 35 | 83.33% | 1 | 33.33% |
andrew morton | andrew morton | 5 | 11.90% | 1 | 33.33% |
al viro | al viro | 2 | 4.76% | 1 | 33.33% |
| Total | 42 | 100.00% | 3 | 100.00% |
static ssize_t divas_maint_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
return (maint_read_write(buf, (int) count));
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 30 | 83.33% | 1 | 33.33% |
andrew morton | andrew morton | 5 | 13.89% | 1 | 33.33% |
al viro | al viro | 1 | 2.78% | 1 | 33.33% |
| Total | 36 | 100.00% | 3 | 100.00% |
static const struct file_operations divas_maint_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
.read = divas_maint_read,
.write = divas_maint_write,
.poll = maint_poll,
.open = maint_open,
.release = maint_close
};
static void divas_maint_unregister_chrdev(void)
{
unregister_chrdev(major, DEVNAME);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 15 | 100.00% | 2 | 100.00% |
| Total | 15 | 100.00% | 2 | 100.00% |
static int __init divas_maint_register_chrdev(void)
{
if ((major = register_chrdev(0, DEVNAME, &divas_maint_fops)) < 0)
{
printk(KERN_ERR "%s: failed to create /dev entry.\n",
DRIVERLNAME);
return (0);
}
return (1);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 46 | 97.87% | 2 | 66.67% |
h hartley sweeten | h hartley sweeten | 1 | 2.13% | 1 | 33.33% |
| Total | 47 | 100.00% | 3 | 100.00% |
/*
* wake up reader
*/
void diva_maint_wakeup_read(void)
{
wake_up_interruptible(&msgwaitq);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 13 | 100.00% | 1 | 100.00% |
| Total | 13 | 100.00% | 1 | 100.00% |
/*
* Driver Load
*/
static int __init maint_init(void)
{
char tmprev[50];
int ret = 0;
void *buffer = NULL;
init_waitqueue_head(&msgwaitq);
printk(KERN_INFO "%s\n", DRIVERNAME);
printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_MNT);
strcpy(tmprev, main_revision);
printk("%s Build: %s \n", getrev(tmprev), DIVA_BUILD);
if (!divas_maint_register_chrdev()) {
ret = -EIO;
goto out;
}
if (!(mntfunc_init(&buffer_length, &buffer, diva_dbg_mem))) {
printk(KERN_ERR "%s: failed to connect to DIDD.\n",
DRIVERLNAME);
divas_maint_unregister_chrdev();
ret = -EIO;
goto out;
}
printk(KERN_INFO "%s: trace buffer = %p - %d kBytes, %s (Major: %d)\n",
DRIVERLNAME, buffer, (buffer_length / 1024),
(diva_dbg_mem == 0) ? "internal" : "external", major);
out:
return (ret);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 155 | 98.73% | 2 | 50.00% |
h hartley sweeten | h hartley sweeten | 1 | 0.64% | 1 | 25.00% |
al viro | al viro | 1 | 0.64% | 1 | 25.00% |
| Total | 157 | 100.00% | 4 | 100.00% |
/*
** Driver Unload
*/
static void __exit maint_exit(void)
{
divas_maint_unregister_chrdev();
mntfunc_finit();
printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 22 | 95.65% | 1 | 50.00% |
h hartley sweeten | h hartley sweeten | 1 | 4.35% | 1 | 50.00% |
| Total | 23 | 100.00% | 2 | 100.00% |
module_init(maint_init);
module_exit(maint_exit);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
armin schindler | armin schindler | 820 | 88.84% | 5 | 29.41% |
andrew morton | andrew morton | 21 | 2.28% | 2 | 11.76% |
jonathan corbet | jonathan corbet | 18 | 1.95% | 1 | 5.88% |
kai germaschewski | kai germaschewski | 17 | 1.84% | 1 | 5.88% |
arnd bergmann | arnd bergmann | 17 | 1.84% | 1 | 5.88% |
alison schofield | alison schofield | 11 | 1.19% | 1 | 5.88% |
al viro | al viro | 9 | 0.98% | 3 | 17.65% |
linus torvalds | linus torvalds | 6 | 0.65% | 1 | 5.88% |
h hartley sweeten | h hartley sweeten | 3 | 0.33% | 1 | 5.88% |
arjan van de ven | arjan van de ven | 1 | 0.11% | 1 | 5.88% |
| Total | 923 | 100.00% | 17 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.