Re: [PATCH v2 01/33] staging: vc04_services: Remove DUMP_CONTEXT_T typedef

2018-12-17 Thread Greg Kroah-Hartman
On Fri, Dec 14, 2018 at 01:04:38PM +0100, Dominic Braun wrote:
> Typedefing structs is not encouraged in the kernel.
> 
> Signed-off-by: Dominic Braun 
> Signed-off-by: Tobias Büttner 
> ---
>  .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
> b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 2833f93bbc74..fa15033daf5f 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -154,12 +154,12 @@ struct vchiq_instance_struct {
>   VCHIQ_DEBUGFS_NODE_T debugfs_node;
>  };
>  
> -typedef struct dump_context_struct {
> +struct dump_context {
>   char __user *buf;
>   size_t actual;
>   size_t space;
>   loff_t offset;
> -} DUMP_CONTEXT_T;
> +};
>  
>  static struct cdevvchiq_cdev;
>  static dev_t  vchiq_devid;
> @@ -2113,7 +2113,7 @@ static int vchiq_release(struct inode *inode, struct 
> file *file)
>  void
>  vchiq_dump(void *dump_context, const char *str, int len)
>  {
> - DUMP_CONTEXT_T *context = (DUMP_CONTEXT_T *)dump_context;
> + struct dump_context *context = (struct dump_context *)dump_context;

Stuff to clean up in the future.  No need to cast this, in fact, the
function should be taking a real 'struct dump_context' pointer here, and
everywhere else up the call chain as it all trickles down to this
structure:

>  vchiq_read(struct file *file, char __user *buf,
>   size_t count, loff_t *ppos)
>  {
> - DUMP_CONTEXT_T context;
> + struct dump_context context;

which is the correct type, so no casting or void * messing with needed
anywhere.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 01/33] staging: vc04_services: Remove DUMP_CONTEXT_T typedef

2018-12-14 Thread Dominic Braun
Typedefing structs is not encouraged in the kernel.

Signed-off-by: Dominic Braun 
Signed-off-by: Tobias Büttner 
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c 
b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 2833f93bbc74..fa15033daf5f 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -154,12 +154,12 @@ struct vchiq_instance_struct {
VCHIQ_DEBUGFS_NODE_T debugfs_node;
 };
 
-typedef struct dump_context_struct {
+struct dump_context {
char __user *buf;
size_t actual;
size_t space;
loff_t offset;
-} DUMP_CONTEXT_T;
+};
 
 static struct cdevvchiq_cdev;
 static dev_t  vchiq_devid;
@@ -2113,7 +2113,7 @@ static int vchiq_release(struct inode *inode, struct file 
*file)
 void
 vchiq_dump(void *dump_context, const char *str, int len)
 {
-   DUMP_CONTEXT_T *context = (DUMP_CONTEXT_T *)dump_context;
+   struct dump_context *context = (struct dump_context *)dump_context;
 
if (context->actual < context->space) {
int copy_bytes;
@@ -2241,7 +2241,7 @@ static ssize_t
 vchiq_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
 {
-   DUMP_CONTEXT_T context;
+   struct dump_context context;
 
context.buf = buf;
context.actual = 0;
-- 
2.17.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel