Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752623AbdCHLQY (ORCPT ); Wed, 8 Mar 2017 06:16:24 -0500 Received: from smtprelay0176.hostedemail.com ([216.40.44.176]:37743 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751610AbdCHLQX (ORCPT ); Wed, 8 Mar 2017 06:16:23 -0500 X-Session-Marker: 69616E406162626F74742E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,abbotti@mev.co.uk,:::::::::::,RULES_HIT:41:355:379:421:560:599:800:960:967:969:973:988:989:1260:1261:1263:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1534:1542:1593:1594:1683:1711:1730:1747:1777:1792:1801:2393:2525:2553:2560:2563:2612:2682:2685:2693:2859:2933:2937:2939:2942:2945:2947:2951:2954:3000:3022:3138:3139:3140:3141:3142:3355:3865:3866:3867:3868:3870:3871:3873:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4361:4605:5007:6119:7652:7903:9025:9036:10004:10400:10848:11026:11232:11658:11914:12043:12296:12438:12740:12760:12895:13161:13229:13255:14096:14097:14181:14571:14685:14721:21080:21451:30021:30034:30051:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: son25_5bbabf7632d0b X-Filterd-Recvd-Size: 3792 Subject: Re: [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files" To: Cheah Kok Cheong , Dan Carpenter References: <20170307195149.GA10722@mwanda> <20170308100809.GB2496@linux-Precision-WorkStation-T5500> Cc: hsweeten@visionengravers.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org From: Ian Abbott Message-ID: Date: Wed, 8 Mar 2017 11:13:49 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170308100809.GB2496@linux-Precision-WorkStation-T5500> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2546 Lines: 68 On 08/03/17 10:08, Cheah Kok Cheong wrote: > Dear Dan, > Thanks for reviewing this patch. > > On Wed, Mar 08, 2017 at 08:54:47AM +0300, Dan Carpenter wrote: >> On Sun, Mar 05, 2017 at 03:22:33AM +0800, Cheah Kok Cheong wrote: >>> If comedi module is loaded with the following max allowed parameter >>> [comedi_num_legacy_minors=48], subsequent loading of an auto-configured >>> device will fail. >> >> Don't set comedi_num_legacy_minors=48, then? >> >> This doesn't seem like the right fix at all. Why only allow one auto >> configured board? Why not 5 or 10? >> > > Let me explain, the original intended behaviour is to allow user to > reserve up to 48 minor numbers for legacy devices. > > Therefore [sudo modprobe comedi comedi_num_legacy_minors=3] > will allocate minor number 0, 1, 2 for legacy devices. > Subsequent loading of an auto-configured device will use minor number 3. > And the next one number 4 so on and so forth. > > Now for the corner case of [comedi_num_legacy_minors=48] which > is supposed to reserve minor number 0 till 47 for legacy devices, > and is supposed to allocate number 48 and so on for auto-configured > devices, does not allocate number 48 anymore after commit > 38b9722a4414. Both legacy and auto-configured devices will have minor numbers less than 48, which is the total number of devices currently supported by Comedi. Minor numbers 48 and above have been reserved for dynamic allocation to those Comedi subdevices that support asynchronous commands. > This is due to the changes in comedi_alloc_board_minor(). > > As to why I chose to limit [comedi_num_legacy_minors=47], is given > in the commit log. > > This will allow user to allocate 0 till 46 for legacy devices and > subsequent auto-configured devices will start from 47 and so forth. > > I don't think anybody will miss one less number for legacy devices > otherwise there'll be complains earlier on. As Dan implies above, if you want auto-configured devices to work, set comedi_num_legacy_minors to a value less than 48. Further limiting comedi_num_legacy_minors to 47 seems a bit arbitrary. The comedi_test module mentioned in your commit can still be used when comedi_num_legacy_minors=48 by configuring a "legacy" comedi_test device. Most of the other Comedi drivers support "legacy" devices exclusive-or auto-configured devices. > Thanks. > > Brgds, > CheahKC > >> regards, >> dan carpenter >> -- -=( Ian Abbott @ MEV Ltd. E-mail: )=- -=( Web: http://www.mev.co.uk/ )=-