]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
staging: vc04_services: Replace typedef with struct
authorGargi Sharma <gs051095@gmail.com>
Wed, 15 Mar 2017 16:47:41 +0000 (22:17 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 Mar 2017 02:33:04 +0000 (11:33 +0900)
Using typedef for a structure type and upper case struct names is not
suggested in Linux kernel coding style guidelines. Hence, occurences
of typedefs have been removed and struct names converted to lowercase
in the file. Grep was also used to ensure that all occurence of the
typedefs have been removed. The module compiles without any warnings
or errors.

Script 1:
@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_T":
  coccinelle.T2 = T[:-2].lower();
  print T
else:
  coccinelle.T2=T.lower();

@r2@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

@r3@
type r1.T;
identifier c1.T2;
@@
- T
+ struct T2

Script 2:
@@
typedef VCHIQ_ELEMENT_T;
@@

(
- VCHIQ_ELEMENT_T
+ struct vchiq_element
)

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h

index ff96e71cfa8be4dab8c0a2690e40e4e27f2a2b5d..e6f8aebbbb6c292615fd2ce85ad220cb9a4e4c94 100644 (file)
@@ -413,7 +413,7 @@ static void close_delivered(USER_SERVICE_T *user_service)
 }
 
 struct vchiq_io_copy_callback_context {
-       VCHIQ_ELEMENT_T *current_element;
+       struct vchiq_element *current_element;
        size_t current_element_offset;
        unsigned long elements_to_go;
        size_t current_offset;
@@ -490,7 +490,7 @@ vchiq_ioc_copy_element_data(
  **************************************************************************/
 static VCHIQ_STATUS_T
 vchiq_ioc_queue_message(VCHIQ_SERVICE_HANDLE_T handle,
-                       VCHIQ_ELEMENT_T *elements,
+                       struct vchiq_element *elements,
                        unsigned long count)
 {
        struct vchiq_io_copy_callback_context context;
@@ -761,10 +761,10 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
                if ((service != NULL) && (args.count <= MAX_ELEMENTS)) {
                        /* Copy elements into kernel space */
-                       VCHIQ_ELEMENT_T elements[MAX_ELEMENTS];
+                       struct vchiq_element elements[MAX_ELEMENTS];
 
                        if (copy_from_user(elements, args.elements,
-                               args.count * sizeof(VCHIQ_ELEMENT_T)) == 0)
+                               args.count * sizeof(struct vchiq_element)) == 0)
                                status = vchiq_ioc_queue_message
                                        (args.handle,
                                        elements, args.count);
@@ -1323,7 +1323,7 @@ vchiq_compat_ioctl_queue_message(struct file *file,
                                 unsigned long arg)
 {
        VCHIQ_QUEUE_MESSAGE_T *args;
-       VCHIQ_ELEMENT_T *elements;
+       struct vchiq_element *elements;
        struct vchiq_queue_message32 args32;
        unsigned int count;
 
@@ -1349,7 +1349,7 @@ vchiq_compat_ioctl_queue_message(struct file *file,
        if (args32.elements && args32.count) {
                struct vchiq_element32 tempelement32[MAX_ELEMENTS];
 
-               elements = (VCHIQ_ELEMENT_T __user *)(args + 1);
+               elements = (struct vchiq_element __user *)(args + 1);
 
                if (copy_from_user(&tempelement32,
                                   compat_ptr(args32.elements),
index 377e8e48bb540465b34f2d4697504cb188d83e3b..0e270852900d87a2800b2f508cb0591c2c08b107 100644 (file)
@@ -88,10 +88,10 @@ typedef struct vchiq_header_struct {
        char data[0];           /* message */
 } VCHIQ_HEADER_T;
 
-typedef struct {
+struct vchiq_element {
        const void *data;
        unsigned int size;
-} VCHIQ_ELEMENT_T;
+};
 
 typedef unsigned int VCHIQ_SERVICE_HANDLE_T;
 
index 6137ae9de1c19cb0ffc486dc60505061a10aea6c..9f859953f45cecdb4bd8888da95be0e9a051fabe 100644 (file)
@@ -50,7 +50,7 @@ typedef struct {
 typedef struct {
        unsigned int handle;
        unsigned int count;
-       const VCHIQ_ELEMENT_T *elements;
+       const struct vchiq_element *elements;
 } VCHIQ_QUEUE_MESSAGE_T;
 
 typedef struct {