GitHub/mt8127/android_kernel_alcatel_ttab.git
16 years agoide: factor out devices setup from init_irq()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:41 +0000 (19:56 +0100)]
ide: factor out devices setup from init_irq()

* Factor out devices setup from init_irq() to ide_port_setup_devices().

While at it:
* Do devices setup after printing port information.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: factor out adding drive to hwgroup from init_irq()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:41 +0000 (19:56 +0100)]
ide: factor out adding drive to hwgroup from init_irq()

Factor out adding drive to hwgroup from init_irq() to
ide_add_drive_to_hwgroup().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: move hwif->rqsize init from ide_init_queue() to init_irq()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:41 +0000 (19:56 +0100)]
ide: move hwif->rqsize init from ide_init_queue() to init_irq()

Move hwif->rqsize init from ide_init_queue() to init_irq().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: merge init_gendisk() into hwif_register_devices()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:41 +0000 (19:56 +0100)]
ide: merge init_gendisk() into hwif_register_devices()

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: call init_gendisk() after ide_acpi_init()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:40 +0000 (19:56 +0100)]
ide: call init_gendisk() after ide_acpi_init()

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: move blk_register_region() call out from init_gendisk()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:40 +0000 (19:56 +0100)]
ide: move blk_register_region() call out from init_gendisk()

Move blk_register_region() call out from init_gendisk() to hwif_init().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: skip not present devices in init_gendisk()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:40 +0000 (19:56 +0100)]
ide: skip not present devices in init_gendisk()

No need to initialize drive->gendev and waste memory on IDE settings
for not present devices.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove incorrect init_gendisk() comment
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:40 +0000 (19:56 +0100)]
ide: remove incorrect init_gendisk() comment

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ->port_init_devs method to ide_hwif_t
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:40 +0000 (19:56 +0100)]
ide: add ->port_init_devs method to ide_hwif_t

* Add ->port_init_devs method to ide_hwif_t for a host specific
  initialization of devices on a port.  Call the new method from
  ide_port_init_devices().

* Convert ht6560b, qd65xx and opti621 host drivers to use the new
  ->port_init_devs method.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add IDE_HFLAG_NO_{IO32_BIT,UNMASK_IRQS} host flags
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:40 +0000 (19:56 +0100)]
ide: add IDE_HFLAG_NO_{IO32_BIT,UNMASK_IRQS} host flags

* Use the same bit for IDE_HFLAG_CS5520 and IDE_HFLAG_VDMA host flags
  (both are used only by cs5520 host driver currently).

* Add IDE_HFLAG_NO_IO32_BIT host flag and use it instead of ->no_io_32bit
  ide_hwif_t field.

* Add IDE_HFLAG_NO_UNMASK_IRQS host flag, then convert dtc2278 and rz1000
  host drivers to use it.

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: factor out code initializing devices from ide_init_port()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:39 +0000 (19:56 +0100)]
ide: factor out code initializing devices from ide_init_port()

* Factor out code initializing devices from ide_init_port() to
  ide_port_init_devices().

* Call the new function from ide_device_add_all().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: fix ide_unregister() usage in host drivers
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:39 +0000 (19:56 +0100)]
ide: fix ide_unregister() usage in host drivers

bast-ide.c/ide-cs.c/delkin_cb.c:

* Don't set 'restore' flag for ide_unregister() when initializing new
  interface.

rapide.c/ide-pnp.c/ide-cs.c/ide_platform.c/au1xxx-ide.c/delkin_cb.c/scc_pata.c:

* Don't set 'init_default' and 'restore' flags for ide_unregister() when
  removing interface.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ide_deprecated_find_port() helper
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:39 +0000 (19:56 +0100)]
ide: add ide_deprecated_find_port() helper

* Factor out code for finding ide_hwifs[] slot from ide_register_hw()
  to ide_deprecated_find_port().

* Convert bast-ide, ide-cs and delkin_cb host drivers to use ide_device_add()
  instead of ide_register_hw() (while at it drop doing "ide_unregister()" loop
  which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot
  cannot be find).

This patch leaves us with only two ide_register_hw() users:
- drivers/macintosh/mediabay.c
- drivers/ide/ide.c

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add 'init_default' and 'restore' arguments to ide_unregister()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:39 +0000 (19:56 +0100)]
ide: add 'init_default' and 'restore' arguments to ide_unregister()

* Add 'init_default' (flag for calling init_hwif_default()) and 'restore'
  (flag for calling ide_hwif_restore()) arguments to ide_unregister().

* Update ide_unregister() users to set 'init_default' and 'restore' flags.

* No need to set 'init_default' flag in ide_register_hw() if the setup done
  by init_hwif_default() is going to be overridden by ide_init_port_hw().

* No need to set 'init_default' and 'restore' flags in cleanup_module().

There should be no functionality changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove redundant init_hwif_default() call from ide_register_hw()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:38 +0000 (19:56 +0100)]
ide: remove redundant init_hwif_default() call from ide_register_hw()

ide_init_port_hw() call overrides setup done by init_hwif_default().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove redundant hwif->present check from ide_register_hw()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:38 +0000 (19:56 +0100)]
ide: remove redundant hwif->present check from ide_register_hw()

We check earlier for hwif->present and call ide_unregister() if necessary
(after ide_unregister() hwif->present will be always cleared).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agopdc202xx_old: remove surplus initialiser
Alan Cox [Sat, 2 Feb 2008 18:56:38 +0000 (19:56 +0100)]
pdc202xx_old: remove surplus initialiser

Bart:
- drive-by CodingStyle fixups

Signed-off-by: Alan Cox <alan@redhat.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: bump driver version number
Borislav Petkov [Sat, 2 Feb 2008 18:56:38 +0000 (19:56 +0100)]
ide-floppy: bump driver version number

