* bogus calls of invalidate_buffers() gone from floppy_open()
* invalidate_buffers() killed.
* new helper - __invalidate_device(bdev, do_sync). invalidate_device()
is calling it.
* fixed races between floppy_open()/floppy_open and
floppy_open()/set_geometry():
a) floppy_open()/floppy_release() is done under a semaphore. That
closes the races between simultaneous open() on /dev/fd0foo and /dev/fd0bar.
b) pointer to struct block_device is kept as long as floppy is
opened (per-drive, non-NULL when number of openers is non-zero, does not
contribute to block_device refcount).
c) set_geometry() grabs the same semaphore and invalidates the
devices directly instead of messing with setting fake "it had changed"
and calling __check_disk_change().
Alexander Viro [Thu, 24 Apr 2003 15:38:58 +0000 (08:38 -0700)]
[PATCH] capifs cleanup
capifs switched to ramfs-style tree and cleaned up; it's the same
changes that had been done its prototype (devpts) + stuff needed to
deal with unload (devpts is non-modular and always internally mounted).
Alexander Viro [Thu, 24 Apr 2003 15:38:50 +0000 (08:38 -0700)]
[PATCH] fbdev cleanup
fbdev.node converted from kdev_t to int - all of its users
have register_framebuffer() which sets .node to mk_kdev(FB_MAJOR, index)
already called and all of them start with applying minor(). IOW, what
they actually want is framebuffer number.
* type of ->node changed to int
* register_framebuffer() sets it to index instead of mk_kdev(...)
* users converted from minor(foo.node) to foo.node
* useless assignments (typically to NODEV) removed - we never
look at that field before register_framebuffer() overwrites it and thus
any assignments prior to register_framebuffer() call are dead code.
Alexander Viro [Thu, 24 Apr 2003 15:38:39 +0000 (08:38 -0700)]
[PATCH] console cleanup (2/2)
Console drivers cleanup. In current tree interaction between
console and tty layer sits in the ->device() method of struct console.
It takes a pointer to console and returns device number of its tty
device. open(2) on /dev/console goes through the list of registered
consoles, picks the first one that has ->device() and remaps the device
number to console->device(console). Then it proceeds with normal
opening of tty. This is the only caller of ->device().
Cleanup: let ->device() return a pair (pointer to tty_driver, index
of tty in question) instead of device number. Note that
a) the first thing tty_open() does with remapped device number is
conversion to such pair.
b) console driver _knows_ which tty_driver we want - one that
implements tty interface to the same physical device (i.e. the part of
the same driver).
c) current code expects the result of ->device() to be a device
number of tty device - anything else is immediate -ENODEV from tty_open();
might as well have NULL ->device in that driver.
Console drivers converted, (the only) caller updated.
Return an error code instead of a devfs_handle_t. The handle isn't
useful for anything and the !CONFIG_DEVFS_FS stub in fact returned
NULL which made it entirely useless. Thus only one driver is actually
checking the retval in the current tree..
Alexander Viro [Wed, 23 Apr 2003 11:19:54 +0000 (04:19 -0700)]
[PATCH] tty cleanups (12/12)
* we allow tty_driver to cover more than 256 devices
* pty.c cleaned up - now we only one driver for UNIX98 masters and
only one driver for UNIX98 slaves, so a lot of ugliness can be killed.
* get_tty_driver() became an analog of get_gendisk() - it does
a lookup by device number and gives (pointer to tty_driver,index).
* registration/unregistration of tty_driver updated
* /proc/tty/drivers code updated (now one structure can be responsible
for several lines)
Alexander Viro [Wed, 23 Apr 2003 11:19:46 +0000 (04:19 -0700)]
[PATCH] tty cleanups (11/12)
tty->device switched to dev_t
There are very few uses of tty->device left by now; most of
them actually want dev_t (process accounting, proc/<pid>/stat, several
ioctls, slip.c logics, etc.) and the rest will go away shortly.
Alexander Viro [Wed, 23 Apr 2003 11:19:36 +0000 (04:19 -0700)]
[PATCH] tty cleanups (10/12)
Preparations to cleanup:
* call of get_tty_driver() moved from init_dev() to its callers
* instead of kdev_t dev we pass struct tty_struct *driver and int index
Alexander Viro [Wed, 23 Apr 2003 11:19:27 +0000 (04:19 -0700)]
[PATCH] tty cleanups (9/12)
* drivers/char/rio/* supports up to 4 boards, each with up to 128
lines. It used to share termios for 1st/3rd and 2nd/4th boards, Fixed.
* cleanups and kdev_t removals - we pass tty instead of tty->device
in a couple of helper functions and instead of comparisons on major(tty->device)
we check where does tty->driver point to.
Alexander Viro [Wed, 23 Apr 2003 11:18:59 +0000 (04:18 -0700)]
[PATCH] tty cleanups (6/12)
tty->tty_index added; we initialize it with minor(tty->device) -
tty->driver->minor_start. Majority of remaining tty->device uses had
that form and are switched to use of tty->index.
Alexander Viro [Wed, 23 Apr 2003 11:18:48 +0000 (04:18 -0700)]
[PATCH] tty cleanups (5/12)
new field - tty->tty_name;
initialized to <driver->name><tty index+driver->base_name>
when we allocate tty_struct. Drivers code switched to use of that
beast (in debugging printks, mostly). Large, but trivial.
Alexander Viro [Wed, 23 Apr 2003 11:18:37 +0000 (04:18 -0700)]
[PATCH] tty cleanups (4/12)
Instead of registering "drivers" for /dev/tty, /dev/vc/0, /dev/ptmx
and /dev/console (they are never looked up since tty_open() special-cases
them and they should not be looked up - these devices are remapped on open)
we register corresponding chrdev ranges and devfs nodes directly.
/proc/tty/drivers code updated to keep the contents unchanged
Ben Collins [Wed, 23 Apr 2003 10:50:15 +0000 (03:50 -0700)]
[PATCH] IEEE1394/Firewire updates
- Workaround possible reset loop trying to get IRM sanity
- Logical Unit DIrectory (LUN) support for sbp2(scsi) devices.
- Fix hostnum allocation.
- Whitespace and formatting sync with 2.4 branch.
- Make pcilynx return IRQ_NONE for no interrupts to handle.
Russell King [Wed, 23 Apr 2003 23:04:13 +0000 (00:04 +0100)]
[PCMCIA] Make cb_release_cis_mem() local to cardbus.c
The cardbus CIS parsing code does not use the PCMCIA resource
subsystem, so there isn't any point in freeing its memory when
we remove PCMCIA memory resources. We also free CIS resources
immediately prior to calling cb_free(). We might as well move
the function call into cb_free(), thereby making all references
to cb_release_cis_mem() local to cardbus.c
Russell King [Wed, 23 Apr 2003 22:18:16 +0000 (23:18 +0100)]
[PCMCIA] Don't cache CIS bytes found to be invalid.
Several PCMCIA cards I have here do not work correctly over a
suspend/resume cycle; the PCMCIA code believes that the card has
been changed in the slot, and therefore performs a remove/insert
cycle.
This seems to be because the card returns more or less random data
when reading memory space, leading to the CIS cache mismatching
the card data. This in turn is caused because we try to read CIS
data from both the attribute and memory spaces, and we add the result
to the CIS cache whether or not the returned data was valid.
We therefore convert the CIS cache to use a linked list, and provide
a way to remove cached data from that list. We also replace the
"s->cis_used=0;" construct with a function "destroy_cis_cache(s)"
which clearly describes what we're doing.
Pavel Roskin [Wed, 23 Apr 2003 21:59:33 +0000 (22:59 +0100)]
[PCMCIA] Fix oops in validate_mem when CONFIG_PCMCIA_PROBE=n
If I compile a recent 2.5.x kernel without CONFIG_ISA defined, I get
an oops in validate_mem(). Stack trace contains 0x6b6b6b6 - a clear
sign that freed memory is being accessed.
It's the second validate_mem() in drivers/pcmcia/rsrc_mgr.c - the one
used when CONFIG_PCMCIA_PROBE is not defined. It turns out the memory
is freed in do_mem_probe() when it's called from validate_mem().
The solution is to use the same trick as in the first validate_mem().
This problem is quite serious and it's not specific to the plx9052
driver. I see it with yenta_socket as well.
David Brownell [Wed, 23 Apr 2003 05:05:40 +0000 (22:05 -0700)]
[PATCH] usb: fix (rare?) disconnect
It's not good to dereference pointers before checking
them for null. Seen once on a faulty device init,
which I don't think I'd ever seen before "in the wild".
(Caused by some other 2.5.68 strangeness.)
David Brownell [Wed, 23 Apr 2003 05:05:10 +0000 (22:05 -0700)]
[PATCH] USB: hcd-pci.c catch up to dev_printk changes
The preceding patch to fix this was incomplete, since
it didn't work for the pure debug messages. And that
was because the DEBUG-vs-CONFIG_USB_DEBUG stuff changed
somewhere.
I had to move the rtnetlink_init and init_netlink calls to af_netlink init time, so that
the sk_alloc called down the rtnetlink_init callchain is done after the PF_NETLINK
net_proto_family is sock_registered, and because of that the af_netlink init function
call had to be moved to earlier by means of subsys_initcall (DaveM's suggestion).