Re: [PATCH] staging: goldfish: Retire a mutable global variable

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

 



On Fri, Jul 13, 2018 at 02:11:11PM -0700, rkir@xxxxxxxxxx wrote:
> From: Roman Kiryanov <rkir@xxxxxxxxxx>
> 
> goldfish_audio_device does not have to be global.
> 
> Signed-off-by: Roman Kiryanov <rkir@xxxxxxxxxx>
> ---
>  drivers/staging/goldfish/goldfish_audio.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/goldfish/goldfish_audio.c b/drivers/staging/goldfish/goldfish_audio.c
> index 3a75df1d2a0a..0492ba3e9174 100644
> --- a/drivers/staging/goldfish/goldfish_audio.c
> +++ b/drivers/staging/goldfish/goldfish_audio.c
> @@ -36,6 +36,8 @@ MODULE_LICENSE("GPL");
>  MODULE_VERSION("1.0");
>  
>  struct goldfish_audio {
> +	struct miscdevice miscdevice;

Odd.  misc devices are normally static to the file, you only need one of
them, right?  Do you really have more than one audio device in the
system at a time?

When you do this, you end up with crazy stuff like:

> -static struct miscdevice goldfish_audio_device = {
> -	.minor = MISC_DYNAMIC_MINOR,
> -	.name = "eac",
> -	.fops = &goldfish_audio_fops,
> +/* init miscdevice initial state to use with misc_register */
> +static void init_miscdevice(struct miscdevice *misc)
> +{
> +	misc->minor = MISC_DYNAMIC_MINOR;
> +	misc->name = "eac";
> +	misc->fops = &goldfish_audio_fops;
>  };

that.  Which is sad (also are you sure the other fields are set to 0?  I
didn't look at the whole code path here.

What benifit is there to do this change?

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