ixgbe: Limit number of reported VFs to device specific value
[linux-2.6/cjktty.git] / include / media / soc_camera_platform.h
blob8aa4200a0b1d78021cd0b1d96ae980f306e282d0
1 /*
2 * Generic Platform Camera Driver Header
4 * Copyright (C) 2008 Magnus Damm
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
11 #ifndef __SOC_CAMERA_H__
12 #define __SOC_CAMERA_H__
14 #include <linux/videodev2.h>
15 #include <media/soc_camera.h>
16 #include <media/v4l2-mediabus.h>
18 struct device;
20 struct soc_camera_platform_info {
21 const char *format_name;
22 unsigned long format_depth;
23 struct v4l2_mbus_framefmt format;
24 unsigned long mbus_param;
25 enum v4l2_mbus_type mbus_type;
26 struct soc_camera_device *icd;
27 int (*set_capture)(struct soc_camera_platform_info *info, int enable);
30 static inline void soc_camera_platform_release(struct platform_device **pdev)
32 *pdev = NULL;
35 static inline int soc_camera_platform_add(struct soc_camera_device *icd,
36 struct platform_device **pdev,
37 struct soc_camera_link *plink,
38 void (*release)(struct device *dev),
39 int id)
41 struct soc_camera_platform_info *info = plink->priv;
42 int ret;
44 if (icd->link != plink)
45 return -ENODEV;
47 if (*pdev)
48 return -EBUSY;
50 *pdev = platform_device_alloc("soc_camera_platform", id);
51 if (!*pdev)
52 return -ENOMEM;
54 info->icd = icd;
56 (*pdev)->dev.platform_data = info;
57 (*pdev)->dev.release = release;
59 ret = platform_device_add(*pdev);
60 if (ret < 0) {
61 platform_device_put(*pdev);
62 *pdev = NULL;
63 info->icd = NULL;
66 return ret;
69 static inline void soc_camera_platform_del(const struct soc_camera_device *icd,
70 struct platform_device *pdev,
71 const struct soc_camera_link *plink)
73 if (icd->link != plink || !pdev)
74 return;
76 platform_device_unregister(pdev);
79 #endif /* __SOC_CAMERA_H__ */