You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
[media] media_device: move allocation out of media_device_*_init
Right now, media_device_pci_init and media_device_usb_init does media_device allocation internaly. That preents its usage when the media_device struct is embedded on some other structure. Move memory allocation outside it, to make it more generic. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
This commit is contained in:
@@ -550,16 +550,19 @@ struct media_device *media_device_find_devres(struct device *dev);
|
||||
* media_device_pci_init() - create and initialize a
|
||||
* struct &media_device from a PCI device.
|
||||
*
|
||||
* @mdev: pointer to struct &media_device
|
||||
* @pci_dev: pointer to struct pci_dev
|
||||
* @name: media device name. If %NULL, the routine will use the default
|
||||
* name for the pci device, given by pci_name() macro.
|
||||
*/
|
||||
struct media_device *media_device_pci_init(struct pci_dev *pci_dev,
|
||||
const char *name);
|
||||
void media_device_pci_init(struct media_device *mdev,
|
||||
struct pci_dev *pci_dev,
|
||||
const char *name);
|
||||
/**
|
||||
* __media_device_usb_init() - create and initialize a
|
||||
* struct &media_device from a PCI device.
|
||||
*
|
||||
* @mdev: pointer to struct &media_device
|
||||
* @udev: pointer to struct usb_device
|
||||
* @board_name: media device name. If %NULL, the routine will use the usb
|
||||
* product name, if available.
|
||||
@@ -570,9 +573,10 @@ struct media_device *media_device_pci_init(struct pci_dev *pci_dev,
|
||||
* NOTE: It is better to call media_device_usb_init() instead, as
|
||||
* such macro fills driver_name with %KBUILD_MODNAME.
|
||||
*/
|
||||
struct media_device *__media_device_usb_init(struct usb_device *udev,
|
||||
const char *board_name,
|
||||
const char *driver_name);
|
||||
void __media_device_usb_init(struct media_device *mdev,
|
||||
struct usb_device *udev,
|
||||
const char *board_name,
|
||||
const char *driver_name);
|
||||
|
||||
#else
|
||||
static inline int media_device_register(struct media_device *mdev)
|
||||
@@ -599,24 +603,24 @@ static inline struct media_device *media_device_find_devres(struct device *dev)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline
|
||||
struct media_device *media_device_pci_init(struct pci_dev *pci_dev,
|
||||
char *name)
|
||||
static inline void media_device_pci_init(struct media_device *mdev,
|
||||
struct pci_dev *pci_dev,
|
||||
char *name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline
|
||||
struct media_device *__media_device_usb_init(struct usb_device *udev,
|
||||
char *board_name,
|
||||
char *driver_name)
|
||||
static inline void __media_device_usb_init(struct media_device *mdev,
|
||||
struct usb_device *udev,
|
||||
char *board_name,
|
||||
char *driver_name)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_MEDIA_CONTROLLER */
|
||||
|
||||
#define media_device_usb_init(udev, name) \
|
||||
__media_device_usb_init(udev, name, KBUILD_MODNAME)
|
||||
#define media_device_usb_init(mdev, udev, name) \
|
||||
__media_device_usb_init(mdev, udev, name, KBUILD_MODNAME)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user