Acknowledge major ide-floppy code refactoring and cleanup by bumping the driver
version number. Also, remove a wrong comment.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: fix most of the remaining checkpatch.pl issues
Borislav Petkov [Sat, 2 Feb 2008 18:56:38 +0000 (19:56 +0100)]
ide-floppy: fix most of the remaining checkpatch.pl issues

such as
ERROR: switch and case should be at the same indent
ERROR: need spaces around that '=' (ctx:VxV)
ERROR: trailing statements should be on next line
WARNING: no space between function name and open parenthesis '('
WARNING: printk() should include KERN_ facility level
ERROR: That open brace { should be on the previous line
ERROR: use tabs not spaces
ERROR: do not use assignment in if condition
WARNING: braces {} are not necessary for single statement blocks
ERROR: need space after that ',' (ctx:VxV)
WARNING: line over 80 characters
ERROR: do not use assignment in if condition
...
and so on.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove atomic test_*bit macros
Borislav Petkov [Sat, 2 Feb 2008 18:56:37 +0000 (19:56 +0100)]
ide-floppy: remove atomic test_*bit macros

..and replace them with flag enums.

Bart:
- fix idefloppy_media_changed() return value

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove unused flag PC_ABORT
Borislav Petkov [Sat, 2 Feb 2008 18:56:37 +0000 (19:56 +0100)]
ide-floppy: remove unused flag PC_ABORT

This flag was never being set in the code so remove it. By the way, the
code in the second patch was being executed unconditionally, i.e. in case
pc->retries > IDEFLOPPY_MAX_PC_RETRIES is true (actually that is the only case
when the outer if-test passed), !test_bit(PC_ABORT, &pc->flags)
was always true so the comment is now incorrect and has to go.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove IDEFLOPPY_DEBUG_INFO
Borislav Petkov [Sat, 2 Feb 2008 18:56:36 +0000 (19:56 +0100)]
ide-floppy: remove IDEFLOPPY_DEBUG_INFO

This info is already available through ioctl() and /proc

Bart:
- dump 'gcw.packet_size' for unsupported packet sizes

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove unused IDEFLOPPY_USE_READ12
Borislav Petkov [Sat, 2 Feb 2008 18:56:36 +0000 (19:56 +0100)]
ide-floppy: remove unused IDEFLOPPY_USE_READ12

This flag is not being set anywhere in the driver so it can go.

Bart:
- minor CodingStyle fixup

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: merge idefloppy_{input,output}_buffers
Borislav Petkov [Sat, 2 Feb 2008 18:56:36 +0000 (19:56 +0100)]
ide-floppy: merge idefloppy_{input,output}_buffers

We merge idefloppy_{input,output}_buffers() into idefloppy_io_buffers() by
introducing a 4th arg. called direction. According to its value
we atapi_input_bytes() or atapi_output_bytes(). Also, this simplifies the
interrupt handler logic a bit. Finally, rename idefloppy_io_buffers() to
ide_floppy_io_buffers().

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: use an xfer_func_t and io_buf_t typedefs in order to unify rw
Borislav Petkov [Sat, 2 Feb 2008 18:56:36 +0000 (19:56 +0100)]
ide-floppy: use an xfer_func_t and io_buf_t typedefs in order to unify rw

Also, move xfer_func_t typedef to the ide.h since it is used by two drivers
now (more coming).

Bart:
- use __func__ while at it

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove IDEFLOPPY_DEBUG_BUGS macro
Borislav Petkov [Sat, 2 Feb 2008 18:56:36 +0000 (19:56 +0100)]
ide-floppy: remove IDEFLOPPY_DEBUG_BUGS macro

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: mv idefloppy_{should_,}report_error
Borislav Petkov [Sat, 2 Feb 2008 18:56:35 +0000 (19:56 +0100)]
ide-floppy: mv idefloppy_{should_,}report_error

In addition to shortening the function name, move the printk-call into the
function thereby saving some code lines. Also, make the function out_of_line
since it is not on a performance critical path. Finally, rename the reworked
function to ide_floppy..().

Bart:
- minor CodingStyle fixup

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: report DMA handling in idefloppy_pc_intr() properly
Borislav Petkov [Sat, 2 Feb 2008 18:56:35 +0000 (19:56 +0100)]
ide-floppy: report DMA handling in idefloppy_pc_intr() properly

Bart:
- use 'hwif' instead of 'HWIF(drive)'
- minor CodingStyle fixup

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: factor out ioctl handlers from idefloppy_ioctl()
Borislav Petkov [Sat, 2 Feb 2008 18:56:35 +0000 (19:56 +0100)]
ide-floppy: factor out ioctl handlers from idefloppy_ioctl()

By passing idefloppy_floppy_t *floppy to the factored out functions, we get
rid of (almost) all local vars so stack usage should be at minimum here. Also,
we merge idefloppy_begin_format() into idefloppy_format_start() since it is its
only user. Also, rename idefloppy_format_start() to idefloppy_format_unit().
Finally, rename the reworked functions to ide_floppy..().

Bart
- minor CodingStyle fixup

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove struct idefloppy_capacity_descriptor
Borislav Petkov [Sat, 2 Feb 2008 18:56:35 +0000 (19:56 +0100)]
ide-floppy: remove struct idefloppy_capacity_descriptor

Also,
- remove the accompanying 4 byte idefloppy_capacity_header.
- rename functions from idefloppy_... to ide_floppy_... after cleanup.
- simplify loop in ide_floppy_get_capacity() by reversing if-test condition
  logically.
- finally, fix white space and checkpatch.pl issues

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove struct idefloppy_flexible_disk_page
Borislav Petkov [Sat, 2 Feb 2008 18:56:35 +0000 (19:56 +0100)]
ide-floppy: remove struct idefloppy_flexible_disk_page

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove struct idefloppy_mode_parameter_header
Borislav Petkov [Sat, 2 Feb 2008 18:56:34 +0000 (19:56 +0100)]
ide-floppy: remove struct idefloppy_mode_parameter_header

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove struct idefloppy_request_sense_result
Borislav Petkov [Sat, 2 Feb 2008 18:56:34 +0000 (19:56 +0100)]
ide-floppy: remove struct idefloppy_request_sense_result

While at it, collapse idefloppy_analyze_error() into
idefloppy_request_sense_callback() since the latter was its only user.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove struct idefloppy_inquiry_result
Borislav Petkov [Sat, 2 Feb 2008 18:56:34 +0000 (19:56 +0100)]
ide-floppy: remove struct idefloppy_inquiry_result

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove struct idefloppy_capabilities_page
Borislav Petkov [Sat, 2 Feb 2008 18:56:34 +0000 (19:56 +0100)]
ide-floppy: remove struct idefloppy_capabilities_page

This change is rather temporary and is in preparation of using generic commands
as is the case with ide-cd and the uniform cdrom layer (i.e. init_cdrom_command())
However, before this happens, we'll have to remove all typedefs and teach
idefloppy_create_mode_sense_cmd() to work directly on u8 buffers.

Also, since idefloppy_get_capability_page() was used to read only the sfrp bit,
rename the latter so that the name reflects what it does.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: cleanup and unify debugging macro calls
Borislav Petkov [Sat, 2 Feb 2008 18:56:34 +0000 (19:56 +0100)]
ide-floppy: cleanup and unify debugging macro calls

* some debug_log() calls were not using "ide-floppy: " prefix

* a few used printk levels different than KERN_INFO (KERN_NOTICE
  and KERN_ERR, which is the default one if no level is given)

Bart:
- fix build issues for IDEFLOPPY_DEBUG_LOG set to 1 while at it
- s/__FUNCTION__/__func__/

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: include the proper headers
Borislav Petkov [Sat, 2 Feb 2008 18:56:34 +0000 (19:56 +0100)]
ide-floppy: include the proper headers

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: disambiguate function names
Borislav Petkov [Sat, 2 Feb 2008 18:56:33 +0000 (19:56 +0100)]
ide-floppy: disambiguate function names

There were two almost identical function names in ide-floppy.c, which makes
their distinction almost impossible. While ide_floppy_release() cleans up the
object after the last reference to it has been dropped, idefloppy_release() is
the blkdev .release method from struct block_device_operations which releases
that last reference.

Rename ide_floppy_release() to idefloppy_cleanup_obj() in order to make its
purpose more clear.

There should be no functionality change resulting from this patch.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: remove unnecessary ->handler != NULL check
Borislav Petkov [Sat, 2 Feb 2008 18:56:33 +0000 (19:56 +0100)]
ide-floppy: remove unnecessary ->handler != NULL check

This BUG_ON is unneeded since the ->handler != NULL check is performed in
ide_set_handler().

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: replace ntoh{s,l} and hton{s,l} calls with the generic byteorder
Borislav Petkov [Sat, 2 Feb 2008 18:56:33 +0000 (19:56 +0100)]
ide-floppy: replace ntoh{s,l} and hton{s,l} calls with the generic byteorder

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide-floppy: convert to generic packet commands
Borislav Petkov [Sat, 2 Feb 2008 18:56:33 +0000 (19:56 +0100)]
ide-floppy: convert to generic packet commands

Replace the ide-floppy packet commands opcode defines with the generic ones.
Add a missing GPCMD_WRITE_12 (opcode 0xaa) to the generic ones in cdrom.h. The
last one can be found in the current version of INF-8090, p.905.

[ Bart: Tejun's libata patch also adding GPCMD_WRITE_12 got merged first ]

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: remove needless includes from PCI host drivers
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:33 +0000 (19:56 +0100)]
ide: remove needless includes from PCI host drivers

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add ->cable_detect method to ide_hwif_t
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:31 +0000 (19:56 +0100)]
ide: add ->cable_detect method to ide_hwif_t

