![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0+ */ 0002 /* 0003 * media-dev-allocator.h - Media Controller Device Allocator API 0004 * 0005 * Copyright (c) 2019 Shuah Khan <shuah@kernel.org> 0006 * 0007 * Credits: Suggested by Laurent Pinchart <laurent.pinchart@ideasonboard.com> 0008 */ 0009 0010 /* 0011 * This file adds a global ref-counted Media Controller Device Instance API. 0012 * A system wide global media device list is managed and each media device 0013 * includes a kref count. The last put on the media device releases the media 0014 * device instance. 0015 */ 0016 0017 #ifndef _MEDIA_DEV_ALLOCATOR_H 0018 #define _MEDIA_DEV_ALLOCATOR_H 0019 0020 struct usb_device; 0021 0022 #if defined(CONFIG_MEDIA_CONTROLLER) && IS_ENABLED(CONFIG_USB) 0023 /** 0024 * media_device_usb_allocate() - Allocate and return struct &media device 0025 * 0026 * @udev: struct &usb_device pointer 0027 * @module_name: should be filled with %KBUILD_MODNAME 0028 * @owner: struct module pointer %THIS_MODULE for the driver. 0029 * %THIS_MODULE is null for a built-in driver. 0030 * It is safe even when %THIS_MODULE is null. 0031 * 0032 * This interface should be called to allocate a Media Device when multiple 0033 * drivers share usb_device and the media device. This interface allocates 0034 * &media_device structure and calls media_device_usb_init() to initialize 0035 * it. 0036 * 0037 */ 0038 struct media_device *media_device_usb_allocate(struct usb_device *udev, 0039 const char *module_name, 0040 struct module *owner); 0041 /** 0042 * media_device_delete() - Release media device. Calls kref_put(). 0043 * 0044 * @mdev: struct &media_device pointer 0045 * @module_name: should be filled with %KBUILD_MODNAME 0046 * @owner: struct module pointer %THIS_MODULE for the driver. 0047 * %THIS_MODULE is null for a built-in driver. 0048 * It is safe even when %THIS_MODULE is null. 0049 * 0050 * This interface should be called to put Media Device Instance kref. 0051 */ 0052 void media_device_delete(struct media_device *mdev, const char *module_name, 0053 struct module *owner); 0054 #else 0055 static inline struct media_device *media_device_usb_allocate( 0056 struct usb_device *udev, const char *module_name, 0057 struct module *owner) 0058 { return NULL; } 0059 static inline void media_device_delete( 0060 struct media_device *mdev, const char *module_name, 0061 struct module *owner) { } 0062 #endif /* CONFIG_MEDIA_CONTROLLER && CONFIG_USB */ 0063 #endif /* _MEDIA_DEV_ALLOCATOR_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |