All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Greg KH <gregkh@suse.de>, Arnd Bergmann <arnd@arndb.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Scott Wood <scottwood@freescale.com>,
	Stuart Yoder <stuart.yoder@freescale.com>
Subject: Re: How do I choose an arbitrary minor number for my tty device?
Date: Tue, 23 Nov 2010 11:14:16 -0600	[thread overview]
Message-ID: <4CEBF668.2080708@freescale.com> (raw)
In-Reply-To: <20101123135621.5d100e81@lxorguk.ukuu.org.uk>

Alan Cox wrote:
> Your console driver provides a device method (see kernel/printk.c).
> When /dev/console is opened the kernel iterates the console list looking
> for one with ->device and then calls that method. On success it expects
> the passed int * to contain the minor number to use.

Are you talking about this:

static struct tty_driver *ehv_bc_console_device(struct console *co, int *index)
{
	*index = co->index;

	return ehv_bc_driver;
}

I never really understood this function, but almost everyone does the same
thing, and it seems to work for me.  Looking at console_device(), it appears
that all of the xxx_console_device functions are called in order until one of
them returns non-NULL.

How is this related to add_preferred_console()?  When I call this function, I
also specify the same index and the name from the struct console device:

static struct console ehv_bc_console = {
	.name		= "ttyEHV",
	.write		= ehv_bc_console_write,
	.device		= ehv_bc_console_device,
	.flags		= CON_PRINTBUFFER | CON_ENABLED,
};

add_preferred_console(ehv_bc_console.name, ehv_bc_console.index, NULL);
register_console(&ehv_bc_console);

> I suspect in your case you probably want to attach the primary byte
> channel to minor 0 in the driver (and reserve it for that), or some
> similar rule.

Yes, that's a good idea.  It does simplify things a lot.

-- 
Timur Tabi
Linux kernel developer at Freescale


  reply	other threads:[~2010-11-23 17:16 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-17 21:37 How do I choose an arbitrary minor number for my tty device? Timur Tabi
2010-11-17 21:51 ` Greg KH
2010-11-17 22:10   ` Timur Tabi
2010-11-17 22:19     ` Greg KH
2010-11-17 22:42       ` Timur Tabi
2010-11-18  2:24         ` Greg KH
2010-11-18 15:31           ` Timur Tabi
2010-11-18 15:39             ` Greg KH
2010-11-18 16:03               ` Timur Tabi
2010-11-18 16:33                 ` Greg KH
2010-11-18 16:36                   ` Timur Tabi
2010-11-18 16:51                     ` Greg KH
2010-11-18 16:56                       ` Timur Tabi
2010-11-18 17:18                         ` Greg KH
2010-11-18 17:38                           ` Timur Tabi
2010-11-18 17:58                             ` Greg KH
2010-11-18 19:35                               ` Timur Tabi
2010-11-18 20:02                                 ` Greg KH
2010-11-18 20:06                                   ` Timur Tabi
2010-11-18 20:10                                     ` Greg KH
2010-11-18 20:43                                       ` Timur Tabi
2010-11-18 20:56                                         ` Alan Cox
2010-11-22 16:32                                           ` Timur Tabi
2010-11-22 20:12                                             ` Timur Tabi
2010-11-23 13:56                                             ` Alan Cox
2010-11-23 17:14                                               ` Timur Tabi [this message]
2010-11-23 23:03                                                 ` Alan Cox
2010-11-18 20:58                                 ` Alan Cox
2010-11-18 17:21                 ` Scott Wood
2010-11-18 17:42                   ` Timur Tabi
2010-11-18 17:58                     ` Greg KH
2010-11-18 18:13                     ` Scott Wood
2010-11-24 10:23                       ` Michael Ellerman
2010-11-24 18:08                         ` Scott Wood
2010-11-24 18:23                           ` Greg KH
2010-11-24 22:44                             ` Michael Ellerman
2010-11-29 21:44                               ` Greg KH
2010-11-29 21:51                                 ` Timur Tabi
2010-11-29 22:30                                   ` Greg KH
2010-11-29 22:36                                     ` Timur Tabi
2010-11-30  3:29                                       ` Greg KH
2010-11-30  4:15                                         ` Tabi Timur-B04825
2010-11-30 19:33                                         ` Timur Tabi
2010-12-01  1:00                                           ` Greg KH
2010-12-01  9:54                                             ` Kay Sievers
2010-12-02 16:12                                               ` Timur Tabi
2010-11-24 22:46                           ` Michael Ellerman
2010-11-25  4:10                             ` Grant Likely
2010-11-24 18:13                         ` Scott Wood
2010-11-24 18:13                           ` Scott Wood

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CEBF668.2080708@freescale.com \
    --to=timur@freescale.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arnd@arndb.de \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=scottwood@freescale.com \
    --cc=stuart.yoder@freescale.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.