Re: [PATCH] drivers/staging: refactor dgnc tty registration.

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

 



On Sun, May 14, 2017 at 06:50:24PM +0300, Haim Daniel wrote:
> @@ -129,6 +113,41 @@ static void dgnc_tty_set_termios(struct tty_struct *tty,
>  
>  /* TTY Initialization/Cleanup Functions */
>  
> +static struct tty_driver *__dgnc_tty_register(char *serial_name, uint maxports,

No need for double underscores.

> +					      int major, int minor)
> +{
> +	int rc;
> +	struct tty_driver *drv = tty_alloc_driver(maxports,
> +						  TTY_DRIVER_REAL_RAW |
> +						  TTY_DRIVER_DYNAMIC_DEV |
> +						  TTY_DRIVER_HARDWARE_BREAK);
> +	if (IS_ERR(drv))
> +		return drv;

Blank line between declaration and code.  Do it like this:

	struct tty_driver *drv;
	int rc;

	drv = tty_alloc_driver(maxports, TTY_DRIVER_REAL_RAW |
				         TTY_DRIVER_DYNAMIC_DEV |
					 TTY_DRIVER_HARDWARE_BREAK);
	if (IS_ERR(drv))
		return drv;


Also create a matching dgnc_tty_unregister function that does:

static void dgnc_tty_unregister(struct tty_driver *drv)
{
	tty_unregister_driver(drv);
	put_tty_driver(drv);
}

regards,
dan carpenter
_______________________________________________
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