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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <inf.braun@xxxxxx>
> Signed-off-by: Tobias Büttner <tobias.buettner@xxxxxx>
> ---
>  .../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 cdev    vchiq_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
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux