Patrick Mochel [Tue, 19 Aug 2003 16:36:46 +0000 (09:36 -0700)]
[power] Move suspend()/resume() methods.
Instead of putting them in struct device_driver (which few, if any drivers
use directly), put them in the controlling bus_type of the device (which
are currently responsible for claiming the methods and forwarding the calls
to the bus-specific driver anyway).
This will save 8 bytes per driver instance, which isn't that much, but it's
something. It also makes it more obvious to the reader what is going on.
And, it makes for easier bus-level defaults in the case the device has no
driver attached.
The old calls remain until all instances have been fixed up.
Patrick Mochel [Tue, 19 Aug 2003 16:23:34 +0000 (09:23 -0700)]
[power] Update device handling.
- From conversations with Ben Herrenschmidt.
Most devices should be able to handle powering down with interrupts enabled,
which I already assume. But since suspending will stop I/O transactions
before the call to power it off (making the device unusable anyway), there
is no need to separate the calls - we may as well make it simpler for
driver authors and require that driver authors do everything at the same
time.
There will always be devices that need to either power down or power up the
device with interrupts disabled. They will get called with interrupts
enabled, but may return -EAGAIN to be called again with interrupts disabled
to do what they need to do.
System devices are now always called only with interrupts disabled. Come
on - they're system devices. Of course we need interrupts disabled.
Patrick Mochel [Tue, 19 Aug 2003 15:39:03 +0000 (08:39 -0700)]
[power] Further swsusp cleanups.
- Remove drivers_resume() and call from do_magic_resume2(). Handled by core.
- When bringing devices back to life, call device_pm_resume()
- Make sure we report the error from write_suspend_image()
- Remove suspend_power_down() and call to it. Handled by PM core.
- Move swap file resetting and freeing of pagedir to swsusp_free()
- Remove extraneous in_atomic() checks.
- Mark all resume functions __init.
- Move resume_suspend_image() inside swsusp_read() and cleanup.
- Make do_magic() report error.
Patrick Mochel [Tue, 19 Aug 2003 14:53:13 +0000 (07:53 -0700)]
[power] Adapt swsusp to new PM core. Clean up heavily.
- Split suspend/resume code into the four functions called from the PM core.
- Remove now-duplicated code.
- Make sure PM core frees memory and sync's disks before we shut down devices.
- Remove software_suspend(), in favor of pm_suspend().
- Remove unused definitions from suspend.h
- set owner field on tty ldisc
- allocate network device objects with alloc_netdev
- use list_head macros and put locking around list of devices
- convert to seq_file for /proc
- use change_mtu hook rather than guessing at mtu changes
When doing the audit for this change, it was obvious that several drivers
allocate but never free the net_device.
This fixes these drivers. This patch is riskier than the earlier
ones, because it isn't just a simple substitution and maybe there
is a reason they never free.
[NET]: free_netdev - free network device on last class_device_usage
This patch adds the free_netdev function and associated
changes so that net_device structures are not freed until
last reference to the network device class is released.
Patrick Mochel [Tue, 19 Aug 2003 08:26:30 +0000 (01:26 -0700)]
[power] Add flag to control suspend-to-disk behavior.
Suspend-to-disk can be handled in numerous ways, some we have control over,
and others we don't. The biggest difference is whether or not the firmware
is responsible for entering a low-power state or if the platform driver is.
The two modes are incompatible, so we enable the platform driver tell the
PM core when they register their pm_ops (via the ->pm_disk_mode) field.
If the firmware is responsible, then it will also write memory to disk,
while the kernel is otherwise responsible. However, a user may choose to
use the in-kernel suspend mechanism, even if the system supports only
the firmware mechanism. Instead of entering a low-power state, the system
will turn off (or reboot for testing).
A sysfs file -- /sys/power/disk -- is available to set the mode to one of:
'firmware'
'platform'
'shutdown'
'reboot'
The latter two are settable any time, and assume that one is using swsusp.
The other two are only settable to what the platform supports.
Russell King [Tue, 19 Aug 2003 20:46:33 +0000 (21:46 +0100)]
[ARM] Remove redundant CONFIG_DEBUG_INFO.
ARM had CONFIG_DEBUG_INFO for ages. Unfortunately, the new
CONFIG_DEBUG_INFO was rather blindly applied across all architectures.
This removes the duplication from the ARM architecture.
Simon Evans [Tue, 19 Aug 2003 04:08:44 +0000 (21:08 -0700)]
[PATCH] blkmtd for 2.6
This updates the blkmtd driver with the latest which has been in the MTD
CVS for quite a while. It is a rewrite from the 2.4 version to work
with the new block layer changes.
Arnd Bergmann [Tue, 19 Aug 2003 03:33:51 +0000 (20:33 -0700)]
[PATCH] correct local_dec on some architectures
A small bug in local.h apparently got copied a few times.
I noticed this because I copied the same bug to s390.
This patch should fix the occurrences in BK, but there
are others that are not merged yet, e.g. ppc64 in -mm3.
Adam Belay [Tue, 19 Aug 2003 03:14:46 +0000 (20:14 -0700)]
[PATCH] Fix awe PnP probing
This is a rewrite of the awe_wave detection code that will allow this
driver to be compiled. It moves detection functions to a common
location at the end of the file and makes the code driver-model
compatible. Also it fixes a bug in which the driver could possibly
write to incorrect ports when using isapnp cards.
Unfortunantly I do not currently have an AWE32 to test these changes so
I could only check for compilation and driver registration.
Andi Kleen [Tue, 19 Aug 2003 03:06:09 +0000 (20:06 -0700)]
[PATCH] Fix ugly hole in x86-64 interrupt gates
There was a quite nasty long standing bug in the x86-64 port. The
interrupt gates had a DPL of 3, allowing user space to trigger any
interrupt. I have not found a way to exploit it this to crash the
kernel, but it definitely shouldn't happen. It could e.g. cause
problems with drivers that do not handle shared interrupt properly.
This also broke some programs who assumed that int <random number>
causes a signal.
Linus Torvalds [Tue, 19 Aug 2003 03:02:21 +0000 (20:02 -0700)]
The default ARCH_SI_BAND_T should be "int", since that is what
Linux historically has had. Only x86-64 uses anything else, so
make the special case be _there_.
Marc Zyngier [Tue, 19 Aug 2003 02:34:16 +0000 (19:34 -0700)]
[PATCH] EISA bus update
- Don't leave resource name uninitialized if CONFIG_EISA_NAME is not set.
- Print root device bus_id (so we know which bridge is probed).
- From Zwane Mwaikambo : Add a release method to virtual root, so it
stays quiet if probing fails (because some pci-eisa bridge have been
found before).
Andrew Morton [Tue, 19 Aug 2003 01:34:11 +0000 (18:34 -0700)]
[PATCH] loop: fix module unload oops
From: Peter Osterlund <petero2@telia.com>
It oopses on module unload in the kobject layer due to misordered destruction
of things.
And we need to initialise the unplug timer in blk_alloc_queue(), because we
kill that timer in blk_alloc_queue()'s companion function,
blk_cleanup_queue().
Andrew Morton [Tue, 19 Aug 2003 01:33:30 +0000 (18:33 -0700)]
[PATCH] Fix SELinux avc_log_lock
From: Stephen Smalley <sds@epoch.ncsc.mil>
This patch fixes a bug in the SELinux access vector cache code, which was
incorrectly using spin_lock_irq rather than spin_lock_irqsave for the
avc_log_lock. As this code can be called from hardirq (e.g. from the
file_send_sigiotask hook), we need irqsave/restore here.
Currently, a writepage() which detects that it is writing outside i_size (due
to concurrent truncate) will abandon the write, returning -EIO.
The return value will bogusly cause an error to be recorded in the
address_space. So convert all those writepage() instances to return zero in
this case.