Skip to content

Commit f59aba2

Browse files
arndbgregkh
authored andcommitted
isdn: capi: dead code removal
The staging isdn drivers are gone, and CONFIG_BT_CMTP is now the only user. This means a lot of the code in the subsystem has no remaining callers and can be removed. Change the capi user space front-end to be part of kernelcapi, and the combined module to only be compiled if BT_CMTP is also enabled, then remove the interfaces that have no remaining callers. As the notifier list and the capi_drivers list have no callers outside of kcapi.c, the implementation gets much simpler. Some definitions from the include/linux/*.h headers are only needed internally and are moved to kcapi.h. Acked-by: David Miller <davem@davemloft.net> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20191210210455.3475361-2-arnd@arndb.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f10870b commit f59aba2

14 files changed

Lines changed: 179 additions & 1606 deletions

File tree

‎Documentation/isdn/interface_capi.rst‎

Lines changed: 0 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,6 @@ This standard is freely available from https://www.capi.org.
2626
2. Driver and Device Registration
2727
=================================
2828

29-
CAPI drivers optionally register themselves with Kernel CAPI by calling the
30-
Kernel CAPI function register_capi_driver() with a pointer to a struct
31-
capi_driver. This structure must be filled with the name and revision of the
32-
driver, and optionally a pointer to a callback function, add_card(). The
33-
registration can be revoked by calling the function unregister_capi_driver()
34-
with a pointer to the same struct capi_driver.
35-
3629
CAPI drivers must register each of the ISDN devices they control with Kernel
3730
CAPI by calling the Kernel CAPI function attach_capi_ctr() with a pointer to a
3831
struct capi_ctr before they can be used. This structure must be filled with
@@ -89,9 +82,6 @@ register_capi_driver():
8982
the name of the driver, as a zero-terminated ASCII string
9083
``char revision[32]``
9184
the revision number of the driver, as a zero-terminated ASCII string
92-
``int (*add_card)(struct capi_driver *driver, capicardparams *data)``
93-
a callback function pointer (may be NULL)
94-
9585

9686
4.2 struct capi_ctr
9787
-------------------
@@ -178,12 +168,6 @@ to be set by the driver before calling attach_capi_ctr():
178168
pointer to a callback function returning the entry for the device in
179169
the CAPI controller info table, /proc/capi/controller
180170

181-
``const struct file_operations *proc_fops``
182-
pointers to callback functions for the device's proc file
183-
system entry, /proc/capi/controllers/<n>; pointer to the device's
184-
capi_ctr structure is available from struct proc_dir_entry::data
185-
which is available from struct inode.
186-
187171
Note:
188172
Callback functions except send_message() are never called in interrupt
189173
context.
@@ -267,25 +251,10 @@ _cmstruct alternative representation for CAPI parameters of type 'struct'
267251
_cmsg structure members.
268252
=========== =================================================================
269253

270-
Functions capi_cmsg2message() and capi_message2cmsg() are provided to convert
271-
messages between their transport encoding described in the CAPI 2.0 standard
272-
and their _cmsg structure representation. Note that capi_cmsg2message() does
273-
not know or check the size of its destination buffer. The caller must make
274-
sure it is big enough to accommodate the resulting CAPI message.
275-
276254

277255
5. Lower Layer Interface Functions
278256
==================================
279257

280-
(declared in <linux/isdn/capilli.h>)
281-
282-
::
283-
284-
void register_capi_driver(struct capi_driver *drvr)
285-
void unregister_capi_driver(struct capi_driver *drvr)
286-
287-
register/unregister a driver with Kernel CAPI
288-
289258
::
290259

291260
int attach_capi_ctr(struct capi_ctr *ctrlr)
@@ -300,13 +269,6 @@ register/unregister a device (controller) with Kernel CAPI
300269

301270
signal controller ready/not ready
302271

303-
::
304-
305-
void capi_ctr_suspend_output(struct capi_ctr *ctrlr)
306-
void capi_ctr_resume_output(struct capi_ctr *ctrlr)
307-
308-
signal suspend/resume
309-
310272
::
311273

312274
void capi_ctr_handle_message(struct capi_ctr * ctrlr, u16 applid,
@@ -319,21 +281,6 @@ for forwarding to the specified application
319281
6. Helper Functions and Macros
320282
==============================
321283

322-
Library functions (from <linux/isdn/capilli.h>):
323-
324-
::
325-
326-
void capilib_new_ncci(struct list_head *head, u16 applid,
327-
u32 ncci, u32 winsize)
328-
void capilib_free_ncci(struct list_head *head, u16 applid, u32 ncci)
329-
void capilib_release_appl(struct list_head *head, u16 applid)
330-
void capilib_release(struct list_head *head)
331-
void capilib_data_b3_conf(struct list_head *head, u16 applid,
332-
u32 ncci, u16 msgid)
333-
u16 capilib_data_b3_req(struct list_head *head, u16 applid,
334-
u32 ncci, u16 msgid)
335-
336-
337284
Macros to extract/set element values from/in a CAPI message header
338285
(from <linux/isdn/capiutil.h>):
339286

@@ -357,24 +304,6 @@ CAPIMSG_DATALEN(m) CAPIMSG_SETDATALEN(m, len) Data Length (u16)
357304
Library functions for working with _cmsg structures
358305
(from <linux/isdn/capiutil.h>):
359306

360-
``unsigned capi_cmsg2message(_cmsg *cmsg, u8 *msg)``
361-
Assembles a CAPI 2.0 message from the parameters in ``*cmsg``,
362-
storing the result in ``*msg``.
363-
364-
``unsigned capi_message2cmsg(_cmsg *cmsg, u8 *msg)``
365-
Disassembles the CAPI 2.0 message in ``*msg``, storing the parameters
366-
in ``*cmsg``.
367-
368-
``unsigned capi_cmsg_header(_cmsg *cmsg, u16 ApplId, u8 Command, u8 Subcommand, u16 Messagenumber, u32 Controller)``
369-
Fills the header part and address field of the _cmsg structure ``*cmsg``
370-
with the given values, zeroing the remainder of the structure so only
371-
parameters with non-default values need to be changed before sending
372-
the message.
373-
374-
``void capi_cmsg_answer(_cmsg *cmsg)``
375-
Sets the low bit of the Subcommand field in ``*cmsg``, thereby
376-
converting ``_REQ`` to ``_CONF`` and ``_IND`` to ``_RESP``.
377-
378307
``char *capi_cmd2str(u8 Command, u8 Subcommand)``
379308
Returns the CAPI 2.0 message name corresponding to the given command
380309
and subcommand values, as a static ASCII string. The return value may

‎drivers/isdn/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
# Object files in subdirectories
55

6-
obj-$(CONFIG_ISDN_CAPI) += capi/
6+
obj-$(CONFIG_BT_CMTP) += capi/
77
obj-$(CONFIG_MISDN) += mISDN/
88
obj-$(CONFIG_ISDN) += hardware/

‎drivers/isdn/capi/Kconfig‎

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
menuconfig ISDN_CAPI
3-
tristate "CAPI 2.0 subsystem"
2+
config ISDN_CAPI
3+
def_bool ISDN && BT
44
help
55
This provides CAPI (the Common ISDN Application Programming
66
Interface) Version 2.0, a standard making it easy for programs to
@@ -15,42 +15,18 @@ menuconfig ISDN_CAPI
1515
See CONFIG_BT_CMTP for the last remaining regular driver
1616
in the kernel that uses the CAPI subsystem.
1717

18-
if ISDN_CAPI
19-
2018
config CAPI_TRACE
21-
bool "CAPI trace support"
22-
default y
19+
def_bool BT_CMTP
2320
help
2421
If you say Y here, the kernelcapi driver can make verbose traces
2522
of CAPI messages. This feature can be enabled/disabled via IOCTL for
2623
every controller (default disabled).
27-
This will increase the size of the kernelcapi module by 20 KB.
28-
If unsure, say Y.
29-
30-
config ISDN_CAPI_CAPI20
31-
tristate "CAPI2.0 /dev/capi20 support"
32-
help
33-
This option will provide the CAPI 2.0 interface to userspace
34-
applications via /dev/capi20. Applications should use the
35-
standardized libcapi20 to access this functionality. You should say
36-
Y/M here.
3724

3825
config ISDN_CAPI_MIDDLEWARE
39-
bool "CAPI2.0 Middleware support"
40-
depends on ISDN_CAPI_CAPI20 && TTY
26+
def_bool BT_CMTP && TTY
4127
help
4228
This option will enhance the capabilities of the /dev/capi20
4329
interface. It will provide a means of moving a data connection,
4430
established via the usual /dev/capi20 interface to a special tty
4531
device. If you want to use pppd with pppdcapiplugin to dial up to
4632
your ISP, say Y here.
47-
48-
config ISDN_CAPI_CAPIDRV_VERBOSE
49-
bool "Verbose reason code reporting"
50-
depends on ISDN_CAPI_CAPIDRV
51-
help
52-
If you say Y here, the capidrv interface will give verbose reasons
53-
for disconnecting. This will increase the size of the kernel by 7 KB.
54-
If unsure, say N.
55-
56-
endif

‎drivers/isdn/capi/Makefile‎

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0
2-
# Makefile for the CAPI subsystem.
2+
# Makefile for the CAPI subsystem used by BT_CMTP
33

4-
# Ordering constraints: kernelcapi.o first
5-
6-
# Each configuration option enables a list of files.
7-
8-
obj-$(CONFIG_ISDN_CAPI) += kernelcapi.o
9-
obj-$(CONFIG_ISDN_CAPI_CAPI20) += capi.o
10-
obj-$(CONFIG_ISDN_CAPI_CAPIDRV) += capidrv.o
11-
12-
# Multipart objects.
13-
14-
kernelcapi-y := kcapi.o capiutil.o capilib.o
15-
kernelcapi-$(CONFIG_PROC_FS) += kcapi_proc.o
16-
17-
ccflags-y += -I$(srctree)/$(src)/../include -I$(srctree)/$(src)/../include/uapi
4+
obj-$(CONFIG_BT_CMTP) += kernelcapi.o
5+
kernelcapi-y := kcapi.o capiutil.o capi.o kcapi_proc.o

‎drivers/isdn/capi/capi.c‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@
3939
#include <linux/isdn/capiutil.h>
4040
#include <linux/isdn/capicmd.h>
4141

42-
MODULE_DESCRIPTION("CAPI4Linux: Userspace /dev/capi20 interface");
42+
#include "kcapi.h"
43+
44+
MODULE_DESCRIPTION("CAPI4Linux: kernel CAPI layer and /dev/capi20 interface");
4345
MODULE_AUTHOR("Carsten Paeth");
4446
MODULE_LICENSE("GPL");
4547

@@ -1412,15 +1414,22 @@ static int __init capi_init(void)
14121414
{
14131415
const char *compileinfo;
14141416
int major_ret;
1417+
int ret;
1418+
1419+
ret = kcapi_init();
1420+
if (ret)
1421+
return ret;
14151422

14161423
major_ret = register_chrdev(capi_major, "capi20", &capi_fops);
14171424
if (major_ret < 0) {
14181425
printk(KERN_ERR "capi20: unable to get major %d\n", capi_major);
1426+
kcapi_exit();
14191427
return major_ret;
14201428
}
14211429
capi_class = class_create(THIS_MODULE, "capi");
14221430
if (IS_ERR(capi_class)) {
14231431
unregister_chrdev(capi_major, "capi20");
1432+
kcapi_exit();
14241433
return PTR_ERR(capi_class);
14251434
}
14261435

@@ -1430,6 +1439,7 @@ static int __init capi_init(void)
14301439
device_destroy(capi_class, MKDEV(capi_major, 0));
14311440
class_destroy(capi_class);
14321441
unregister_chrdev(capi_major, "capi20");
1442+
kcapi_exit();
14331443
return -ENOMEM;
14341444
}
14351445

@@ -1455,6 +1465,8 @@ static void __exit capi_exit(void)
14551465
unregister_chrdev(capi_major, "capi20");
14561466

14571467
capinc_tty_exit();
1468+
1469+
kcapi_exit();
14581470
}
14591471

14601472
module_init(capi_init);

0 commit comments

Comments
 (0)