Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Ojaswin Mujoo <ojaswin98@gmail.com>
Link: https://lore.kernel.org/r/8abcbd9fb3227e2a78ccc4a1186c8c0801061a68.1626882325.git.ojaswin98@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ojaswin Mujoo and committed by
Greg Kroah-Hartman
c405028f 2a4d15a4

+79 -62
+6 -62
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
··· 38 38 #undef MODULE_PARAM_PREFIX 39 39 #define MODULE_PARAM_PREFIX DEVICE_NAME "." 40 40 41 - /* Some per-instance constants */ 42 - #define MAX_COMPLETIONS 128 43 - #define MAX_SERVICES 64 44 - #define MAX_ELEMENTS 8 45 - #define MSG_QUEUE_SIZE 128 46 - 47 41 #define KEEPALIVE_VER 1 48 42 #define KEEPALIVE_VER_MIN KEEPALIVE_VER 49 43 ··· 45 51 int vchiq_arm_log_level = VCHIQ_LOG_DEFAULT; 46 52 int vchiq_susp_log_level = VCHIQ_LOG_ERROR; 47 53 48 - struct user_service { 49 - struct vchiq_service *service; 50 - void __user *userdata; 51 - struct vchiq_instance *instance; 52 - char is_vchi; 53 - char dequeue_pending; 54 - char close_pending; 55 - int message_available_pos; 56 - int msg_insert; 57 - int msg_remove; 58 - struct completion insert_event; 59 - struct completion remove_event; 60 - struct completion close_event; 61 - struct vchiq_header *msg_queue[MSG_QUEUE_SIZE]; 62 - }; 63 - 64 - struct bulk_waiter_node { 65 - struct bulk_waiter bulk_waiter; 66 - int pid; 67 - struct list_head list; 68 - }; 69 - 70 - struct vchiq_instance { 71 - struct vchiq_state *state; 72 - struct vchiq_completion_data_kernel completions[MAX_COMPLETIONS]; 73 - int completion_insert; 74 - int completion_remove; 75 - struct completion insert_event; 76 - struct completion remove_event; 77 - struct mutex completion_mutex; 78 - 79 - int connected; 80 - int closing; 81 - int pid; 82 - int mark; 83 - int use_close_delivered; 84 - int trace; 85 - 86 - struct list_head bulk_waiter_list; 87 - struct mutex bulk_waiter_list_mutex; 88 - 89 - struct vchiq_debugfs_node debugfs_node; 90 - }; 91 - 92 - struct dump_context { 93 - char __user *buf; 94 - size_t actual; 95 - size_t space; 96 - loff_t offset; 97 - }; 54 + DEFINE_SPINLOCK(msg_queue_spinlock); 55 + struct vchiq_state g_state; 98 56 99 57 static struct cdev vchiq_cdev; 100 58 static dev_t vchiq_devid; 101 - static struct vchiq_state g_state; 102 59 static struct class *vchiq_class; 103 - static DEFINE_SPINLOCK(msg_queue_spinlock); 104 60 static struct platform_device *bcm2835_camera; 105 61 static struct platform_device *bcm2835_audio; 106 62 ··· 143 199 } 144 200 EXPORT_SYMBOL(vchiq_initialise); 145 201 146 - static void free_bulk_waiter(struct vchiq_instance *instance) 202 + void free_bulk_waiter(struct vchiq_instance *instance) 147 203 { 148 204 struct bulk_waiter_node *waiter, *next; 149 205 ··· 505 561 return VCHIQ_SUCCESS; 506 562 } 507 563 508 - static enum vchiq_status 564 + enum vchiq_status 509 565 service_callback(enum vchiq_reason reason, struct vchiq_header *header, 510 566 unsigned int handle, void *bulk_userdata) 511 567 { ··· 2086 2142 * 2087 2143 * Returns 0 on success else returns the error code. 2088 2144 */ 2089 - static int vchiq_register_chrdev(struct device *parent) 2145 + int vchiq_register_chrdev(struct device *parent) 2090 2146 { 2091 2147 struct device *vchiq_dev; 2092 2148 int ret; ··· 2145 2201 * vchiq_deregister_chrdev - Deregister and cleanup the vchiq char 2146 2202 * driver and device files 2147 2203 */ 2148 - static void vchiq_deregister_chrdev(void) 2204 + void vchiq_deregister_chrdev(void) 2149 2205 { 2150 2206 device_destroy(vchiq_class, vchiq_devid); 2151 2207 cdev_del(&vchiq_cdev);
+73
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h
··· 14 14 #include "vchiq_core.h" 15 15 #include "vchiq_debugfs.h" 16 16 17 + /* Some per-instance constants */ 18 + #define MAX_COMPLETIONS 128 19 + #define MAX_SERVICES 64 20 + #define MAX_ELEMENTS 8 21 + #define MSG_QUEUE_SIZE 128 22 + 17 23 enum USE_TYPE_E { 18 24 USE_TYPE_SERVICE, 19 25 USE_TYPE_VCHIQ ··· 64 58 struct rpi_firmware *fw; 65 59 }; 66 60 61 + struct user_service { 62 + struct vchiq_service *service; 63 + void __user *userdata; 64 + struct vchiq_instance *instance; 65 + char is_vchi; 66 + char dequeue_pending; 67 + char close_pending; 68 + int message_available_pos; 69 + int msg_insert; 70 + int msg_remove; 71 + struct completion insert_event; 72 + struct completion remove_event; 73 + struct completion close_event; 74 + struct vchiq_header *msg_queue[MSG_QUEUE_SIZE]; 75 + }; 76 + 77 + struct bulk_waiter_node { 78 + struct bulk_waiter bulk_waiter; 79 + int pid; 80 + struct list_head list; 81 + }; 82 + 83 + struct vchiq_instance { 84 + struct vchiq_state *state; 85 + struct vchiq_completion_data_kernel completions[MAX_COMPLETIONS]; 86 + int completion_insert; 87 + int completion_remove; 88 + struct completion insert_event; 89 + struct completion remove_event; 90 + struct mutex completion_mutex; 91 + 92 + int connected; 93 + int closing; 94 + int pid; 95 + int mark; 96 + int use_close_delivered; 97 + int trace; 98 + 99 + struct list_head bulk_waiter_list; 100 + struct mutex bulk_waiter_list_mutex; 101 + 102 + struct vchiq_debugfs_node debugfs_node; 103 + }; 104 + 105 + struct dump_context { 106 + char __user *buf; 107 + size_t actual; 108 + size_t space; 109 + loff_t offset; 110 + }; 111 + 67 112 extern int vchiq_arm_log_level; 68 113 extern int vchiq_susp_log_level; 114 + 115 + extern spinlock_t msg_queue_spinlock; 116 + extern struct vchiq_state g_state; 69 117 70 118 int vchiq_platform_init(struct platform_device *pdev, 71 119 struct vchiq_state *state); ··· 173 113 174 114 extern void 175 115 vchiq_instance_set_trace(struct vchiq_instance *instance, int trace); 116 + 117 + extern void 118 + vchiq_deregister_chrdev(void); 119 + 120 + extern int 121 + vchiq_register_chrdev(struct device *parent); 122 + 123 + extern enum vchiq_status 124 + service_callback(enum vchiq_reason reason, struct vchiq_header *header, 125 + unsigned int handle, void *bulk_userdata); 126 + 127 + extern void 128 + free_bulk_waiter(struct vchiq_instance *instance); 176 129 177 130 #endif /* VCHIQ_ARM_H */