Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751991AbdCHKQB (ORCPT ); Wed, 8 Mar 2017 05:16:01 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:36786 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750783AbdCHKP6 (ORCPT ); Wed, 8 Mar 2017 05:15:58 -0500 Date: Wed, 8 Mar 2017 18:08:09 +0800 From: Cheah Kok Cheong To: Dan Carpenter Cc: abbotti@mev.co.uk, hsweeten@visionengravers.com, gregkh@linuxfoundation.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files" Message-ID: <20170308100809.GB2496@linux-Precision-WorkStation-T5500> References: <20170307195149.GA10722@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170307195149.GA10722@mwanda> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1589 Lines: 48 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. 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. Thanks. Brgds, CheahKC > regards, > dan carpenter >