mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-23 09:56:00 +00:00
313162d0b8
The <linux/device.h> header includes a lot of stuff, and it in turn gets a lot of use just for the basic "struct device" which appears so often. Clean up the users as follows: 1) For those headers only needing "struct device" as a pointer in fcn args, replace the include with exactly that. 2) For headers not really using anything from device.h, simply delete the include altogether. 3) For headers relying on getting device.h implicitly before being included themselves, now explicitly include device.h 4) For files in which doing #1 or #2 uncovers an implicit dependency on some other header, fix by explicitly adding the required header(s). Any C files that were implicitly relying on device.h to be present have already been dealt with in advance. Total removals from #1 and #2: 51. Total additions coming from #3: 9. Total other implicit dependencies from #4: 7. As of 3.3-rc1, there were 110, so a net removal of 42 gives about a 38% reduction in device.h presence in include/* Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
97 lines
2.9 KiB
C
97 lines
2.9 KiB
C
/*
|
|
* Media device
|
|
*
|
|
* Copyright (C) 2010 Nokia Corporation
|
|
*
|
|
* Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
* Sakari Ailus <sakari.ailus@iki.fi>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#ifndef _MEDIA_DEVICE_H
|
|
#define _MEDIA_DEVICE_H
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/mutex.h>
|
|
#include <linux/spinlock.h>
|
|
|
|
#include <media/media-devnode.h>
|
|
#include <media/media-entity.h>
|
|
|
|
struct device;
|
|
|
|
/**
|
|
* struct media_device - Media device
|
|
* @dev: Parent device
|
|
* @devnode: Media device node
|
|
* @model: Device model name
|
|
* @serial: Device serial number (optional)
|
|
* @bus_info: Unique and stable device location identifier
|
|
* @hw_revision: Hardware device revision
|
|
* @driver_version: Device driver version
|
|
* @entity_id: ID of the next entity to be registered
|
|
* @entities: List of registered entities
|
|
* @lock: Entities list lock
|
|
* @graph_mutex: Entities graph operation lock
|
|
*
|
|
* This structure represents an abstract high-level media device. It allows easy
|
|
* access to entities and provides basic media device-level support. The
|
|
* structure can be allocated directly or embedded in a larger structure.
|
|
*
|
|
* The parent @dev is a physical device. It must be set before registering the
|
|
* media device.
|
|
*
|
|
* @model is a descriptive model name exported through sysfs. It doesn't have to
|
|
* be unique.
|
|
*/
|
|
struct media_device {
|
|
/* dev->driver_data points to this struct. */
|
|
struct device *dev;
|
|
struct media_devnode devnode;
|
|
|
|
char model[32];
|
|
char serial[40];
|
|
char bus_info[32];
|
|
u32 hw_revision;
|
|
u32 driver_version;
|
|
|
|
u32 entity_id;
|
|
struct list_head entities;
|
|
|
|
/* Protects the entities list */
|
|
spinlock_t lock;
|
|
/* Serializes graph operations. */
|
|
struct mutex graph_mutex;
|
|
|
|
int (*link_notify)(struct media_pad *source,
|
|
struct media_pad *sink, u32 flags);
|
|
};
|
|
|
|
/* media_devnode to media_device */
|
|
#define to_media_device(node) container_of(node, struct media_device, devnode)
|
|
|
|
int __must_check media_device_register(struct media_device *mdev);
|
|
void media_device_unregister(struct media_device *mdev);
|
|
|
|
int __must_check media_device_register_entity(struct media_device *mdev,
|
|
struct media_entity *entity);
|
|
void media_device_unregister_entity(struct media_entity *entity);
|
|
|
|
/* Iterate over all entities. */
|
|
#define media_device_for_each_entity(entity, mdev) \
|
|
list_for_each_entry(entity, &(mdev)->entities, list)
|
|
|
|
#endif
|