| .. | .. |
|---|
| 86 | 86 | * @priv: private data |
|---|
| 87 | 87 | * @device: pointer to struct device |
|---|
| 88 | 88 | * @module: pointer to struct module |
|---|
| 89 | | - * @mfe_shared: mfe shared: indicates mutually exclusive frontends |
|---|
| 90 | | - * Thie usage of this flag is currently deprecated |
|---|
| 89 | + * @mfe_shared: indicates mutually exclusive frontends. |
|---|
| 90 | + * Use of this flag is currently deprecated. |
|---|
| 91 | 91 | * @mfe_dvbdev: Frontend device in use, in the case of MFE |
|---|
| 92 | 92 | * @mfe_lock: Lock to prevent using the other frontends when MFE is |
|---|
| 93 | 93 | * used. |
|---|
| .. | .. |
|---|
| 126 | 126 | * struct dvb_device - represents a DVB device node |
|---|
| 127 | 127 | * |
|---|
| 128 | 128 | * @list_head: List head with all DVB devices |
|---|
| 129 | + * @ref: reference counter |
|---|
| 129 | 130 | * @fops: pointer to struct file_operations |
|---|
| 130 | 131 | * @adapter: pointer to the adapter that holds this device node |
|---|
| 131 | 132 | * @type: type of the device, as defined by &enum dvb_device_type. |
|---|
| .. | .. |
|---|
| 156 | 157 | */ |
|---|
| 157 | 158 | struct dvb_device { |
|---|
| 158 | 159 | struct list_head list_head; |
|---|
| 160 | + struct kref ref; |
|---|
| 159 | 161 | const struct file_operations *fops; |
|---|
| 160 | 162 | struct dvb_adapter *adapter; |
|---|
| 161 | 163 | enum dvb_device_type type; |
|---|
| .. | .. |
|---|
| 186 | 188 | |
|---|
| 187 | 189 | void *priv; |
|---|
| 188 | 190 | }; |
|---|
| 191 | + |
|---|
| 192 | +/** |
|---|
| 193 | + * struct dvbdevfops_node - fops nodes registered in dvbdevfops_list |
|---|
| 194 | + * |
|---|
| 195 | + * @fops: Dynamically allocated fops for ->owner registration |
|---|
| 196 | + * @type: type of dvb_device |
|---|
| 197 | + * @template: dvb_device used for registration |
|---|
| 198 | + * @list_head: list_head for dvbdevfops_list |
|---|
| 199 | + */ |
|---|
| 200 | +struct dvbdevfops_node { |
|---|
| 201 | + struct file_operations *fops; |
|---|
| 202 | + enum dvb_device_type type; |
|---|
| 203 | + const struct dvb_device *template; |
|---|
| 204 | + struct list_head list_head; |
|---|
| 205 | +}; |
|---|
| 206 | + |
|---|
| 207 | +/** |
|---|
| 208 | + * dvb_device_get - Increase dvb_device reference |
|---|
| 209 | + * |
|---|
| 210 | + * @dvbdev: pointer to struct dvb_device |
|---|
| 211 | + */ |
|---|
| 212 | +struct dvb_device *dvb_device_get(struct dvb_device *dvbdev); |
|---|
| 213 | + |
|---|
| 214 | +/** |
|---|
| 215 | + * dvb_device_put - Decrease dvb_device reference |
|---|
| 216 | + * |
|---|
| 217 | + * @dvbdev: pointer to struct dvb_device |
|---|
| 218 | + */ |
|---|
| 219 | +void dvb_device_put(struct dvb_device *dvbdev); |
|---|
| 189 | 220 | |
|---|
| 190 | 221 | /** |
|---|
| 191 | 222 | * dvb_register_adapter - Registers a new DVB adapter |
|---|
| .. | .. |
|---|
| 231 | 262 | /** |
|---|
| 232 | 263 | * dvb_remove_device - Remove a registered DVB device |
|---|
| 233 | 264 | * |
|---|
| 234 | | - * This does not free memory. To do that, call dvb_free_device(). |
|---|
| 265 | + * This does not free memory. dvb_free_device() will do that when |
|---|
| 266 | + * reference counter is empty |
|---|
| 235 | 267 | * |
|---|
| 236 | 268 | * @dvbdev: pointer to struct dvb_device |
|---|
| 237 | 269 | */ |
|---|
| 238 | 270 | void dvb_remove_device(struct dvb_device *dvbdev); |
|---|
| 239 | 271 | |
|---|
| 240 | | -/** |
|---|
| 241 | | - * dvb_free_device - Free memory occupied by a DVB device. |
|---|
| 242 | | - * |
|---|
| 243 | | - * Call dvb_unregister_device() before calling this function. |
|---|
| 244 | | - * |
|---|
| 245 | | - * @dvbdev: pointer to struct dvb_device |
|---|
| 246 | | - */ |
|---|
| 247 | | -void dvb_free_device(struct dvb_device *dvbdev); |
|---|
| 248 | 272 | |
|---|
| 249 | 273 | /** |
|---|
| 250 | 274 | * dvb_unregister_device - Unregisters a DVB device |
|---|
| 251 | | - * |
|---|
| 252 | | - * This is a combination of dvb_remove_device() and dvb_free_device(). |
|---|
| 253 | | - * Using this function is usually a mistake, and is often an indicator |
|---|
| 254 | | - * for a use-after-free bug (when a userspace process keeps a file |
|---|
| 255 | | - * handle to a detached device). |
|---|
| 256 | 275 | * |
|---|
| 257 | 276 | * @dvbdev: pointer to struct dvb_device |
|---|
| 258 | 277 | */ |
|---|
| .. | .. |
|---|
| 293 | 312 | * |
|---|
| 294 | 313 | * @adap: pointer to &struct dvb_adapter |
|---|
| 295 | 314 | */ |
|---|
| 296 | | -static inline struct media_device |
|---|
| 297 | | -*dvb_get_media_controller(struct dvb_adapter *adap) |
|---|
| 315 | +static inline struct media_device * |
|---|
| 316 | +dvb_get_media_controller(struct dvb_adapter *adap) |
|---|
| 298 | 317 | { |
|---|
| 299 | 318 | return adap->mdev; |
|---|
| 300 | 319 | } |
|---|
| .. | .. |
|---|
| 385 | 404 | * with dvb_module_probe() should use dvb_module_release() to unbind. |
|---|
| 386 | 405 | * |
|---|
| 387 | 406 | * Return: |
|---|
| 388 | | - * On success, return an &struct i2c_client, pointing the the bound |
|---|
| 407 | + * On success, return an &struct i2c_client, pointing to the bound |
|---|
| 389 | 408 | * I2C device. %NULL otherwise. |
|---|
| 390 | 409 | * |
|---|
| 391 | 410 | * .. note:: |
|---|