Commit c405028f authored by Ojaswin Mujoo's avatar Ojaswin Mujoo Committed by Greg Kroah-Hartman

staging: vchiq: Move certain declarations to vchiq_arm.h

Move certain declarations from vchiq_arm.c to vchiq_arm.h to allow
code sharing. This will be useful when we eventually separate the vchiq
char driver code from platform code, into its own file.
Reviewed-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: default avatarOjaswin Mujoo <ojaswin98@gmail.com>
Link: https://lore.kernel.org/r/8abcbd9fb3227e2a78ccc4a1186c8c0801061a68.1626882325.git.ojaswin98@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2a4d15a4
...@@ -38,12 +38,6 @@ ...@@ -38,12 +38,6 @@
#undef MODULE_PARAM_PREFIX #undef MODULE_PARAM_PREFIX
#define MODULE_PARAM_PREFIX DEVICE_NAME "." #define MODULE_PARAM_PREFIX DEVICE_NAME "."
/* Some per-instance constants */
#define MAX_COMPLETIONS 128
#define MAX_SERVICES 64
#define MAX_ELEMENTS 8
#define MSG_QUEUE_SIZE 128
#define KEEPALIVE_VER 1 #define KEEPALIVE_VER 1
#define KEEPALIVE_VER_MIN KEEPALIVE_VER #define KEEPALIVE_VER_MIN KEEPALIVE_VER
...@@ -51,62 +45,12 @@ ...@@ -51,62 +45,12 @@
int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT; int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT;
int vchiq_susp_log_level = VCHIQ_LOG_ERROR; int vchiq_susp_log_level = VCHIQ_LOG_ERROR;
struct user_service { DEFINE_SPINLOCK(msg_queue_spinlock);
struct vchiq_service *service; struct vchiq_state g_state;
void __user *userdata;
struct vchiq_instance *instance;
char is_vchi;
char dequeue_pending;
char close_pending;
int message_available_pos;
int msg_insert;
int msg_remove;
struct completion insert_event;
struct completion remove_event;
struct completion close_event;
struct vchiq_header *msg_queue[MSG_QUEUE_SIZE];
};
struct bulk_waiter_node {
struct bulk_waiter bulk_waiter;
int pid;
struct list_head list;
};
struct vchiq_instance {
struct vchiq_state *state;
struct vchiq_completion_data_kernel completions[MAX_COMPLETIONS];
int completion_insert;
int completion_remove;
struct completion insert_event;
struct completion remove_event;
struct mutex completion_mutex;
int connected;
int closing;
int pid;
int mark;
int use_close_delivered;
int trace;
struct list_head bulk_waiter_list;
struct mutex bulk_waiter_list_mutex;
struct vchiq_debugfs_node debugfs_node;
};
struct dump_context {
char __user *buf;
size_t actual;
size_t space;
loff_t offset;
};
static struct cdev vchiq_cdev; static struct cdev vchiq_cdev;
static dev_t vchiq_devid; static dev_t vchiq_devid;
static struct vchiq_state g_state;
static struct class *vchiq_class; static struct class *vchiq_class;
static DEFINE_SPINLOCK(msg_queue_spinlock);
static struct platform_device *bcm2835_camera; static struct platform_device *bcm2835_camera;
static struct platform_device *bcm2835_audio; static struct platform_device *bcm2835_audio;
...@@ -199,7 +143,7 @@ int vchiq_initialise(struct vchiq_instance **instance_out) ...@@ -199,7 +143,7 @@ int vchiq_initialise(struct vchiq_instance **instance_out)
} }
EXPORT_SYMBOL(vchiq_initialise); EXPORT_SYMBOL(vchiq_initialise);
static void free_bulk_waiter(struct vchiq_instance *instance) void free_bulk_waiter(struct vchiq_instance *instance)
{ {
struct bulk_waiter_node *waiter, *next; struct bulk_waiter_node *waiter, *next;
...@@ -561,7 +505,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -561,7 +505,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
return VCHIQ_SUCCESS; return VCHIQ_SUCCESS;
} }
static enum vchiq_status enum vchiq_status
service_callback(enum vchiq_reason reason, struct vchiq_header *header, service_callback(enum vchiq_reason reason, struct vchiq_header *header,
unsigned int handle, void *bulk_userdata) unsigned int handle, void *bulk_userdata)
{ {
...@@ -2142,7 +2086,7 @@ vchiq_fops = { ...@@ -2142,7 +2086,7 @@ vchiq_fops = {
* *
* Returns 0 on success else returns the error code. * Returns 0 on success else returns the error code.
*/ */
static int vchiq_register_chrdev(struct device *parent) int vchiq_register_chrdev(struct device *parent)
{ {
struct device *vchiq_dev; struct device *vchiq_dev;
int ret; int ret;
...@@ -2201,7 +2145,7 @@ static int vchiq_register_chrdev(struct device *parent) ...@@ -2201,7 +2145,7 @@ static int vchiq_register_chrdev(struct device *parent)
* vchiq_deregister_chrdev - Deregister and cleanup the vchiq char * vchiq_deregister_chrdev - Deregister and cleanup the vchiq char
* driver and device files * driver and device files
*/ */
static void vchiq_deregister_chrdev(void) void vchiq_deregister_chrdev(void)
{ {
device_destroy(vchiq_class, vchiq_devid); device_destroy(vchiq_class, vchiq_devid);
cdev_del(&vchiq_cdev); cdev_del(&vchiq_cdev);
......
...@@ -14,6 +14,12 @@ ...@@ -14,6 +14,12 @@
#include "vchiq_core.h" #include "vchiq_core.h"
#include "vchiq_debugfs.h" #include "vchiq_debugfs.h"
/* Some per-instance constants */
#define MAX_COMPLETIONS 128
#define MAX_SERVICES 64
#define MAX_ELEMENTS 8
#define MSG_QUEUE_SIZE 128
enum USE_TYPE_E { enum USE_TYPE_E {
USE_TYPE_SERVICE, USE_TYPE_SERVICE,
USE_TYPE_VCHIQ USE_TYPE_VCHIQ
...@@ -58,9 +64,63 @@ struct vchiq_drvdata { ...@@ -58,9 +64,63 @@ struct vchiq_drvdata {
struct rpi_firmware *fw; struct rpi_firmware *fw;
}; };
struct user_service {
struct vchiq_service *service;
void __user *userdata;
struct vchiq_instance *instance;
char is_vchi;
char dequeue_pending;
char close_pending;
int message_available_pos;
int msg_insert;
int msg_remove;
struct completion insert_event;
struct completion remove_event;
struct completion close_event;
struct vchiq_header *msg_queue[MSG_QUEUE_SIZE];
};
struct bulk_waiter_node {
struct bulk_waiter bulk_waiter;
int pid;
struct list_head list;
};
struct vchiq_instance {
struct vchiq_state *state;
struct vchiq_completion_data_kernel completions[MAX_COMPLETIONS];
int completion_insert;
int completion_remove;
struct completion insert_event;
struct completion remove_event;
struct mutex completion_mutex;
int connected;
int closing;
int pid;
int mark;
int use_close_delivered;
int trace;
struct list_head bulk_waiter_list;
struct mutex bulk_waiter_list_mutex;
struct vchiq_debugfs_node debugfs_node;
};
struct dump_context {
char __user *buf;
size_t actual;
size_t space;
loff_t offset;
};
extern int vchiq_arm_log_level; extern int vchiq_arm_log_level;
extern int vchiq_susp_log_level; extern int vchiq_susp_log_level;
extern spinlock_t msg_queue_spinlock;
extern struct vchiq_state g_state;
int vchiq_platform_init(struct platform_device *pdev, int vchiq_platform_init(struct platform_device *pdev,
struct vchiq_state *state); struct vchiq_state *state);
...@@ -114,4 +174,17 @@ vchiq_instance_get_trace(struct vchiq_instance *instance); ...@@ -114,4 +174,17 @@ vchiq_instance_get_trace(struct vchiq_instance *instance);
extern void extern void
vchiq_instance_set_trace(struct vchiq_instance *instance, int trace); vchiq_instance_set_trace(struct vchiq_instance *instance, int trace);
extern void
vchiq_deregister_chrdev(void);
extern int
vchiq_register_chrdev(struct device *parent);
extern enum vchiq_status
service_callback(enum vchiq_reason reason, struct vchiq_header *header,
unsigned int handle, void *bulk_userdata);
extern void
free_bulk_waiter(struct vchiq_instance *instance);
#endif /* VCHIQ_ARM_H */ #endif /* VCHIQ_ARM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment