Re: [PATCH] synclink_gt use dynamic tty device registration

From: Paul Fulghum
Date: Thu May 03 2007 - 11:02:14 EST


On Thu, 2007-05-03 at 00:05 -0700, Andrew Morton wrote:
> On Wed, 02 May 2007 11:17:33 -0500 Paul Fulghum <paulkf@xxxxxxxxxxxxx> wrote:
>
> > Change synclink_gt driver to use dynamic tty device registration.
> >
> > ...
> >
> > + for (i=0; i < port_count; ++i)
> > + tty_register_device(serial_driver, port_array[i]->line, &(port_array[i]->pdev->dev));
> > ...
> > + for (info=slgt_device_list ; info != NULL ; info=info->next_device)
> > + tty_unregister_device(serial_driver, info->line);
> > ...
> > + if ((rc = pci_register_driver(&pci_driver)) < 0) {
>
> hm, not a big fan of kernel coding style, I see.

It varies. If this idiom bothers you, I can split it into 2 lines.

> What's going to happen here if tty_register_device() fails?

Then the device will not be accessible as a tty device.
It may still be accessible as a network device.
On driver unload, tty_unregister_device() does nothing because
the device was never created.

In this case, tracking the return value does not change anything.
I could add a printk on error to better inform the user that the
kernel's plumbing went south.

--
Paul Fulghum
Microgate Systems, Ltd

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/