Re: [PATCH] drivers/staging: refactor dgnc tty registration.
From: Dan Carpenter
Date: Mon May 15 2017 - 04:44:28 EST
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