^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * dvbdev.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (C) 2000 Ralph Metzler & Marcus Metzler
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * for convergence integrated media GmbH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * This program is free software; you can redistribute it and/or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * modify it under the terms of the GNU General Lesser Public License
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) * as published by the Free Software Foundation; either version 2.1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * of the License, or (at your option) any later version.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * This program is distributed in the hope that it will be useful,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) * but WITHOUT ANY WARRANTY; without even the implied warranty of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * GNU General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #ifndef _DVBDEV_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #define _DVBDEV_H_
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/poll.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <media/media-device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #define DVB_MAJOR 212
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #if defined(CONFIG_DVB_MAX_ADAPTERS) && CONFIG_DVB_MAX_ADAPTERS > 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define DVB_MAX_ADAPTERS CONFIG_DVB_MAX_ADAPTERS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define DVB_MAX_ADAPTERS 16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define DVB_UNSET (-1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) /* List of DVB device types */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * enum dvb_device_type - type of the Digital TV device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) * @DVB_DEVICE_SEC: Digital TV standalone Common Interface (CI)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) * @DVB_DEVICE_FRONTEND: Digital TV frontend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * @DVB_DEVICE_DEMUX: Digital TV demux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) * @DVB_DEVICE_DVR: Digital TV digital video record (DVR).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) * @DVB_DEVICE_CA: Digital TV Conditional Access (CA).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) * @DVB_DEVICE_NET: Digital TV network.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * @DVB_DEVICE_VIDEO: Digital TV video decoder.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * Deprecated. Used only on av7110-av.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) * @DVB_DEVICE_AUDIO: Digital TV audio decoder.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * Deprecated. Used only on av7110-av.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * @DVB_DEVICE_OSD: Digital TV On Screen Display (OSD).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * Deprecated. Used only on av7110.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) enum dvb_device_type {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) DVB_DEVICE_SEC,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) DVB_DEVICE_FRONTEND,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) DVB_DEVICE_DEMUX,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) DVB_DEVICE_DVR,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) DVB_DEVICE_CA,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) DVB_DEVICE_NET,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) DVB_DEVICE_VIDEO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) DVB_DEVICE_AUDIO,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) DVB_DEVICE_OSD,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) #define DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) static short adapter_nr[] = \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) {[0 ... (DVB_MAX_ADAPTERS - 1)] = DVB_UNSET }; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) module_param_array(adapter_nr, short, NULL, 0444); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) MODULE_PARM_DESC(adapter_nr, "DVB adapter numbers")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct dvb_frontend;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) * struct dvb_adapter - represents a Digital TV adapter using Linux DVB API
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) * @num: Number of the adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) * @list_head: List with the DVB adapters
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) * @device_list: List with the DVB devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) * @name: Name of the adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) * @proposed_mac: proposed MAC address for the adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) * @priv: private data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) * @device: pointer to struct device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) * @module: pointer to struct module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) * @mfe_shared: indicates mutually exclusive frontends.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) * Use of this flag is currently deprecated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) * @mfe_dvbdev: Frontend device in use, in the case of MFE
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) * @mfe_lock: Lock to prevent using the other frontends when MFE is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * @mdev_lock: Protect access to the mdev pointer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * @mdev: pointer to struct media_device, used when the media
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * controller is used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * @conn: RF connector. Used only if the device has no separate
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) * tuner.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * @conn_pads: pointer to struct media_pad associated with @conn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) struct dvb_adapter {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) int num;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) struct list_head list_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) struct list_head device_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) u8 proposed_mac [6];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) void* priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct device *device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) struct module *module;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) int mfe_shared; /* indicates mutually exclusive frontends */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) struct dvb_device *mfe_dvbdev; /* frontend device in use */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) struct mutex mfe_lock; /* access lock for thread creation */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) struct mutex mdev_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) struct media_device *mdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) struct media_entity *conn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) struct media_pad *conn_pads;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * struct dvb_device - represents a DVB device node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) * @list_head: List head with all DVB devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) * @fops: pointer to struct file_operations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) * @adapter: pointer to the adapter that holds this device node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) * @type: type of the device, as defined by &enum dvb_device_type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * @minor: devnode minor number. Major number is always DVB_MAJOR.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * @id: device ID number, inside the adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * @readers: Initialized by the caller. Each call to open() in Read Only mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * decreases this counter by one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) * @writers: Initialized by the caller. Each call to open() in Read/Write
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * mode decreases this counter by one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * @users: Initialized by the caller. Each call to open() in any mode
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * decreases this counter by one.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * @wait_queue: wait queue, used to wait for certain events inside one of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) * the DVB API callers
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * @kernel_ioctl: callback function used to handle ioctl calls from userspace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * @name: Name to be used for the device at the Media Controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * @entity: pointer to struct media_entity associated with the device node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * @pads: pointer to struct media_pad associated with @entity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * @priv: private data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) * @intf_devnode: Pointer to media_intf_devnode. Used by the dvbdev core to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * store the MC device node interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * @tsout_num_entities: Number of Transport Stream output entities
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * @tsout_entity: array with MC entities associated to each TS output node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) * @tsout_pads: array with the source pads for each @tsout_entity
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * This structure is used by the DVB core (frontend, CA, net, demux) in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * order to create the device nodes. Usually, driver should not initialize
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) * this struct diretly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) struct dvb_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) struct list_head list_head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) const struct file_operations *fops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) struct dvb_adapter *adapter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) enum dvb_device_type type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) int minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) u32 id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) /* in theory, 'users' can vanish now,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) but I don't want to change too much now... */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) int readers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) int writers;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) int users;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) wait_queue_head_t wait_queue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) /* don't really need those !? -- FIXME: use video_usercopy */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) /* Needed for media controller register/unregister */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) #if defined(CONFIG_MEDIA_CONTROLLER_DVB)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) /* Allocated and filled inside dvbdev.c */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) struct media_intf_devnode *intf_devnode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) unsigned tsout_num_entities;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) struct media_entity *entity, *tsout_entity;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) struct media_pad *pads, *tsout_pads;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) void *priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) * dvb_register_adapter - Registers a new DVB adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) * @adap: pointer to struct dvb_adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) * @name: Adapter's name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) * @module: initialized with THIS_MODULE at the caller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) * @device: pointer to struct device that corresponds to the device driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) * @adapter_nums: Array with a list of the numbers for @dvb_register_adapter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) * to select among them. Typically, initialized with:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) * DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nums)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) int dvb_register_adapter(struct dvb_adapter *adap, const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) struct module *module, struct device *device,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) short *adapter_nums);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) * dvb_unregister_adapter - Unregisters a DVB adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) * @adap: pointer to struct dvb_adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) int dvb_unregister_adapter(struct dvb_adapter *adap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * dvb_register_device - Registers a new DVB device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * @adap: pointer to struct dvb_adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) * @pdvbdev: pointer to the place where the new struct dvb_device will be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) * stored
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * @template: Template used to create &pdvbdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) * @priv: private data
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) * @type: type of the device, as defined by &enum dvb_device_type.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) * @demux_sink_pads: Number of demux outputs, to be used to create the TS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) * outputs via the Media Controller.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int dvb_register_device(struct dvb_adapter *adap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) struct dvb_device **pdvbdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) const struct dvb_device *template,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) void *priv,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) enum dvb_device_type type,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) int demux_sink_pads);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) * dvb_remove_device - Remove a registered DVB device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) * This does not free memory. To do that, call dvb_free_device().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) * @dvbdev: pointer to struct dvb_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) void dvb_remove_device(struct dvb_device *dvbdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) * dvb_free_device - Free memory occupied by a DVB device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) * Call dvb_unregister_device() before calling this function.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) * @dvbdev: pointer to struct dvb_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) void dvb_free_device(struct dvb_device *dvbdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) * dvb_unregister_device - Unregisters a DVB device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) * This is a combination of dvb_remove_device() and dvb_free_device().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) * Using this function is usually a mistake, and is often an indicator
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) * for a use-after-free bug (when a userspace process keeps a file
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) * handle to a detached device).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * @dvbdev: pointer to struct dvb_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) void dvb_unregister_device(struct dvb_device *dvbdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) #ifdef CONFIG_MEDIA_CONTROLLER_DVB
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) * dvb_create_media_graph - Creates media graph for the Digital TV part of the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) * device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) * @adap: pointer to &struct dvb_adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) * @create_rf_connector: if true, it creates the RF connector too
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) * This function checks all DVB-related functions at the media controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * entities and creates the needed links for the media graph. It is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) * capable of working with multiple tuners or multiple frontends, but it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) * won't create links if the device has multiple tuners and multiple frontends
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) * or if the device has multiple muxes. In such case, the caller driver should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * manually create the remaining links.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) __must_check int dvb_create_media_graph(struct dvb_adapter *adap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) bool create_rf_connector);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) * dvb_register_media_controller - registers a media controller at DVB adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) * @adap: pointer to &struct dvb_adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) * @mdev: pointer to &struct media_device
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) static inline void dvb_register_media_controller(struct dvb_adapter *adap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) struct media_device *mdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) adap->mdev = mdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) * dvb_get_media_controller - gets the associated media controller
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) * @adap: pointer to &struct dvb_adapter
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) static inline struct media_device *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) dvb_get_media_controller(struct dvb_adapter *adap)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) return adap->mdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) static inline
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) int dvb_create_media_graph(struct dvb_adapter *adap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) bool create_rf_connector)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) #define dvb_register_media_controller(a, b) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) #define dvb_get_media_controller(a) NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) * dvb_generic_open - Digital TV open function, used by DVB devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) * @inode: pointer to &struct inode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) * @file: pointer to &struct file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) * Checks if a DVB devnode is still valid, and if the permissions are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) * OK and increment negative use count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) int dvb_generic_open(struct inode *inode, struct file *file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) * dvb_generic_close - Digital TV close function, used by DVB devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) * @inode: pointer to &struct inode.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) * @file: pointer to &struct file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) * Checks if a DVB devnode is still valid, and if the permissions are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) * OK and decrement negative use count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) int dvb_generic_release(struct inode *inode, struct file *file);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) * dvb_generic_ioctl - Digital TV close function, used by DVB devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) * @file: pointer to &struct file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) * @cmd: Ioctl name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) * @arg: Ioctl argument.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) * Checks if a DVB devnode and struct dvbdev.kernel_ioctl is still valid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) * If so, calls dvb_usercopy().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) long dvb_generic_ioctl(struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) unsigned int cmd, unsigned long arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) * dvb_usercopy - copies data from/to userspace memory when an ioctl is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) * issued.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) * @file: Pointer to struct &file.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) * @cmd: Ioctl name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) * @arg: Ioctl argument.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) * @func: function that will actually handle the ioctl
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) * Ancillary function that uses ioctl direction and size to copy from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) * userspace. Then, it calls @func, and, if needed, data is copied back
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) * to userspace.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) int dvb_usercopy(struct file *file, unsigned int cmd, unsigned long arg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) int (*func)(struct file *file, unsigned int cmd, void *arg));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) #if IS_ENABLED(CONFIG_I2C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) struct i2c_adapter;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) struct i2c_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) * dvb_module_probe - helper routine to probe an I2C module
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) * @module_name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) * Name of the I2C module to be probed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) * @name:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) * Optional name for the I2C module. Used for debug purposes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) * If %NULL, defaults to @module_name.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) * @adap:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) * pointer to &struct i2c_adapter that describes the I2C adapter where
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) * the module will be bound.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) * @addr:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) * I2C address of the adapter, in 7-bit notation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) * @platform_data:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) * Platform data to be passed to the I2C module probed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) * This function binds an I2C device into the DVB core. Should be used by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) * all drivers that use I2C bus to control the hardware. A module bound
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) * with dvb_module_probe() should use dvb_module_release() to unbind.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) * Return:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) * On success, return an &struct i2c_client, pointing to the bound
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) * I2C device. %NULL otherwise.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) * .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) * In the past, DVB modules (mainly, frontends) were bound via dvb_attach()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) * macro, with does an ugly hack, using I2C low level functions. Such
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) * usage is deprecated and will be removed soon. Instead, use this routine.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) struct i2c_client *dvb_module_probe(const char *module_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) const char *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) struct i2c_adapter *adap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) unsigned char addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) void *platform_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) * dvb_module_release - releases an I2C device allocated with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) * dvb_module_probe().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) * @client: pointer to &struct i2c_client with the I2C client to be released.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) * can be %NULL.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) * This function should be used to free all resources reserved by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) * dvb_module_probe() and unbinding the I2C hardware.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) void dvb_module_release(struct i2c_client *client);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) #endif /* CONFIG_I2C */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) /* Legacy generic DVB attach function. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) #ifdef CONFIG_MEDIA_ATTACH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) * dvb_attach - attaches a DVB frontend into the DVB core.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) * @FUNCTION: function on a frontend module to be called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) * @ARGS...: @FUNCTION arguments.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) * This ancillary function loads a frontend module in runtime and runs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) * the @FUNCTION function there, with @ARGS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) * As it increments symbol usage cont, at unregister, dvb_detach()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) * should be called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) * .. note::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) * In the past, DVB modules (mainly, frontends) were bound via dvb_attach()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) * macro, with does an ugly hack, using I2C low level functions. Such
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) * usage is deprecated and will be removed soon. Instead, you should use
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) * dvb_module_probe().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) #define dvb_attach(FUNCTION, ARGS...) ({ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) void *__r = NULL; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) typeof(&FUNCTION) __a = symbol_request(FUNCTION); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) if (__a) { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) __r = (void *) __a(ARGS); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) if (__r == NULL) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) symbol_put(FUNCTION); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) } else { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) printk(KERN_ERR "DVB: Unable to find symbol "#FUNCTION"()\n"); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) } \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) __r; \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) * dvb_detach - detaches a DVB frontend loaded via dvb_attach()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) * @FUNC: attach function
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) * Decrements usage count for a function previously called via dvb_attach().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) #define dvb_detach(FUNC) symbol_put_addr(FUNC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) #define dvb_attach(FUNCTION, ARGS...) ({ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) FUNCTION(ARGS); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) })
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) #define dvb_detach(FUNC) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) #endif /* CONFIG_MEDIA_ATTACH */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) #endif /* #ifndef _DVBDEV_H_ */