* Add ->cable_detect method to ide_hwif_t.

* Call the new method in ide_init_port() if:
  - the host supports UDMA modes > UDMA2 ('hwif->ultra_mask & 78')
  - DMA initialization was successful (if hwif->dma_base is not set
    ide_init_port() sets hwif->ultra_mask to zero)
  - "idex=ata66" is not used ('hwif->cbl != ATA_CBL_PATA40_SHORT')

* Convert PCI host drivers to use ->cable_detect method.

While at it:

* Factor out cable detection to separate functions (if not already done).

* hpt366.c/it8213.c/slc90e66.c:
  - don't check cable type if "idex=ata66" is used

* pdc202xx_new.c:
  - add __devinit tag to pdcnew_cable_detect()

* pdc202xx_old.c:
  - rename pdc202xx_old_cable_detect() to pdc2026x_old_cable_detect()
  - add __devinit tag to pdc2026x_old_cable_detect()

Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: add struct ide_port_info instances to legacy host drivers
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:31 +0000 (19:56 +0100)]
ide: add struct ide_port_info instances to legacy host drivers

* Remove 'struct pci_dev *dev' argument from ide_hwif_setup_dma().

* Un-static ide_hwif_setup_dma() and add CONFIG_BLK_DEV_IDEDMA_PCI=n version.

* Add 'const struct ide_port_info *d' argument to ide_device_add[_all]().

* Factor out generic ports init from ide_pci_setup_ports() to ide_init_port(),
  move it to ide-probe.c and call it in in ide_device_add_all() instead of
  ide_pci_setup_ports().

* Move ->mate setup to ide_device_add_all() from ide_port_init().

* Add IDE_HFLAG_NO_AUTOTUNE host flag for host drivers that don't enable
  ->autotune currently.

* Setup hwif->chipset in ide_init_port() but iff pi->chipset is set
  (to not override setup done by ide_hwif_configure()).

* Add ETRAX host handling to ide_device_add_all().

* cmd640.c: set IDE_HFLAG_ABUSE_* also for CONFIG_BLK_DEV_CMD640_ENHANCED=n.

* pmac.c: make pmac_ide_setup_dma() return an error value and move DMA masks
  setup to pmac_ide_setup_device().

* Add 'struct ide_port_info' instances to legacy host drivers, pass them to
  ide_device_add() calls and then remove open-coded ports initialization.

Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: separate PCI specific init from generic init in ide_pci_setup_ports()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:30 +0000 (19:56 +0100)]
ide: separate PCI specific init from generic init in ide_pci_setup_ports()

* Setup ->mate and ->channel in ide_pci_setup_ports() instead of
  in ide_hwif_configure().

* Make 'port' parameter for ide_hwif_configure() 'unsigned int'.

* Separate PCI specific init from generic init in ide_pci_setup_ports().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoide: always set DMA masks in ide_pci_setup_ports()
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:30 +0000 (19:56 +0100)]
ide: always set DMA masks in ide_pci_setup_ports()

Always set DMA masks in ide_pci_setup_ports() to make sure that the valid
masks for a host are set.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agomacide: remove drive->capacity64 quirk
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:30 +0000 (19:56 +0100)]
macide: remove drive->capacity64 quirk

Nowadays IDE core always provides drive ID and ide-disk always setups
drive->capacity64 so this quirk is no longer needed.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoatiixp/cs5535/scc_pata: fix "idex=ata66" parameter handling
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:29 +0000 (19:56 +0100)]
atiixp/cs5535/scc_pata: fix "idex=ata66" parameter handling

Don't override the cable type if the "idex=ata66" parameter was used.

While at it:

* atiixp.c: factor out cable detection to atiixp_cable_detect() from
  init_hwif_atiixp().

* cs5535.c: pass 'ide_hwif_t *hwif' instead of 'struct pci_dev *dev' to
  cs5535_cable_detect().

* scc_pata.c: factor out cable detection to scc_cable_detect() from
  init_hwif_scc() and remove incorrect comment.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoau1xxx-ide: fix ->io_32bit handling
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:29 +0000 (19:56 +0100)]
au1xxx-ide: fix ->io_32bit handling

