From: Cheah Kok Cheong <thrust73@gmail.com>
To: abbotti@mev.co.uk, hsweeten@visionengravers.com,
gregkh@linuxfoundation.org, devel@driverdev.osuosl.org
Cc: linux-kernel@vger.kernel.org, Cheah Kok Cheong <thrust73@gmail.com>
Subject: [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files"
Date: Sun, 5 Mar 2017 03:22:33 +0800 [thread overview]
Message-ID: <b96cfe8f8b63ff70d8bc3c34bff24ea0fbfc191d.1488654618.git.thrust73@gmail.com> (raw)
In-Reply-To: <cd5f3e9f6320ac0063e61f0d0457e5400091390c.1488654618.git.thrust73@gmail.com>
In-Reply-To: <cd5f3e9f6320ac0063e61f0d0457e5400091390c.1488654618.git.thrust73@gmail.com>
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.
In this case a default to auto-configuration comedi_test module failed
to load with the following messages.
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.
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 <thrust73@gmail.com>
---
drivers/staging/comedi/comedi_fops.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/comedi/comedi_fops.c b/drivers/staging/comedi/comedi_fops.c
index 354d264..339854f 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -2857,9 +2857,9 @@ static int __init comedi_init(void)
pr_info("version " COMEDI_RELEASE " - http://www.comedi.org\n");
- if (comedi_num_legacy_minors > COMEDI_NUM_BOARD_MINORS) {
+ if (comedi_num_legacy_minors >= COMEDI_NUM_BOARD_MINORS) {
pr_err("invalid value for module parameter \"comedi_num_legacy_minors\". Valid values are 0 through %i.\n",
- COMEDI_NUM_BOARD_MINORS);
+ COMEDI_NUM_BOARD_MINORS - 1);
return -EINVAL;
}
--
2.7.4
next prev parent reply other threads:[~2017-03-04 19:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-04 19:22 [PATCH 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type Cheah Kok Cheong
2017-03-04 19:22 ` Cheah Kok Cheong [this message]
2017-03-08 5:54 ` [PATCH 2/2] Staging: comedi: comedi_fops: Fix "out of minor numbers for board device files" Dan Carpenter
2017-03-08 10:08 ` Cheah Kok Cheong
2017-03-08 11:13 ` Ian Abbott
2017-03-08 16:59 ` Cheah Kok Cheong
2017-03-07 19:01 ` [PATCH 1/2] Staging: comedi: comedi_fops: Change comedi_num_legacy_minors type Greg KH
2017-03-08 9:38 ` Cheah Kok Cheong
2017-03-08 9:45 ` Greg KH
2017-03-08 10:16 ` Cheah Kok Cheong
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=b96cfe8f8b63ff70d8bc3c34bff24ea0fbfc191d.1488654618.git.thrust73@gmail.com \
--to=thrust73@gmail.com \
--cc=abbotti@mev.co.uk \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.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