mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Andries.Brouwer@cwi.nl, linux-kernel@vger.kernel.org, akpm@digeo.com
Subject: Re: [PATCH] alternative dev patch
Date: Sun, 23 Mar 2003 00:19:56 -0800	[thread overview]
Message-ID: <20030323081956.GK26145@kroah.com> (raw)
In-Reply-To: <Pine.LNX.4.44.0303221306350.5042-100000@serv>

On Sat, Mar 22, 2003 at 02:02:00PM +0100, Roman Zippel wrote:
> > So only tty drivers currently do this.  But that might just be because
> > it's pretty hard to get a range of minors right now, as the api hasn't
> > been present.  Once we expand the range, I bet it will get quite common
> > (most character drivers only want from 1-16 minors normally.)
> 
> There are a few options:
> 1. Drivers can implement that themselves:

Yeah, but as I know, it's a big pain in the butt.  Let's make it easy to
do this, don't make writing a driver tougher than it has to be (it's
already much harder than it used to be.)  Andries's patch makes it easy,
which is a good thing in my book.

> a) The driver allocates the major itself and opens the real minor device 
> in its open function, (e.g. see the misc driver example). Especially tape 
> drivers have to do this anyway, because they encoded the open mode in 
> higher bits, so regions won't help you here at all.
> b) The driver allocates the major itself and installs the file_operations 
> directly in the char_device, e.g. that is something you might want to do 
> in the usb driver:
> 
> register_usb_device(...)
> {
> 	...
> 	cdev = cdget(dev);
> 	down(&cdev->sem);
> 	if (cdev->fops)
> 		...;
> 	cdev->fops = fops;
> 	up(&cdev->sem);
> }
> (see the misc driver again for a detailed example.)

Look at drivers/usb/core/file.c::usb_open(), it does much the same
thing.  Well, functionally the same, not identical in any way :)

thanks,

greg k-h

  reply	other threads:[~2003-03-23  8:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-20 21:50 Andries.Brouwer
2003-03-20 23:03 ` Roman Zippel
2003-03-21  1:24   ` Greg KH
2003-03-21  9:08     ` Roman Zippel
2003-03-22  1:38       ` Greg KH
2003-03-22 13:02         ` Roman Zippel
2003-03-23  8:19           ` Greg KH [this message]
2003-03-23  8:30             ` Christoph Hellwig
2003-03-23 15:05             ` Roman Zippel
2003-03-23 16:32               ` Christoph Hellwig
2003-03-23  8:50     ` Christoph Hellwig
2003-03-23  8:46   ` Christoph Hellwig
2003-03-23 15:11     ` Roman Zippel
  -- strict thread matches above, loose matches on Subject: below --
2003-03-20  0:57 Roman Zippel
2003-03-20 20:40 ` Roman Zippel

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=20030323081956.GK26145@kroah.com \
    --to=greg@kroah.com \
    --cc=Andries.Brouwer@cwi.nl \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=zippel@linux-m68k.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®