10 #define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
12 #include <linux/ctype.h>
13 #include <linux/string.h>
14 #include <linux/atmdev.h>
15 #include <linux/sonet.h>
16 #include <linux/kernel.h>
17 #include <linux/module.h>
18 #include <linux/bitops.h>
19 #include <linux/capability.h>
22 #include <linux/slab.h>
34 static struct atm_dev *__alloc_atm_dev(
const char *
type)
45 INIT_LIST_HEAD(&dev->
local);
46 INIT_LIST_HEAD(&dev->
lecs);
58 if (dev->
number == number) {
71 dev = __atm_dev_lookup(number);
83 dev = __alloc_atm_dev(type);
85 pr_err(
"no space for dev %s\n", type);
90 inuse = __atm_dev_lookup(number);
100 while ((inuse = __atm_dev_lookup(dev->
number))) {
115 pr_err(
"atm_proc_dev_register failed for dev %s\n", type);
120 pr_err(
"atm_register_sysfs failed for dev %s\n", type);
163 #define __HANDLE_ITEM(i) to->i = atomic_read(&from->i)
171 #define __HANDLE_ITEM(i) atomic_sub(to->i, &from->i)
182 copy_aal_stats(&dev->
stats.aal0, &
tmp.aal0);
183 copy_aal_stats(&dev->
stats.aal34, &
tmp.aal34);
184 copy_aal_stats(&dev->
stats.aal5, &
tmp.aal5);
187 if (zero && !error) {
188 subtract_aal_stats(&dev->
stats.aal0, &
tmp.aal0);
189 subtract_aal_stats(&dev->
stats.aal34, &
tmp.aal34);
190 subtract_aal_stats(&dev->
stats.aal5, &
tmp.aal5);
192 return error ? -
EFAULT : 0;
201 int *tmp_buf, *tmp_p;
205 #ifndef CONFIG_COMPAT
213 struct compat_atm_iobuf __user *ciobuf =
arg;
215 iobuf_len = &ciobuf->length;
216 if (
get_user(cbuf, &ciobuf->buffer))
218 buf = compat_ptr(cbuf);
222 iobuf_len = &iobuf->
length;
257 struct compat_atmif_sioc __user *csioc =
arg;
260 sioc_len = &csioc->length;
263 buf = compat_ptr(carg);
267 if (
get_user(number, &csioc->number))
421 if (!dev->
ops->compat_ioctl) {
425 size = dev->
ops->compat_ioctl(dev, cmd, buf);
428 if (!dev->
ops->ioctl) {
432 size = dev->
ops->ioctl(dev, cmd, buf);