Am Donnerstag, 25. April 2002 08:00 schrieb Greg KH:
> Hi all,
>
> Here's a patch that finishes off my previous patch that enabled us to
> use less than 16 minor numbers per USB device that uses the USB major
> number. This patch allows all such devices to share all 256 minor
> numbers at once, much like the usbserial core shares the USB serial
> major with all usb-serial drivers. This also solves Oliver's problem of
> having 30 printers :)
I once did a dial-in server and had to figure out how to put the
maximal number of ISDN ports into one box. It sharpens your eyes
for such problems.
> Right now there isn't a "simple" way for userspace to realize what minor
> is assigned to each device, but I will work on that tomorrow, as it's
> late (hint, /sbin/hotplug will be involved :)
This is no good. You come to a system of extreme brittleness this way.
There's no way to resynchronise. You need a way to query all
assigned minors at any time from any application from the kernel.
> This patch is against 2.5.10.
>
> Comments?
Oh yes.
> diff -Nru a/drivers/usb/image/scanner.c b/drivers/usb/image/scanner.c
> --- a/drivers/usb/image/scanner.c Thu Apr 25 00:01:15 2002
> +++ b/drivers/usb/image/scanner.c Thu Apr 25 00:01:15 2002
> @@ -953,9 +953,11 @@
>
> down(&scn_mutex);
>
> - for (scn_minor = 0; scn_minor < SCN_MAX_MNR; scn_minor++) {
> - if (!p_scn_table[scn_minor])
> - break;
> + if (usb_register_dev(&scanner_driver, 1, &scn_minor)) {
> + for (scn_minor = 0; scn_minor < SCN_MAX_MNR; scn_minor++) {
> + if (!p_scn_table[scn_minor])
> + break;
> + }
> }
What is this supposed to do ?
If you have freeable minors, free them.
Hoarding minors is sociopathic behaviour.
> @@ -642,8 +649,11 @@
> minor = dev->minor;
>
> /* remove our devfs node */
> - devfs_unregister(dev->devfs);
> + devfs_unregister (dev->devfs);
>
> + /* give back our dynamic minor */
> + usb_deregister_dev (&skel_driver, 1, minor);
> +
> /* if the device is not opened, then we clean up right now */
> if (!dev->open_count) {
> up (&dev->sem);
You are redefining the meaning of a minor while somebody
can still have the file open. Is this safe ?
Furthermore, you have no locking at all for the minors' array.
There's a race.
Last, but not least, this looks like an attempt to do a one off
solution to a common problem. In other words, your are frantic to
avoid devfs.
Regards
Oliver
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel