Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sun, 23 Mar 2003 03:09:10 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sun, 23 Mar 2003 03:09:10 -0500 Received: from 12-231-249-244.client.attbi.com ([12.231.249.244]:64779 "HELO kroah.com") by vger.kernel.org with SMTP id ; Sun, 23 Mar 2003 03:09:08 -0500 Date: Sun, 23 Mar 2003 00:19:56 -0800 From: Greg KH To: Roman Zippel Cc: Andries.Brouwer@cwi.nl, linux-kernel@vger.kernel.org, akpm@digeo.com Subject: Re: [PATCH] alternative dev patch Message-ID: <20030323081956.GK26145@kroah.com> References: <20030321012455.GB10298@kroah.com> <20030322013800.GD18835@kroah.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1740 Lines: 45 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 - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/