]> err.no Git - linux-2.6/log
linux-2.6
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.kernel.org/pub/scm/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.kernel.org/pub/scm/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.kernel.org/pub/scm/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>
16 years agoACPI: Fix mismerge in acpi_hibernation_finish
Rafael J. Wysocki [Mon, 19 Nov 2007 22:33:59 +0000 (23:33 +0100)]
ACPI: Fix mismerge in acpi_hibernation_finish

Some code in acpi_hibernation_finish() was moved to acpi_hibernation_leave(),
but the old copy had been left (it's harmless, but also useless).  Remove it.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Len Brown <len.brown@intel.com>
16 years agoHibernation: Introduce exportable suspend ioctls header (rev. 2)
Rafael J. Wysocki [Thu, 25 Oct 2007 23:05:05 +0000 (01:05 +0200)]
Hibernation: Introduce exportable suspend ioctls header (rev. 2)

Move the definitions of hibernation ioctls to a separate header file in
include/linux, which can be exported to the user space.

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: Correct definitions of some ioctls (rev. 2)
Rafael J. Wysocki [Thu, 25 Oct 2007 23:03:33 +0000 (01:03 +0200)]
Hibernation: Correct definitions of some ioctls (rev. 2)

Three ioctl numbers belonging to the hibernation userland interface,
SNAPSHOT_ATOMIC_SNAPSHOT, SNAPSHOT_AVAIL_SWAP, SNAPSHOT_GET_SWAP_PAGE,
are defined in a wrong way (eg. not portable).  Provide new ioctl numbers for
these ioctls and mark the existing ones as deprecated.

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: Mark SNAPSHOT_SET_SWAP_FILE ioctl as deprecated (rev. 2)
Rafael J. Wysocki [Thu, 25 Oct 2007 23:02:15 +0000 (01:02 +0200)]
Hibernation: Mark SNAPSHOT_SET_SWAP_FILE ioctl as deprecated (rev. 2)

Mark the SNAPSHOT_SET_SWAP_FILE ioctl belonging to the hibernation userland
interface as deprecated.

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: Rework platform support ioctls (rev. 2)
Rafael J. Wysocki [Thu, 25 Oct 2007 23:01:10 +0000 (01:01 +0200)]
Hibernation: Rework platform support ioctls (rev. 2)

Modify the hibernation userland interface by adding two new ioctls to it,
SNAPSHOT_PLATFORM_SUPPORT and SNAPSHOT_POWER_OFF, that can be used,
respectively, to switch the hibernation platform support on/off and to make the
kernel transition the system to the hibernation state (eg. ACPI S4) using the
platform (eg. ACPI) driver.

These ioctls are intended to replace the misdesigned SNAPSHOT_PMOPS ioctl,
which from now is regarded as obsolete and will be removed in the future.

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: Introduce SNAPSHOT_GET_IMAGE_SIZE ioctl
Rafael J. Wysocki [Thu, 25 Oct 2007 22:59:31 +0000 (00:59 +0200)]
Hibernation: Introduce SNAPSHOT_GET_IMAGE_SIZE ioctl

Add a new ioctl, SNAPSHOT_GET_IMAGE_SIZE, returning the size of the (just
created) hibernation image, to the hibernation userland interface.

This ioctl is necessary so that the userland utilities using the interface need
not access the hibernation image header, owned by the kernel, in order to obtain
the size of the image.

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 agoPCI: make pci_bus a struct device
Greg Kroah-Hartman [Wed, 23 May 2007 02:47:54 +0000 (22:47 -0400)]
PCI: make pci_bus a struct device

This moves the pci_bus class device to be a real struct device and at
the same time, place it in the device tree in the correct location.

Note, the old "bridge" symlink is now gone, but this was a non-standard
link and no userspace program used it.  If you need to determine the
device that the bus is on, follow the standard device symlink, or walk
up the device tree.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI: fix codingstyle issues in include/linux/pci.h
Greg Kroah-Hartman [Wed, 30 Jan 2008 23:21:33 +0000 (15:21 -0800)]
PCI: fix codingstyle issues in include/linux/pci.h

Fixes a number of coding style issues in pci.h.
It's a tad more readable now...

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI: fix codingstyle issues in drivers/pci/pci.h
Greg Kroah-Hartman [Wed, 30 Jan 2008 23:21:33 +0000 (15:21 -0800)]
PCI: fix codingstyle issues in drivers/pci/pci.h

Fixes a few coding style issues in the internal pci.h file

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI: PCIE ASPM support
Shaohua Li [Thu, 24 Jan 2008 02:21:57 +0000 (10:21 +0800)]
PCI: PCIE ASPM support

PCI Express ASPM defines a protocol for PCI Express components in the D0
state to reduce Link power by placing their Links into a low power state
and instructing the other end of the Link to do likewise. This
capability allows hardware-autonomous, dynamic Link power reduction
beyond what is achievable by software-only controlled power management.
However, The device should be configured by software appropriately.
Enabling ASPM will save power, but will introduce device latency.

This patch adds ASPM support in Linux. It introduces a global policy for
ASPM, a sysfs file /sys/module/pcie_aspm/parameters/policy can control
it. The interface can be used as a boot option too. Currently we have
below setting:
        -default, BIOS default setting
        -powersave, highest power saving mode, enable all available ASPM
state
and clock power management
        -performance, highest performance, disable ASPM and clock power
management
By default, the 'default' policy is used currently.

In my test, power difference between powersave mode and performance mode
is about 1.3w in a system with 3 PCIE links.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI: Fix fakephp deadlock
Ian Abbott [Fri, 25 Jan 2008 16:23:56 +0000 (16:23 +0000)]
PCI: Fix fakephp deadlock

If the fakephp driver is used to emulate removal of a PCI device by
writing text string "0" to the "power" sysfs attribute file, this causes
its parent directory and its contents (including the "power" file) to be
deleted before the write operation returns.  Unfortunately, it ends up
in a deadlock waiting for itself to complete.

The deadlock is as follows: sysfs_write_file calls flush_write_buffer
which calls sysfs_get_active_two before calling power_write_file in
pci_hotplug_core.c via the sysfs store operation. The power_write_file
function calls disable_slot in fakephp.c via the slot operation.  The
disable_slot function calls remove_slot which calls pci_hp_deregister
(back in pci_hotplug_core.c) which calls fs_remove_slot which calls
sysfs_remove_file to remove the "power" file. The sysfs_remove_file
function calls sysfs_hash_and_remove which calls sysfs_addrm_finish
which calls sysfs_deactivate. The sysfs_deactivate function sees that
something has an active reference on the sysfs_dirent (from the
previous call to sysfs_get_active_two back up the call stack somewhere)
so waits for the active reference to go away, which is of course
impossible.

The problem has been present since 2.6.21.

This patch breaks the deadlock by queuing work queue items on a single-
threaded work queue to remove a slot from sysfs, and to rescan the PCI
buses.  There is also some protection against disabling a slot that is
already being removed.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Cc: Kristen Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI: modify SB700 SATA MSI quirk
Shane Huang [Fri, 25 Jan 2008 06:46:24 +0000 (15:46 +0900)]
PCI: modify SB700 SATA MSI quirk

SB700 SATA MSI bug will be fixed in SB700 revision A21 at hardware
level, but the SB700 revision older than A21 will also be found in the
market.  This patch modify the original quirk commit
bc38b411fe696fad32b261f492cb4afbf1835256 instead of withdrawing it.
The patch also removes quirk to 0x4395 because 0x4395 is SB800 device
ID.

Signed-off-by: Shane Huang <shane.huang@amd.com>
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI: Run ACPI _OSC method on root bridges only
Andrew Patterson [Wed, 23 Jan 2008 00:18:27 +0000 (17:18 -0700)]
PCI: Run ACPI _OSC method on root bridges only

According to the PCI Firmware Specification Revision 3.0 section 4.5, _OSC
should only be called on a root brdige.  Here is the relevant passage: "The
_OSC interface defined in this section applies only to Host Bridge ACPI
devices that originate PCI, PCI-X, or PCI Express hierarchies". Changed the
code to find the parent root bridge of the device and call _OSC on that.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI ACPI: AER driver should only register PCIe devices with _OSC
Andrew Patterson [Wed, 23 Jan 2008 00:18:17 +0000 (17:18 -0700)]
PCI ACPI: AER driver should only register PCIe devices with _OSC

AER is only used with PCIe devices so we should only check PCIe devices for
_OSC support.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI ACPI: Added a function to register _OSC with only PCIe devices.
Andrew Patterson [Wed, 23 Jan 2008 00:18:12 +0000 (17:18 -0700)]
PCI ACPI: Added a function to register _OSC with only PCIe devices.

The function pci_osc_support_set() traverses every root bridge when
checking for _OSC support for a capability.  It quits as soon as it finds a
device/bridge that doesn't support the requested capability. This won't
work for systems that have mixed PCI and PCIe bridges when checking for
PCIe features.  I split this function into two -- pci_osc_support_set() and
pcie_osc_support_set(). The latter is used when only PCIe devices should be
traversed.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI: constify function pointer tables
Jan Engelhardt [Tue, 22 Jan 2008 19:53:43 +0000 (20:53 +0100)]
PCI: constify function pointer tables

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agoPCI: Convert drivers/pci/proc.c to use unlocked_ioctl
Mathieu Segaud [Thu, 10 Jan 2008 13:27:12 +0000 (14:27 +0100)]
PCI: Convert drivers/pci/proc.c to use unlocked_ioctl

Change access to inode thru file->f_dentry->d_inode, and add explicit
lock/unlock_kernel() calls.

Signed-off-by: Mathieu Segaud <mathieu.segaud@regala.cx>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agopciehp: block new requests from the device before power off
Kenji Kaneshige [Thu, 20 Dec 2007 10:46:33 +0000 (19:46 +0900)]
pciehp: block new requests from the device before power off

Disable Bus Master, SERR# and INTx to ensure that no new Requests will
be generated from the device before turning power off, in accordance
with the specification.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
16 years agopciehp: workaround against Bad DLLP during power off
Kenji Kaneshige [Thu, 20 Dec 2007 10:45:09 +0000 (19:45 +0900)]
pciehp: workaround against Bad DLLP during power off

Set Bad DLLP Mask bit in Correctable Error Mask Register during
turning power off the slot.

This is the workaround against Bad DLLP error that sometimes happen
during turning power off on the slot which conforms to PCI Express
1.0a spec. The cause of this error seems that PCI Express 1.0a spec
doesn't have the following consideration that was added to PCI Express
1.1 spec.

    "If the port is associated with a hot-pluggable slot (Hot-Plug
    Capable bit in the Slot Capabilities register set to 1b), and
    Power Controller Control bit in Slot Control register is 1b(Off),
    then any transition to DL Inactive must not be considered an
    error."

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>