The host driver must set hwif's ->no_io_32bit setting not drive's one
(ide_port_tune_devices() overrides drive's setting).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agodtc2278: fix ->io_32bit handling
Bartlomiej Zolnierkiewicz [Sat, 2 Feb 2008 18:56:28 +0000 (19:56 +0100)]
dtc2278: fix ->io_32bit handling

On DTC2278 32-bit I/O has to be enabled for both devices on the port
so always enable it during init time and disallow further changes.

Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
16 years agoMerge git://git.infradead.org/battery-2.6
Linus Torvalds [Sat, 2 Feb 2008 04:13:05 +0000 (15:13 +1100)]
Merge git://git.infradead.org/battery-2.6

* git://git.infradead.org/battery-2.6:
  apm_power: check I.intval for zero value, we use it as the divisor
  MAINTAINERS: remove kernel-discuss@handhelds.org list
  pda_power: implement polling
  pda_power: various cleanups
  apm_power: support using VOLTAGE_* properties for apm calculations
  pda_power: add suspend/resume support
  power_supply: add few more values and props
  pda_power: only register available psu
  power: fix incorrect unregistration in power_supply_create_attrs error path
  power: remove POWER_SUPPLY_PROP_CAPACITY_LEVEL
  [BATTERY] power_supply_leds: use kasprintf
  [BATTERY] Every file should include the headers containing the prototypes for its global functions.

16 years agoMerge branch 'for-linus' of git://linux-nfs.org/~bfields/linux
Linus Torvalds [Sat, 2 Feb 2008 03:31:28 +0000 (14:31 +1100)]
Merge branch 'for-linus' of git://linux-nfs.org/~bfields/linux

* 'for-linus' of git://linux-nfs.org/~bfields/linux: (100 commits)
  SUNRPC: RPC program information is stored in unsigned integers
  SUNRPC: Move exported symbol definitions after function declaration part 2
  NLM: tear down RPC clients in nlm_shutdown_hosts
  SUNRPC: spin svc_rqst initialization to its own function
  nfsd: more careful input validation in nfsctl write methods
  lockd: minor log message fix
  knfsd: don't bother mapping putrootfh enoent to eperm
  rdma: makefile
  rdma: ONCRPC RDMA protocol marshalling
  rdma: SVCRDMA sendto
  rdma: SVCRDMA recvfrom
  rdma: SVCRDMA Core Transport Services
  rdma: SVCRDMA Transport Module
  rdma: SVCRMDA Header File
  svc: Add svc_xprt_names service to replace svc_sock_names
  knfsd: Support adding transports by writing portlist file
  svc: Add svc API that queries for a transport instance
  svc: Add /proc/sys/sunrpc/transport files
  svc: Add transport hdr size for defer/revisit
  svc: Move the xprt independent code to the svc_xprt.c file
  ...

16 years agoMerge branch 'suspend' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux...
Linus Torvalds [Sat, 2 Feb 2008 03:29:57 +0000 (14:29 +1100)]
Merge branch 'suspend' of git://git./linux/kernel/git/lenb/linux-acpi-2.6

* 'suspend' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (38 commits)
  suspend: cleanup reference to swsusp_pg_dir[]
  PM: Remove obsolete /sys/devices/.../power/state docs
  Hibernation: Invoke suspend notifications after console switch
  Suspend: Invoke suspend notifications after console switch
  Suspend: Clean up suspend_64.c
  Suspend: Add config option to disable the freezer if architecture wants that
  ACPI: Print message before calling _PTS
  ACPI hibernation: Call _PTS before suspending devices
  Hibernation: Introduce begin() and end() callbacks
  ACPI suspend: Call _PTS before suspending devices
  ACPI: Separate disabling of GPEs from _PTS
  ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK
  Suspend: Introduce begin() and end() callbacks
  suspend: fix ia64 allmodconfig build
  ACPI: clear GPE earily in resume to avoid warning
  Suspend: Clean up Kconfig (V2)
  Hibernation: Clean up Kconfig (V2)
  Hibernation: Update messages
  Suspend: Use common prefix in messages
  Hibernation: Remove unnecessary variable declaration
  ...

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6
Linus Torvalds [Sat, 2 Feb 2008 03:29:33 +0000 (14:29 +1100)]
Merge git://git./linux/kernel/git/gregkh/pci-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/pci-2.6: (64 commits)
  PCI: make pci_bus a struct device
  PCI: fix codingstyle issues in include/linux/pci.h
  PCI: fix codingstyle issues in drivers/pci/pci.h
  PCI: PCIE ASPM support
  PCI: Fix fakephp deadlock
  PCI: modify SB700 SATA MSI quirk
  PCI: Run ACPI _OSC method on root bridges only
  PCI ACPI: AER driver should only register PCIe devices with _OSC
  PCI ACPI: Added a function to register _OSC with only PCIe devices.
  PCI: constify function pointer tables
  PCI: Convert drivers/pci/proc.c to use unlocked_ioctl
  pciehp: block new requests from the device before power off
  pciehp: workaround against Bad DLLP during power off
  pciehp: wait for 1000ms before LED operation after power off
  PCI: Remove pci_enable_device_bars() from documentation
  PCI: Remove pci_enable_device_bars()
  PCI: Remove users of pci_enable_device_bars()
  PCI: Add pci_enable_device_{io,mem} intefaces
  PCI: avoid save the same type of cap multiple times
  PCI: correctly initialize a structure for pcie_save_pcix_state()
  ...

16 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
Linus Torvalds [Sat, 2 Feb 2008 03:28:57 +0000 (14:28 +1100)]
Merge git://git./linux/kernel/git/gregkh/usb-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (128 commits)
  USB: fix codingstyle issues in drivers/usb/core/*.c
  USB: fix codingstyle issues in drivers/usb/core/message.c
  USB: fix codingstyle issues in drivers/usb/core/hcd-pci.c
  USB: fix codingstyle issues in drivers/usb/core/devio.c
  USB: fix codingstyle issues in drivers/usb/core/devices.c
  USB: fix codingstyle issues in drivers/usb/core/*.h
  USB: fix codingstyle issues in include/linux/usb/
  USB: fix codingstyle issues in include/linux/usb.h
  USB: mark USB drivers as being GPL only
  USB: use a real vendor and product id for root hubs
  USB: mount options: fix usbfs
  USB: Fix usb_serial_driver structure for Kobil cardreader driver.
  usb: ehci should use u16 for isochronous intervals
  usb: ehci, remove false clear-reset path
  USB: Use menuconfig objects
  usb: ohci-sm501 driver
  usb: dma bounce buffer support
  USB: last abuses of intfdata in close for usb-serial drivers
  USB: kl5kusb105 don't flush to logically disconnected devices
  USB: oti6858: cleanup
  ...

16 years agodebug: softlockup looping fix
Peter Zijlstra [Fri, 1 Feb 2008 23:23:08 +0000 (00:23 +0100)]
debug: softlockup looping fix

Rafael J. Wysocki reported weird, multi-seconds delays during
suspend/resume and bisected it back to:

  commit 82a1fcb90287052aabfa235e7ffc693ea003fe69
  Author: Ingo Molnar <mingo@elte.hu>
  Date:   Fri Jan 25 21:08:02 2008 +0100

      softlockup: automatically detect hung TASK_UNINTERRUPTIBLE tasks

fix it:

 - restore the old wakeup mechanism
 - fix break usage in do_each_thread() { } while_each_thread().
 - fix the hotplug switch stmt, a fall-through case was broken.

Bisected-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Tested-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
16 years agoapm_power: check I.intval for zero value, we use it as the divisor
Anton Vorontsov [Sat, 12 Jan 2008 23:44:54 +0000 (02:44 +0300)]
apm_power: check I.intval for zero value, we use it as the divisor

Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agoMAINTAINERS: remove kernel-discuss@handhelds.org list
Anton Vorontsov [Sat, 12 Jan 2008 23:44:54 +0000 (02:44 +0300)]
MAINTAINERS: remove kernel-discuss@handhelds.org list

kernel-discuss at handhelds.org is down for months, and nobody
knows why. So remove it for now.

Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agopda_power: implement polling
Anton Vorontsov [Sat, 12 Jan 2008 23:44:20 +0000 (02:44 +0300)]
pda_power: implement polling

Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agopda_power: various cleanups
Anton Vorontsov [Sat, 12 Jan 2008 23:39:17 +0000 (02:39 +0300)]
pda_power: various cleanups

- handle spurious interrupts correctly;
- get rid of pda_power_supplies array, use two variables instead;
- factor out psy_changed() function, it will be used for polling.

Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agoapm_power: support using VOLTAGE_* properties for apm calculations
Dmitry Baryshkov [Sat, 12 Jan 2008 23:39:16 +0000 (02:39 +0300)]
apm_power: support using VOLTAGE_* properties for apm calculations

It's pretty dummy, but useful for batteries for which we can only
get voltages.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agopda_power: add suspend/resume support
Dmitry Baryshkov [Sat, 12 Jan 2008 23:35:43 +0000 (02:35 +0300)]
pda_power: add suspend/resume support

Add suspend/resume/wakeup support for pda_power.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agopower_supply: add few more values and props
Dmitry Baryshkov [Mon, 7 Jan 2008 01:12:41 +0000 (04:12 +0300)]
power_supply: add few more values and props

Add LiMn (one of the most common for small non-rechargable batteries)
battery technology and voltage_min/_max properties support.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agopda_power: only register available psu
Dmitry Baryshkov [Mon, 7 Jan 2008 01:12:39 +0000 (04:12 +0300)]
pda_power: only register available psu

Currently pda-power adds both ac and usb power supply units.
This patch fixes it so that psu are added only if they are enabled.

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agopower: fix incorrect unregistration in power_supply_create_attrs error path
Andres Salomon [Wed, 12 Dec 2007 19:12:59 +0000 (14:12 -0500)]
power: fix incorrect unregistration in power_supply_create_attrs error path

In power_supply_create_attrs(), we create static attributes as referenced
by power_supply_static_attrs[i].  After that, if we fail, we unregister
via power_supply_static_attrs[psy->properties[i]].  This is incorrect, as
psy->properties has absolutely no bearing on static attribs.  This patch
fixes it to unregister the correct attrib.

Another line which was unnecessarily line wrapped is also unwrapped.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
16 years agopower: remove POWER_SUPPLY_PROP_CAPACITY_LEVEL
Andres Salomon [Wed, 12 Dec 2007 19:12:56 +0000 (14:12 -0500)]
power: remove POWER_SUPPLY_PROP_CAPACITY_LEVEL

The CAPACITY_LEVEL stuff defines various levels of charge; however, what
is the difference between them?  What differentiates between HIGH and NORMAL,
LOW and CRITICAL, etc?

As it appears that these are fairly arbitrary, we end up making such policy
decisions in the kernel (or in hardware).  This is the sort of decision that
should be made in userspace, not in the kernel.

If the hardware does not support _CAPACITY and it cannot be easily calculated,
then perhaps the driver should register a custom CAPACITY_LEVEL attribute;
however, userspace should not become accustomed to looking for such a thing,
and we should certainly not encourage drivers to provide CAPACITY_LEVEL
stubs.

The following removes support for POWER_SUPPLY_PROP_CAPACITY_LEVEL.  The
OLPC battery driver is the only driver making use of this, so it's
removed from there as well.

Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
16 years ago[BATTERY] power_supply_leds: use kasprintf
Akinobu Mita [Sat, 17 Nov 2007 10:55:58 +0000 (19:55 +0900)]
[BATTERY] power_supply_leds: use kasprintf

Use kasprintf instead of kmalloc()-strcpy()-strcat().

Cc: Anton Vorontsov <cbou@mail.ru>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years ago[BATTERY] Every file should include the headers containing the prototypes for its...
Adrian Bunk [Sun, 25 Nov 2007 21:25:45 +0000 (00:25 +0300)]
[BATTERY] Every file should include the headers containing the prototypes for its global functions.

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Anton Vorontsov <cbou@mail.ru>
16 years agosuspend: cleanup reference to swsusp_pg_dir[]
Rafael J. Wysocki [Fri, 1 Feb 2008 14:28:16 +0000 (15:28 +0100)]
suspend: cleanup reference to swsusp_pg_dir[]

swsusp_pg_dir[] is used for suspend, but not for hibernation.
clean-up the ifdefs which worked by accident, while implying the opposite.
Delete the __nosavedata, which also implied the opposite.

Some day we may optimize CONFIG_ACPI_SLEEP to build minimal kernels
for just hibernate or just suspend but not both,
but today isn't that day.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoPM: Remove obsolete /sys/devices/.../power/state docs
David Brownell [Fri, 11 Jan 2008 00:26:57 +0000 (01:26 +0100)]
PM: Remove obsolete /sys/devices/.../power/state docs

The /sys/devices/.../power/state files have been gone for a while
now, but I just noticed some documentation that still refers to
them.  (Fortunately described as DEPRECATED and WILL REMOVE).

Time to remove that obsolete documentation too ...

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Invoke suspend notifications after console switch
Rafael J. Wysocki [Fri, 11 Jan 2008 00:25:21 +0000 (01:25 +0100)]
Hibernation: Invoke suspend notifications after console switch

Following the recent change in the suspend code path, switch consoles before
calling PM notifiers during hibernation.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Invoke suspend notifications after console switch
Johannes Berg [Fri, 11 Jan 2008 00:22:23 +0000 (01:22 +0100)]
Suspend: Invoke suspend notifications after console switch

In order to fix APM emulation it is necessary to enable apm-emulation
notifications for suspends triggered in various ways via the suspend
notifiers.  However, this will cause the systems using APM emulation
to lock up between X being needed to switch away from the VT and X
already waiting for resume in the APM ioctl.

This patch moves the console switch (if enabled) before the suspend
notification (and after the resume notification) to avoid this issue.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Clean up suspend_64.c
Borislav Petkov [Sun, 16 Dec 2007 23:30:22 +0000 (00:30 +0100)]
Suspend: Clean up suspend_64.c

There's a freakishly long comment in suspend_64.c, shorten it.

Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Add config option to disable the freezer if architecture wants that
Johannes Berg [Wed, 16 Jan 2008 04:17:00 +0000 (23:17 -0500)]
Suspend: Add config option to disable the freezer if architecture wants that

This patch makes the freezer optional for suspend to allow the
system to work (or not work) like the original PMU suspend.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: Print message before calling _PTS
Rafael J. Wysocki [Mon, 7 Jan 2008 23:10:57 +0000 (00:10 +0100)]
ACPI: Print message before calling _PTS

Make acpi_sleep_prepare() static and cause it to print a message
specifying the ACPI system sleep state to be entered (helpful for
debugging the suspend/hibernation code).

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI hibernation: Call _PTS before suspending devices
Rafael J. Wysocki [Mon, 7 Jan 2008 23:09:58 +0000 (00:09 +0100)]
ACPI hibernation: Call _PTS before suspending devices

The ACPI 1.0 specification wants us to put devices into low power
states after executing the _PTS global control method, while ACPI
2.0 and later want us to do that in the reverse order.  The current
hibernation code follows ACPI 2.0 in that respect which may cause some
ACPI 1.0x systems to hang during hibernation (ref.
http://bugzilla.kernel.org/show_bug.cgi?id=9528).

Make the hibernation code execute _PTS before putting devices into
low power states (ie. in accordance with ACPI 1.0x) with the
possibility to override that using the 'acpi_new_pts_ordering' kernel
command line option.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Introduce begin() and end() callbacks
Rafael J. Wysocki [Mon, 7 Jan 2008 23:08:44 +0000 (00:08 +0100)]
Hibernation: Introduce begin() and end() callbacks

Introduce global hibernation callback .end() and rename global
hibernation callback .start() to .begin(), in analogy with the
recent modifications of the global suspend callbacks.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI suspend: Call _PTS before suspending devices
Rafael J. Wysocki [Mon, 7 Jan 2008 23:07:39 +0000 (00:07 +0100)]
ACPI suspend: Call _PTS before suspending devices

The ACPI 1.0 specification wants us to put devices into low power
states after executing the _PTS global control method, while ACPI
2.0 and later want us to do that in the reverse order.  The current
suspend code follows ACPI 2.0 in that respect which causes some
ACPI 1.0x systems to hang during suspend (ref.
http://bugzilla.kernel.org/show_bug.cgi?id=9528).

Make the suspend code execute _PTS before putting devices into low
power states (ie. in accordance with ACPI 1.0x) and provide a command
line option to override the default if need be.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: Separate disabling of GPEs from _PTS
Rafael J. Wysocki [Mon, 7 Jan 2008 23:06:16 +0000 (00:06 +0100)]
ACPI: Separate disabling of GPEs from _PTS

The preparation to enter an ACPI system sleep state is now tied to
the disabling of GPEs, but the GPEs should not be disabled before
suspending devices.  Since on ACPI 1.0x systems the _PTS global
control method should be executed before suspending devices, we
need to disable GPEs separately.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK
Rafael J. Wysocki [Mon, 7 Jan 2008 23:05:21 +0000 (00:05 +0100)]
ACPI: Separate invocations of _GTS and _BFS from _PTS and _WAK

The execution of ACPI global control methods _GTS and _BFS is
currently tied to the preparation to enter a sleep state and to the
leaving of the sleep state, respectively.  However, these functions
are called before disabling the nonboot CPUs and after enabling
them, respectively (in fact, on ACPI 1.0x systems the first of them
ought to be called before suspending devices), while according to the
ACPI specification, _GTS is to be executed right prior to entering
the system sleep state and _BFS is to be executed right after the
platfor firmware has returned control to the OS on wake up.

Move the execution of _GTS and _BFS to the right places.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Introduce begin() and end() callbacks
Rafael J. Wysocki [Mon, 7 Jan 2008 23:04:17 +0000 (00:04 +0100)]
Suspend: Introduce begin() and end() callbacks

On ACPI systems the target state set by acpi_pm_set_target() is
reset by acpi_pm_finish(), but that need not be called if the
suspend fails.  All platforms that use the .set_target() global
suspend callback are affected by analogous issues.

For this reason, we need an additional global suspend callback that
will reset the target state regardless of whether or not the suspend
is successful.  Also, it is reasonable to rename the .set_target()
callback, since it will be used for a different purpose on ACPI
systems (due to ACPI 1.0x code ordering requirements).

Introduce the global suspend callback .end() to be executed at the
end of the suspend sequence and rename the .set_target() global
suspend callback to .begin().

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agosuspend: fix ia64 allmodconfig build
Rafael J. Wysocki [Fri, 14 Dec 2007 00:07:13 +0000 (01:07 +0100)]
suspend: fix ia64 allmodconfig build

kernel/power/main.c:488: error: ‘pm_test_attr’ undeclared here (not in a function)

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoACPI: clear GPE earily in resume to avoid warning
Shaohua Li [Wed, 20 Jun 2007 01:17:58 +0000 (09:17 +0800)]
ACPI: clear GPE earily in resume to avoid warning

Wakeup GPE hasn't a handler. If system is waked up by such GPE like a
USB hotplug, I saw a lot of error reporting the GPE hasn't handler.
acpi_leave_sleep_state will clear the GPE but it's too late, we should
do it before interrupt is re-enabled.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Clean up Kconfig (V2)
Johannes Berg [Sat, 8 Dec 2007 01:14:00 +0000 (02:14 +0100)]
Suspend: Clean up Kconfig (V2)

This cleans up the suspend Kconfig and removes the need to
declare centrally which architectures support suspend. All
architectures that currently support suspend are modified
accordingly.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Clean up Kconfig (V2)
Johannes Berg [Sat, 8 Dec 2007 01:12:39 +0000 (02:12 +0100)]
Hibernation: Clean up Kconfig (V2)

This cleans up the hibernation Kconfig and removes the need to
declare centrally which architectures support hibernation. All
architectures that currently support hibernation are modified
accordingly.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Paul Mackerras <paulus@samba.org>
Cc: Pavel Machek <pavel@suse.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Update messages
Rafael J. Wysocki [Sat, 8 Dec 2007 01:09:43 +0000 (02:09 +0100)]
Hibernation: Update messages

Make hibernation messages start with one common prefix "PM: " and use
the word "hibernation" in the messages as a synonym of "suspend to
disk".

Turn some KERN_INFO messages into debug ones.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Use common prefix in messages
Rafael J. Wysocki [Sat, 8 Dec 2007 01:08:38 +0000 (02:08 +0100)]
Suspend: Use common prefix in messages

Make suspend messages start with one common prefix "PM: ".

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Remove unnecessary variable declaration
Rafael J. Wysocki [Sat, 8 Dec 2007 01:07:40 +0000 (02:07 +0100)]
Hibernation: Remove unnecessary variable declaration

Remove the unnecessary extern declaration of resume_file[]
from kernel/power/swap.c .

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Fix comment in disk.c
Rafael J. Wysocki [Sat, 8 Dec 2007 01:06:57 +0000 (02:06 +0100)]
Hibernation: Fix comment in disk.c

Fix a comment in kernel/power/disk.c so that it doesn't contain lines
longer that 80 characters.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Fix comment in main.c
Rafael J. Wysocki [Sat, 8 Dec 2007 01:06:00 +0000 (02:06 +0100)]
Suspend: Fix comment in main.c

Fix a comment in kernel/power/main.c so that it doesn't contain lines
longer that 80 characters.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Move low level resume to disk.c
Rafael J. Wysocki [Sat, 8 Dec 2007 01:04:21 +0000 (02:04 +0100)]
Hibernation: Move low level resume to disk.c

Move the low level restore code to kernel/power/disk.c , since the
corresponding low level hibernation code is already there.

Make restore fail if device_power_down(PMSG_PRETHAW) returns an
error.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Fix compilation warning for CONFIG_SUSPEND unset
Rafael J. Wysocki [Sat, 8 Dec 2007 01:03:26 +0000 (02:03 +0100)]
Suspend: Fix compilation warning for CONFIG_SUSPEND unset

Suspend: Make debug facility depend on CONFIG_SUSPEND

Make the new suspend debug facility code depend on CONFIG_SUSPEND,
as appropriate, to remove the compiler warning printed when CONFIG_PM is set
and CONFIG_SUSPEND is not set.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoPM: Convert PM notifiers to out-of-line code
Alan Stern [Mon, 19 Nov 2007 22:49:18 +0000 (23:49 +0100)]
PM: Convert PM notifiers to out-of-line code

This patch (as1008b) converts the PM notifier routines from inline
calls to out-of-line code.  It also prevents pm_chain_head from
being created when CONFIG_PM_SLEEP isn't enabled, and EXPORTs the
notifier registration and unregistration routines.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoPM: Make PM_TRACE more architecture independent
Johannes Berg [Mon, 19 Nov 2007 22:46:16 +0000 (23:46 +0100)]
PM: Make PM_TRACE more architecture independent

When trying to debug a suspend failure I started implementing
PM_TRACE for powerpc. I then noticed that I'm debugging a suspend
failure and so PM_TRACE isn't useful at all, but thought that
nonetheless this could be useful in the future.

Basically, to support PM_TRACE, you add a Kconfig option that
selects PM_TRACE and provides the infrastructure as per the
help text of PM_TRACE.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoPM: Suspend/hibernation debug documentation update (rev. 2)
Rafael J. Wysocki [Mon, 19 Nov 2007 22:43:34 +0000 (23:43 +0100)]
PM: Suspend/hibernation debug documentation update (rev. 2)

Update the suspend/hibernation debugging and testing documentation to describe
the newly introduced testing facilities.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: New testing facility (rev. 2)
Rafael J. Wysocki [Mon, 19 Nov 2007 22:42:31 +0000 (23:42 +0100)]
Hibernation: New testing facility (rev. 2)

Make it possible to test the hibernation core code with the help of the
/sys/power/pm_test attribute introduced for suspend testing in the previous
patch.

Writing an appropriate string to this file causes the hibernation code to work
in one of the test modes defined as follows:

freezer
- test the freezing of processes

devices
- test the freezing of processes and suspending of devices

platform
- test the freezing of processes, suspending of devices and platform global
  control methods(*)

processors
- test the freezing of processes, suspending of devices, platform global
  control methods(*) and the disabling of nonboot CPUs

core
- test the freezing of processes, suspending of devices, platform global
  control methods(*), the disabling of nonboot CPUs and suspending of
  platform/system devices

(*) - the platform global control methods are only available on ACPI systems
      and are only tested if the hibernation mode is set to "platform"

Then, if a hibernation is started by normal means, the hibernation core will
perform its normal operations up to the point indicated by given test level.
Next, it will wait for 5 seconds and carry out the resume operations needed to
transition the system back to the fully functional state.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agosuspend: build fix responding to 2.6.25 kset change
Rafael J. Wysocki [Mon, 28 Jan 2008 23:29:06 +0000 (00:29 +0100)]
suspend: build fix responding to 2.6.25 kset change

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoSuspend: Testing facility (rev. 2)
Rafael J. Wysocki [Mon, 19 Nov 2007 22:41:19 +0000 (23:41 +0100)]
Suspend: Testing facility (rev. 2)

Introduce sysfs attribute /sys/power/pm_test allowing one to test the suspend
core code.  Namely, writing one of the strings:

freezer
devices
platform
processors
core

to this file causes the suspend code to work in one of the test modes defined as
follows:

freezer
- test the freezing of processes

devices
- test the freezing of processes and suspending of devices

platform
- test the freezing of processes, suspending of devices and platform global
  control methods(*)

processors
- test the freezing of processes, suspending of devices, platform global
  control methods and the disabling of nonboot CPUs

core
- test the freezing of processes, suspending of devices, platform global
  control methods, the disabling of nonboot CPUs and suspending of
  platform/system devices

(*) These are ACPI global control methods on ACPI systems

Then, if a suspend is started by normal means, the suspend core will perform
its normal operations up to the point indicated by given test level.  Next, it
will wait for 5 seconds and carry out the resume operations needed to transition
the system back to the fully functional state.

Writing "none" to /sys/power/pm_test turns the testing off.

When open for reading, /sys/power/pm_test contains a space-separated list of all
available tests (including "none" that represents the normal functionality) in
which the current test level is indicated by square brackets.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Add PM_RESTORE_PREPARE and PM_POST_RESTORE notifiers (rev. 2)
Alan Stern [Mon, 19 Nov 2007 22:38:25 +0000 (23:38 +0100)]
Hibernation: Add PM_RESTORE_PREPARE and PM_POST_RESTORE notifiers (rev. 2)

Add PM_RESTORE_PREPARE and PM_POST_RESTORE notifiers to the PM core, to be used
in analogy with the existing PM_HIBERNATION_PREPARE and PM_POST_HIBERNATION
notifiers.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Move function prototypes to header
Adrian Bunk [Mon, 19 Nov 2007 22:36:20 +0000 (23:36 +0100)]
Hibernation: Move function prototypes to header

This patch moves the prototypes of count_highmem_pages() and
restore_highmem() to kernel/power/power.h

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>