Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753694AbdCHPme (ORCPT ); Wed, 8 Mar 2017 10:42:34 -0500 Received: from smtprelay0014.hostedemail.com ([216.40.44.14]:36182 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751639AbdCHPmc (ORCPT ); Wed, 8 Mar 2017 10:42:32 -0500 X-Session-Marker: 69616E406162626F74742E6F7267 X-Spam-Summary: 50,0,0,,d41d8cd98f00b204,abbotti@mev.co.uk,:::::::::,RULES_HIT:41:355:379:560:599:800:960:967:973:982: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:2560:2563:2612:2682:2685:2693:2859:2933:2937:2939:2942:2945:2947:2951:2954:3000:3022:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4605:5007:7514:7652:9025:10004:10400:10848:11026:11232:11473:11658:11914:12043:12048:12296:12438:12740:12760:12895:13095:13255:14093:14096:14097:14181:14571:14685:14721:14819:21080:21433:21451:30021:30034:30054,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: crown35_57adb00046800 X-Filterd-Recvd-Size: 3484 Subject: Re: [PATCH v2 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files" To: Cheah Kok Cheong , hsweeten@visionengravers.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org References: <39526ad9c3b52a23acfe4cbe39472847f19ba456.1488908538.git.thrust73@gmail.com> Cc: linux-kernel@vger.kernel.org From: Ian Abbott Message-ID: Date: Wed, 8 Mar 2017 12:36:41 +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: <39526ad9c3b52a23acfe4cbe39472847f19ba456.1488908538.git.thrust73@gmail.com> 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: 2370 Lines: 52 On 07/03/17 18:13, 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 at auto-configuration. If there's no fall back in > place then module loading will fail. > > In this case, a default to auto-configure comedi_test module failed > to auto-configure with the following messages. It loaded but fell back > to unconfigured mode. > > comedi_test comedi_testd: ran out of minor numbers for board device files > comedi_test comedi_testd: driver 'comedi_test' could not create device. > comedi_test: unable to auto-configure device > > This is due to changes in commit 38b9722a4414 > ("staging: comedi: avoid releasing legacy minors automatically") which > will not allocate a minor number when comedi_num_legacy_minors equals > COMEDI_NUM_BOARD_MINORS. COMEDI_NUM_BOARD_MINORS is defined to be > 0x30 which is 48. Sorry, I don't consider this to be a bug. The number of minor device numbers available for auto-configured devices is 48 minus comedi_num_legacy_minors. Using up all available minor device numbers is a useful test case for running out of minor device numbers, although this relies on knowing the limit is 48. Perhaps the description of the module parameter could be improved to mention the limits, as could the error message when running out of minor device numbers. Commit 38b9722a4414 is irrelevant here. Prior to that commit, the first 'comedi_num_legacy_minors' minor numbers were still allocated to legacy devices created during module initialization, leaving 48 minus comedi_num_legacy_minors minors (possibly none) available for auto-configured devices. > This goes for a simple fix which limit comedi_num_legacy_minors to 47 > instead of tinkering with comedi_alloc_board_minor() and > comedi_release_hardware_device(). > > Fix: commit 38b9722a4414 ("staging: comedi: avoid releasing legacy minors > automatically") > > Signed-off-by: Cheah Kok Cheong > --- > > V2: > -Amend commit log to specify that comedi_test module failed > to auto-configure and fell back to unconfigured mode. > For other devices with no fall back, module loading will fail. -- -=( Ian Abbott @ MEV Ltd. E-mail: )=- -=( Web: http://www.mev.co.uk/ )=-