pandora-kernel.git
15 years agor8169: shuffle some registers handling around (8168 operation only)
Francois Romieu [Sun, 1 Jun 2008 10:31:57 +0000 (12:31 +0200)]
r8169: shuffle some registers handling around (8168 operation only)

I can not argue strongly for (or against) a specific ordering
on a purely technical ground but the patch avoids to swallow
Realtek's changes in one big, hard-to-read gulp.

Let aside the way the RxConfig register is written (see
rtl_set_rx_tx_config_registers / RxConfig / rtl_set_rx_mode),
this change brings the registers write ordering closer with
Realtek's driver one (version 8.006.00) for the 8168 chipsets.

More 8168 specific code which touches the Configx registers will
be added in the section covered by Cfg9346_UnLock / Cfg9346_Lock.

This code should not be the cause of regression for 810x and
8110 users.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Edward Hsu <edward_hsu@realtek.com.tw>
15 years agor8169: new phy init parameters for the 8168b
Francois Romieu [Fri, 30 May 2008 14:11:48 +0000 (16:11 +0200)]
r8169: new phy init parameters for the 8168b

The new parameters are synced with Realtek's driver
version 8.006.00.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Edward Hsu <edward_hsu@realtek.com.tw>
15 years agor8169: update phy init parameters
Francois Romieu [Fri, 30 May 2008 14:07:07 +0000 (16:07 +0200)]
r8169: update phy init parameters

The modified parameters are synced with Realtek's driver
version 8.006.00.

The change should only be noticeable with some 8168c.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Edward Hsu <edward_hsu@realtek.com.tw>
15 years agor8169: wake up the PHY of the 8168
Francois Romieu [Wed, 3 Sep 2008 22:17:12 +0000 (00:17 +0200)]
r8169: wake up the PHY of the 8168

This is typically needed when some other OS puts the PHY
to sleep due to the disabling of WOL options in the BIOS
of the system.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Tested-by: Chiaki Ishikawa <chiaki.ishikawa@ubin.jp>
Cc: Edward Hsu <edward_hsu@realtek.com.tw>
Cc: RyanKao <ryankao@realtek.com.tw>
15 years agoaf_key: fix SADB_X_SPDDELETE response
Tobias Brunner [Fri, 10 Oct 2008 21:07:03 +0000 (14:07 -0700)]
af_key: fix SADB_X_SPDDELETE response

When deleting an SPD entry using SADB_X_SPDDELETE, c.data.byid is not
initialized to zero in pfkey_spddelete(). Thus, key_notify_policy()
responds with a PF_KEY message of type SADB_X_SPDDELETE2 instead of
SADB_X_SPDDELETE.

Signed-off-by: Tobias Brunner <tobias.brunner@strongswan.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
15 years agoide: Remove ide_spin_wait_hwgroup() and use special requests instead
Elias Oltmanns [Fri, 10 Oct 2008 20:39:40 +0000 (22:39 +0200)]
ide: Remove ide_spin_wait_hwgroup() and use special requests instead

Use a special request for serialisation purposes and get rid of the
awkward ide_spin_wait_hwgroup(). This also involves converting the
ide_devset structure so it can be shared by the /proc and the ioctl code.

Signed-off-by: Elias Oltmanns <eo@nebensachen.de>
[bart: use rq->cmd[] directly]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: move IDE{FLOPPY,TAPE}_WAIT_CMD defines to <linux/ide.h>
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:39 +0000 (22:39 +0200)]
ide: move IDE{FLOPPY,TAPE}_WAIT_CMD defines to <linux/ide.h>

While at it:

* IDE{FLOPPY,TAPE}_WAIT_CMD -> WAIT_{FLOPPY,TAPE}_CMD

* Use enum for WAIT_* defines.

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_do_test_unit_ready() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:39 +0000 (22:39 +0200)]
ide: add ide_do_test_unit_ready() helper

* Add ide_do_test_unit_ready() helper and convert ide-{floppy,tape}.c
  to use it.

* Remove no longer used idetape_create_test_unit_ready_cmd().

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_do_start_stop() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:39 +0000 (22:39 +0200)]
ide: add ide_do_start_stop() helper

* Add ide_do_start_stop() helper and convert ide-{floppy,tape}.c
  to use it.

* Remove no longer used idefloppy_create_start_stop_cmd()
  and idetape_create_load_unload_cmd().

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_set_media_lock() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:38 +0000 (22:39 +0200)]
ide: add ide_set_media_lock() helper

* Set IDE_AFLAG_NO_DOORLOCK in idetape_get_mode_sense_result(), check it
  in ide_tape_set_media_lock() and cleanup idetape_create_prevent_cmd().

* Set IDE_AFLAG_NO_DOORLOCK in ide_floppy_create_read_capacity_cmd() and
  check it instead of IDE_AFLAG_CLIK_DRIVE in ide_floppy_set_media_lock().

* Add ide_set_media_lock() helper and convert ide-{floppy,tape}.c to use it.

* Remove no longer used ide*_create_prevent_cmd()/ide*_set_media_lock().

* Update comment in <linux/ide.h> accordingly.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: move floppy ioctls handling to ide-floppy_ioctl.c
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:38 +0000 (22:39 +0200)]
ide-floppy: move floppy ioctls handling to ide-floppy_ioctl.c

While at it:

- idefloppy_create_read_capacity_cmd() -> ide_floppy_create_read_capacity_cmd()
- idefloppy_create_mode_sense_cmd() -> ide_floppy_create_mode_sense_cmd()
- idefloppy_create_request_sense_cmd() -> ide_floppy_create_request_sense_cmd()
- idefloppy_create_format_unit_cmd() -> ide_floppy_create_format_unit_cmd()
- idefloppy_get_sfrp_bit() -> ide_floppy_get_sfrp_bit()

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: ->{srfp,wp} -> IDE_AFLAG_{SRFP,WP}
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:38 +0000 (22:39 +0200)]
ide-floppy: ->{srfp,wp} -> IDE_AFLAG_{SRFP,WP}

Add IDE_AFLAG_{SRFP,WP} drive->atapi_flags and use them
instead of ->{srfp,wp} struct ide_floppy_obj fields.

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_queue_pc_tail() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:38 +0000 (22:39 +0200)]
ide: add ide_queue_pc_tail() helper

* Add ide_queue_pc_tail() and convert ide-{floppy,tape}.c to use it
  instead of ide*_queue_pc_tail().

* Remove no longer used ide*_queue_pc_tail().

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_queue_pc_head() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:37 +0000 (22:39 +0200)]
ide: add ide_queue_pc_head() helper

* Move REQ_IDETAPE_* enums to <linux/ide.h>.

* Add ide_queue_pc_head() and convert ide-{floppy,tape}.c to use it
  instead of ide*_queue_pc_head().

* Remove no longer used ide*_queue_pc_head().

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_init_pc() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:37 +0000 (22:39 +0200)]
ide: add ide_init_pc() helper

* Add IDE_PC_BUFFER_SIZE define.

* Add ide_init_pc() and convert ide-{floppy,tape}.c to use it
  instead of ide*_init_pc().

* Remove no longer used IDE*_PC_BUFFER_SIZE and ide*_init_pc().

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: add ide_tape_set_media_lock() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:37 +0000 (22:39 +0200)]
ide-tape: add ide_tape_set_media_lock() helper

Add ide_tape_set_media_lock() helper and convert idetape_mtioctop(),
idetape_chrdev_open() and idetape_chrdev_release() to use it.

There should be no functional changes caused by this patch (it is
OK to modify ->door_locked if idetape_create_prevent_cmd() fails).

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: add ide_floppy_set_media_lock() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:37 +0000 (22:39 +0200)]
ide-floppy: add ide_floppy_set_media_lock() helper

Add ide_floppy_set_media_lock() helper and convert idefloppy_open(),
idefloppy_release() and ide_floppy_lockdoor() to use it.

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_io_buffers() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:36 +0000 (22:39 +0200)]
ide: add ide_io_buffers() helper

* Make ->io_buffers method return number of bytes transferred.

* Use ide_end_request() instead of idefloppy_end_request()
  in ide_floppy_io_buffers() and then move the call out to
  ide_pc_intr().

* Add ide_io_buffers() helper and convert ide-{floppy,scsi}.c
  to use it instead of ide*_io_buffers().

There should be no functional changes caused by this patch.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: cleanup ide_scsi_io_buffers()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:36 +0000 (22:39 +0200)]
ide-scsi: cleanup ide_scsi_io_buffers()

Preparation for ide_{floppy,scsi}_io_buffers() unification.

Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: remove MODE_SENSE_* defines
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:36 +0000 (22:39 +0200)]
ide-floppy: remove MODE_SENSE_* defines

Only MODE_SENSE_CURRENT (0x00) is ever used so just remove
these defines and then drop no longer needed 'type' argument
from idefloppy_create_mode_sense_cmd().

Cc: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-{floppy,tape}: remove packet command stack
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:36 +0000 (22:39 +0200)]
ide-{floppy,tape}: remove packet command stack

* Add 'struct ide_atapi_pc queued_pc' to struct ide_{floppy,tape}_obj
  and switch ide*_do_request() to use it (there can be only one active
  request for a given device).

* Add 'struct ide_atapi_pc request_sense_pc' to struct ide_*_obj
  and switch ide*_retry_pc() to use it.

* Remove needless {floppy,tape}->pc assignment from ide*_setup().

* Remove no longer needed ide*_next_pc_storage(), pc_stack[],
  rq_stack_index, IDE*_PC_STACK and DBG_PC_STACK.

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-{floppy,tape}: remove request stack
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:35 +0000 (22:39 +0200)]
ide-{floppy,tape}: remove request stack

* Add 'struct request request_sense_rq' to struct ide_{floppy,tape}_obj
  and switch ide*_retry_pc() to use it (there can be only one REQUEST SENSE
  request active for a given device).

* Remove no longer needed ide*_next_rq_storage(), rq_stack[]
  and rq_stack_index.

* DBG_PCRQ_STACK -> DBG_PC_STACK

* Update comments for IDE*_PC_STACK and idetape_queue_pc_{head,tail}().

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-generic: handle probing of legacy io-ports v5
Borislav Petkov [Fri, 10 Oct 2008 20:39:35 +0000 (22:39 +0200)]
ide-generic: handle probing of legacy io-ports v5

Avoid probing the io-ports in case an IDE PCI controller is present and it
uses the legacy iobases. If we still want to enforce the probing, we do

ide_generic.probe_mask=0x3f

on the kernel command line. The iobase checking code is
adapted from drivers/ata/pata_legacy.c after converting hex
pci ids into their corresponding macros in <linux/pci_ids.h>.

Also, check only BAR0/2 resources since those are guaranteed
by the workaround in drivers/pci/probe.c:pci_setup_device().

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
[bart: trivial printk() fixups]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: use scatterlists for pio transfers
Borislav Petkov [Fri, 10 Oct 2008 20:39:35 +0000 (22:39 +0200)]
ide-floppy: use scatterlists for pio transfers

Use hwif->sg_table for pio transfers instead of fumbling
with block layer internals in the driver. Also, make debug
statements more informative in .._do_request() while at it.

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
[bart: fixup pc->b_count in idefloppy_blockpc_cmd()]
[bart: add missing include (noticed by Stephen Rothwell)]
[bart: map hwif->sg_{table,nents} on pc->{sg,sg_cnt} (multi-IRQs-per-sg fix)]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: remove idetape_init_rq()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:34 +0000 (22:39 +0200)]
ide-tape: remove idetape_init_rq()

idetape_init_rq() is only used in idetape_queue_pc_head()
so inline it there.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: add ide_floppy_format_ioctl() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:34 +0000 (22:39 +0200)]
ide-floppy: add ide_floppy_format_ioctl() helper

* Factor out IDEFLOPPY_IOCTL_FORMAT_* ioctls handling from
  idefloppy_ioctl() to ide_floppy_format_ioctl().

While at it:

* Pass 'drive' instead of 'floppy' to ide_floppy_format_unit().

* idefloppy_get_format_progress() -> ide_floppy_get_format_progress()

There should be no functional changes caused by this patch.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: remove needless parens
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:34 +0000 (22:39 +0200)]
ide-floppy: remove needless parens

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_check_atapi_device() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:34 +0000 (22:39 +0200)]
ide: add ide_check_atapi_device() helper

* Add ide_check_atapi_device() to ide-atapi.c and convert
  ide-{floppy,tape}.c to use it instead of ide*_identify_device().

While at it:

* Add DRV_NAME defines to ide-{floppy,tape}.c.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: move ioctls handling to ide-ioctls.c
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:33 +0000 (22:39 +0200)]
ide: move ioctls handling to ide-ioctls.c

* Move ioctls handling to ide-ioctls.c
  (except HDIO_DRIVE_TASKFILE for now).

* Make ide_{cmd,task}() static.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: cleanup generic_ide_ioctl()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:33 +0000 (22:39 +0200)]
ide: cleanup generic_ide_ioctl()

* Fix intendation for the main 'switch ()'.

* 'switch ()' -> 'if ()' for HDIO_DRIVE_TASKFILE case.

* Move HDIO_SET_NICE case under HDIO_GET_NICE one.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_setting_ioctl() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:33 +0000 (22:39 +0200)]
ide: add ide_setting_ioctl() helper

* Add struct ide_ioctl_devset representing ioctl device setting.

* Add ide_setting_ioctl() helper for matching given ioctl
  and its parameters against table of ioctl device settings.

* Convert ide_setting_ioctl() and idedisk_ioctl() to use
  ide_setting_ioctl().

* Un-export ide_setting_mtx.

While at it:

* {get,set}_lba_addressing() -> {get,set}_addressing()

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove ->bus_state field from ide_hwif_t
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:33 +0000 (22:39 +0200)]
ide: remove ->bus_state field from ide_hwif_t

It is always set to BUSSTATE_ON.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add proper PCI PM support (v2)
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:32 +0000 (22:39 +0200)]
ide: add proper PCI PM support (v2)

* Keep pointer to ->init_chipset method also in
  struct ide_host and set it in ide_host_alloc_all().

* Add ide_pci_suspend() and ide_pci_resume() helpers
  (default ->suspend and ->resume implementations).

* ->init_chipset can no longer be marked __devinit.

* Add proper PCI PM support to IDE PCI host drivers
  (rz1000.c and tc86c001.c are skipped for now since
  they need to be converted from using ->init_hwif
  to use ->init_chipset instead).

v2:
* Cleanup CONFIG_PM #ifdef-s per akpm's suggestion.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agohpt366: add hpt3xx_disable_fast_irq() helper
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:32 +0000 (22:39 +0200)]
hpt366: add hpt3xx_disable_fast_irq() helper

* Factor out disabling of "fast interrupt" prediction from
  init_hwif_hpt366() to hpt3xx_disable_fast_irq() helper.

* Use hpt3xx_disable_fast_irq() in ->init_chipset instead of
  ->init_hwif method.

  This is a preparation for adding proper PCI PM support.

While at it:

* Cache chip type in chip_type variable in hpt3xx_disable_fast_irq().

There should be no functional changes caused by this patch.

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: lba_capacity_is_ok() -> ata_id_is_lba_capacity_ok()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:31 +0000 (22:39 +0200)]
ide: lba_capacity_is_ok() -> ata_id_is_lba_capacity_ok()

Rename lba_capacity_is_ok() to ata_id_is_lba_capacity_ok()
and move it to <linux/ata.h> (remove needless parens while at it).

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: ide_id_to_hd_driveid() -> ata_id_to_hd_driveid()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:31 +0000 (22:39 +0200)]
ide: ide_id_to_hd_driveid() -> ata_id_to_hd_driveid()

Rename ide_id_to_hd_driveid() to ata_id_to_hd_driveid()
and move it to <linux/ata.h>.

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use ata_id_is_cfa()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:31 +0000 (22:39 +0200)]
ide: use ata_id_is_cfa()

Use ata_id_is_cfa() in do_identify() instead of open-coding
check for CompactFlash devices (the inline helper also takes
care of detecting CFs advertising themselves as ATA disks).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: ide_id_has_flush_cache_ext() -> ata_id_flush_ext_enabled()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:31 +0000 (22:39 +0200)]
ide: ide_id_has_flush_cache_ext() -> ata_id_flush_ext_enabled()

* Add ata_id_flush_ext_enabled() inline helper to <linux/ata.h>.

* ide_id_has_flush_cache_ext() -> ata_id_flush_ext_enabled()

  The latter one also checks if the command is marked as
  supported in word 83 and validity of words 83 & 86.

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: ide_id_has_flush_cache() -> ata_id_flush_enabled()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:30 +0000 (22:39 +0200)]
ide: ide_id_has_flush_cache() -> ata_id_flush_enabled()

* Add ata_id_flush_enabled() inline helper to <linux/ata.h>.

* ide_id_has_flush_cache() -> ata_id_flush_enabled()

  The latter one also checks if the command is marked as
  supported in word 83 and validity of words 83 & 86.

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: check only for CACHE FLUSH command support in ide_id_has_flush_cache()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:30 +0000 (22:39 +0200)]
ide: check only for CACHE FLUSH command support in ide_id_has_flush_cache()

All devices supporting CACHE FLUSH EXT command should also support
CACHE FLUSH command so it is sufficient to check only for CACHE FLUSH
in ide_id_has_flush_cache().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: idedisk_supports_lba48() -> ata_id_lba48_enabled()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:30 +0000 (22:39 +0200)]
ide: idedisk_supports_lba48() -> ata_id_lba48_enabled()

* Add ata_id_lba48_enabled() inline helper to <linux/ata.h>.

* idedisk_supports_lba48() -> ata_id_lba48_enabled()

  The latter one also checks validity of words 83 & 86.

Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: ide_dev_is_sata() -> ata_id_is_sata()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:30 +0000 (22:39 +0200)]
ide: ide_dev_is_sata() -> ata_id_is_sata()

* Use optimized ATA version check from Sergei in ata_id_is_sata().

* ide_dev_is_sata() -> ata_id_is_sata()

Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: ide_dev_has_iordy() -> ata_id_has_iordy()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:29 +0000 (22:39 +0200)]
ide: ide_dev_has_iordy() -> ata_id_has_iordy()

* Remove (id[ATA_ID_FIELD_VALID] & 2) check from ide_dev_has_iordy()
  (it is for validity of words 64-70, IORDY is in word 49).

* ide_dev_has_iordy() -> ata_id_has_iordy()

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: factor out HDIO_*_NICE ioctl handling to ide_*_nice_ioctl()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:29 +0000 (22:39 +0200)]
ide: factor out HDIO_*_NICE ioctl handling to ide_*_nice_ioctl()

Factor out HDIO_{GET,SET}_NICE ioctl handling from
generic_ide_ioctl() to ide_{get,set}_nice_ioctl().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove ->supports_dsc_overlap field from ide_driver_t
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:29 +0000 (22:39 +0200)]
ide: remove ->supports_dsc_overlap field from ide_driver_t

* Use drive->media and drive->scsi to check if ->dsc_overlap
  can be set by HDIO_SET_NICE ioctl in generic_ide_ioctl().

* Remove unused ->supports_dsc_overlap field from ide_driver_t.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove read-only ->atapi_overlap field from ide_drive_t
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:29 +0000 (22:39 +0200)]
ide: remove read-only ->atapi_overlap field from ide_drive_t

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agocmd640: add __set_prefetch_mode()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:28 +0000 (22:39 +0200)]
cmd640: add __set_prefetch_mode()

Factor out the common code from check_prefetch()
and set_prefetch_mode() to __set_prefetch_mode().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove SECTOR_WORDS define
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:28 +0000 (22:39 +0200)]
ide: remove SECTOR_WORDS define

Just use SECTOR_SIZE instead.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: /proc/ide/hd*/settings rework
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:28 +0000 (22:39 +0200)]
ide: /proc/ide/hd*/settings rework

* Add struct ide_devset, S_* flags, *DEVSET() & ide*_devset_*() macros.

* Add 'const struct ide_devset **settings' to ide_driver_t.

* Use 'const struct ide_devset **settings' in ide_drive_t instead of
  'struct ide_settings_s *settings'.  Then convert core code and device
  drivers to use struct ide_devset and co.:

  - device settings are no longer allocated dynamically for each device
    but instead there is an unique struct ide_devset instance per setting

  - device driver keeps the pointer to the table of pointers to its
    settings in ide_driver_t.settings

  - generic settings are kept in ide_generic_setting[]

  - ide_proc_[un]register_driver(), ide_find_setting_by_name(),
    ide_{read,write}_setting() and proc_ide_{read,write}_settings()
    are updated accordingly

  - ide*_add_settings() are removed

* Remove no longer used __ide_add_setting(), ide_add_setting(),
  __ide_remove_setting() and auto_remove_settings().

* Remove no longer used TYPE_*, SETTING_*, ide_procset_t
  and ide_settings_t.

* ->keep_settings, ->using_dma, ->unmask, ->noflush, ->dsc_overlap,
  ->nice1, ->addressing, ->wcache and ->nowerr ide_drive_t fields
  can now be bitfield flags.

While at it:

* Rename ide_find_setting_by_name() to ide_find_setting().

* Rename write_wcache() to set_wcache().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: preparations for /proc/ide/hd*/settings rework
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:27 +0000 (22:39 +0200)]
ide: preparations for /proc/ide/hd*/settings rework

After rework settings will be no longer created dynamically
for each device so we need to make some fixups first.

* Use set_[ksettings,unmaskirq]() as a set function for
  ["keepsettings","unmaskirq"] setting.

* Allow writes to ["io_32bit","unmaskirq"] settings also when
  drive->no_[io_32bit,unmask] is set (this is checked later inside
  set_[io_32bit,unmaskirq]() anywyay and keeps consistency with
  the corresponding HDIO_SET_[32BIT,UNMASKINTR] ioctls).

* Use max possible multi sectors value (16) as an allowed max for
  "multcount" setting.  set_multcount() set function checks against
  device's max possbile value anyway and it makes the proc setting
  consistent with the corresponding HDIO_SET_MULTCOUNT ioctl.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: call ide_proc_register_driver() later
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:27 +0000 (22:39 +0200)]
ide: call ide_proc_register_driver() later

Call ide_proc_register_driver() in ide*_setup() (just before
ide*_add_settings() call) instead of in ->probe method.

Despite being basically a preparation for /proc/ide/hd*/settings
rework this is a nice cleanup in itself.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: include <linux/hdreg.h> only when needed
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:27 +0000 (22:39 +0200)]
ide: include <linux/hdreg.h> only when needed

* Include <linux/ata.h> directly in <linux/ide.h>
  instead of through <linux/hdreg.h>.

* Include <linux/hdreg.h> only when needed.

Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove CONFIG_IDEDISK_MULTI_MODE
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:26 +0000 (22:39 +0200)]
ide: remove CONFIG_IDEDISK_MULTI_MODE

Use multi PIO by default when available and remove no longer
needed CONFIG_IDEDISK_MULTI_MODE (it should be safe nowadays,
despite to what help entry has been saying).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: check drive->present in ide_get_paired_drive()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:26 +0000 (22:39 +0200)]
ide: check drive->present in ide_get_paired_drive()

* Change ide_get_paired_drive() to return NULL if peer device
  is not present and update all users accordingly.

While at it:

* ide_get_paired_drive() -> ide_get_pair_dev()

* Use ide_get_pair_dev() in cs5530.c, sc1200.c and via82cxxx.c.

There should be no functional changes caused by this patch.

Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove needless drive->present checks from device drivers
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:24 +0000 (22:39 +0200)]
ide: remove needless drive->present checks from device drivers

Remove needless drive->present checks from ->probe methods
(device model takes care of that).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove unused _IDE_C and _IDE_DISK defines
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:24 +0000 (22:39 +0200)]
ide: remove unused _IDE_C and _IDE_DISK defines

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove IDE_CHIPSET_* macros
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:24 +0000 (22:39 +0200)]
ide: remove IDE_CHIPSET_* macros

They just obfuscate the code.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove no longer needed BUG_ON()-s from init_irq()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:23 +0000 (22:39 +0200)]
ide: remove no longer needed BUG_ON()-s from init_irq()

init_irq() is now called only during initial host registration
so these BUG_ON()-s are no loner needed (+ the last one was done
too late anyway).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: enhance ide_busy_sleep()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:23 +0000 (22:39 +0200)]
ide: enhance ide_busy_sleep()

* Make ide_busy_sleep() take timeout value as a parameter
  and also allow use of AltStatus Register if requested with
  altstatus parameter.  Update existing users accordingly.

* Convert ide_driveid_update() and actual_try_to_identify()
  to use ide_busy_sleep().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: fix EXABYTENEST handling in probe_for_drive()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:23 +0000 (22:39 +0200)]
ide: fix EXABYTENEST handling in probe_for_drive()

Fix EXABYTENEST handling in probe_for_drive() (so drive->present
is checked for "nested" device) and cleanup enable_nest().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: use the new object_is_in_stack() helper
FUJITA Tomonori [Fri, 10 Oct 2008 20:39:22 +0000 (22:39 +0200)]
ide-cd: use the new object_is_in_stack() helper

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: re-code ide_fixstring() loop to be less evil
Linus Torvalds [Fri, 10 Oct 2008 20:39:22 +0000 (22:39 +0200)]
ide: re-code ide_fixstring() loop to be less evil

On Friday 25 July 2008, Linus Torvalds wrote:
>
> On Fri, 25 Jul 2008, Ben Dooks wrote:
> >
> > personally, i would much prefer to see the loop being less evil
> > like:
> >
> >  for (p = s; p < end; p += 2)
> >  be16_to_cpus((u16 *)p);
>
> Well, in this case, the code actually depends on 'p' being back at the
> start of the buffer by the end of it all, so it would need some more
> changes than that.
>
> But yes, I applied David's patch, but I _also_ suspect that we would be
> better off without code that does horrid things like casts and assignments
> inside the function arguments.
>
> So it would be nice to re-code that loop to be more readable. But due to
> the reliance of 'p' being 's' after the loop, the minimal patch would be
> something like the appended.
>
> Bartlomiej - take this or not, I'm not going to commit it - I haven't
> tested it, nor do I even have any machines that would trigger it. So this
> is more a "maybe something like this" than anything else.

From: Linus Torvalds <torvalds@linux-foundation.org>
CC: Ben Dooks <ben-linux@fluff.org>
Cc: David Miller <davem@davemloft.net>
Cc: harvey.harrison@gmail.com
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove no longer needed ide_drive_t fields
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:22 +0000 (22:39 +0200)]
ide: remove no longer needed ide_drive_t fields

Remove ->remap_0_to_1 and ->sect0 (they are always zero now).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use ATA_* defines instead of *_STAT and *_ERR ones
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:21 +0000 (22:39 +0200)]
ide: use ATA_* defines instead of *_STAT and *_ERR ones

* ERR_STAT   -> ATA_ERR
* INDEX_STAT -> ATA_IDX
* ECC_STAT   -> ATA_CORR
* DRQ_STAT   -> ATA_DRQ
* SEEK_STAT  -> ATA_DSC
* WRERR_STAT -> ATA_DF
* READY_STAT -> ATA_DRDY
* BUSY_STAT  -> ATA_BUSY

* MARK_ERR   -> ATA_AMNF
* TRK0_ERR   -> ATA_TRK0NF
* ABRT_ERR   -> ATA_ABORTED
* MCR_ERR    -> ATA_MCR
* ID_ERR     -> ATA_IDNF
* MC_ERR     -> ATA_MC
* ECC_ERR    -> ATA_UNC
* ICRC_ERR   -> ATA_ICRC

* BBD_ERR    -> ATA_BBK

Also:

* ILI_ERR    -> ATAPI_ILI
* EOM_ERR    -> ATAPI_EOM
* LFS_ERR    -> ATAPI_LFS

* CD         -> ATAPI_COD
* IO         -> ATAPI_IO

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agohd: WIN_* -> ATA_CMD_*
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:21 +0000 (22:39 +0200)]
hd: WIN_* -> ATA_CMD_*

* Use ATA_CMD_* defines instead of WIN_* ones.

* Include <linux/ata.h> directly instead of through <linux/hdreg.h>.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: WIN_* -> ATA_CMD_*
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:21 +0000 (22:39 +0200)]
ide: WIN_* -> ATA_CMD_*

* Use ATA_CMD_* defines instead of WIN_* ones.

While at it:

* EXABYTE_ENABLE_NEXT -> ATA_EXABYTE_ENABLE_NEST

* SETFEATURES_{EN,DIS}_WCACHE -> SETFEATURES_WC_{ON,OFF}

* SETFEATURES_{EN,DIS}_AAM -> SETFEATURES_AAM_{ON,OFF}

* SMART_* -> ATA_SMART_*

* Remove stale comment from ide-proc.c.

Partially based on earlier work by Chris Wedgwood.

Acked-by: Chris Wedgwood <cw@f00f.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agolibata: WIN_* -> ATA_CMD_*
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:20 +0000 (22:39 +0200)]
libata: WIN_* -> ATA_CMD_*

Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-disk: use ata_id_hpa_enabled()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:20 +0000 (22:39 +0200)]
ide-disk: use ata_id_hpa_enabled()

idedisk_supports_hpa() -> ata_id_hpa_enabled().

The latter one also checks validity of words 82 & 85.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-disk: use ata_id_wcache_enabled()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:20 +0000 (22:39 +0200)]
ide-disk: use ata_id_wcache_enabled()

Replace open-coded check by ata_id_wcache_enabled()
(which also checks validity of word 85).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use ata_id_current_chs_valid()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:19 +0000 (22:39 +0200)]
ide: use ata_id_current_chs_valid()

Replace open-coded checks by ata_id_current_chs_valid().

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove drive->driveid
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:19 +0000 (22:39 +0200)]
ide: remove drive->driveid

* Factor out HDIO_[OBSOLETE,GET]_IDENTITY ioctls handling
  to ide_get_identity_ioctl().

* Use temporary buffer in ide_get_identity_ioctl() instead
  of accessing drive->id directly.

* Add ide_id_to_hd_driveid() inline to convert raw id into
  struct hd_driveid format (needed on big-endian).

* Use ide_id_to_hd_driveid() in ide_get_identity_ioctl(),
  cleanup ide_fix_driveid() and switch ide to use use raw id.

* Remove no longer needed drive->driveid.

  This leaves us with 3 users of struct hd_driveid in tree:
  - arch/um/drivers/ubd_kern.c
  - drivers/block/xsysace.c
  - drivers/usb/storage/isd200.c

While at it:

* Use ata_id_u{32,64}() and ata_id_has_{dma,lba,iordy}() macros.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: make drive->id an union (take 2)
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:19 +0000 (22:39 +0200)]
ide: make drive->id an union (take 2)

Make drive->id an unnamed union so id can be accessed either by using
'u16 *id' or 'struct hd_driveid *driveid'.  Then convert all existing
drive->id users accordingly (using 'u16 *id' when possible).

This is an intermediate step to make ide 'struct hd_driveid'-free.

While at it:

- Add missing KERN_CONTs in it821x.c.

- Use ATA_ID_WORDS and ATA_ID_*_LEN defines.

- Remove unnecessary checks for drive->id.

- s/drive_table/table/ in ide_in_drive_list().

- Cleanup ide_config_drive_speed() a bit.

- s/drive1/dev1/ & s/drive0/dev0/ in ide_undecoded_slave().

v2:
Fix typo in drivers/ide/ppc/pmac.c. (From Stephen Rothwell)

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: cleanup ide_fix_driveid()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:18 +0000 (22:39 +0200)]
ide: cleanup ide_fix_driveid()

Do all __le16_to_cpu() swapping in one loop.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: cleanup ide_disk_init_mult_count()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:18 +0000 (22:39 +0200)]
ide: cleanup ide_disk_init_mult_count()

* Remove superfluous checks for drive->mult_req.

* No need to zero drive's fields.

* Move the common code out of #ifdef scope.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove superfluous check from ide_disk_special()
Bartlomiej Zolnierkiewicz [Fri, 10 Oct 2008 20:39:18 +0000 (22:39 +0200)]
ide: remove superfluous check from ide_disk_special()

This condition is checked by both ide_disk_init_mult_count()
and set_multcount() so no need to do it again in ide_disk_special().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: Buildfix when IDETAPE_DEBUG_LOG is set to 1.
Mark de Wever [Fri, 10 Oct 2008 20:39:17 +0000 (22:39 +0200)]
ide-tape: Buildfix when IDETAPE_DEBUG_LOG is set to 1.

The format specifier for rq->sector didn't specify the proper size and
signedness. Borislav Petkov discovered that the signedness for
rq->nr_sectors and rq->current_nr_sectors also were incorrect.

Signed-off-by: Mark de Wever <koraq@xs4all.nl>
Acked-by: Borislav Petkov <petkovbb@gmail.com>
[bart: remove trailing whitespace]
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoMerge branch 'rcu-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 10 Oct 2008 20:10:51 +0000 (13:10 -0700)]
Merge branch 'rcu-v28-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'rcu-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (21 commits)
  rcu: RCU-based detection of stalled CPUs for Classic RCU, fix
  rcu: RCU-based detection of stalled CPUs for Classic RCU
  rcu: add rcu_read_lock_sched() / rcu_read_unlock_sched()
  rcu: fix sparse shadowed variable warning
  doc/RCU: fix pseudocode in rcuref.txt
  rcuclassic: fix compiler warning
  rcu: use irq-safe locks
  rcuclassic: fix compilation NG
  rcu: fix locking cleanup fallout
  rcu: remove redundant ACCESS_ONCE definition from rcupreempt.c
  rcu: fix classic RCU locking cleanup lockdep problem
  rcu: trace fix possible mem-leak
  rcu: just rename call_rcu_bh instead of making it a macro
  rcu: remove list_for_each_rcu()
  rcu: fixes to include/linux/rcupreempt.h
  rcu: classic RCU locking and memory-barrier cleanups
  rcu: prevent console flood when one CPU sees another AWOL via RCU
  rcu, debug: detect stalled grace periods, cleanups
  rcu, debug: detect stalled grace periods
  rcu classic: new algorithm for callbacks-processing(v2)
  ...

15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris...
Linus Torvalds [Fri, 10 Oct 2008 19:44:43 +0000 (12:44 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/jmorris/security-testing-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
  selinux: Fix an uninitialized variable BUG/panic in selinux_secattr_to_sid()
  selinux: use default proc sid on symlinks
  file capabilities: uninline cap_safe_nice
  Update selinux info in MAINTAINERS and Kconfig help text
  SELinux: add gitignore file for mdp script
  SELinux: add boundary support and thread context assignment
  securityfs: do not depend on CONFIG_SECURITY
  selinux: add support for installing a dummy policy (v2)
  security: add/fix security kernel-doc
  selinux: Unify for- and while-loop style
  selinux: conditional expression type validation was off-by-one
  smack: limit privilege by label
  SELinux: Fix a potentially uninitialised variable in SELinux hooks
  SELinux: trivial, remove unneeded local variable
  SELinux: Trivial minor fixes that change C null character style
  make selinux_write_opts() static

15 years agoMerge branch 'sched-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Fri, 10 Oct 2008 19:42:31 +0000 (12:42 -0700)]
Merge branch 'sched-v28-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'sched-v28-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (38 commits)
  sched debug: add name to sched_domain sysctl entries
  sched: sync wakeups vs avg_overlap
  sched: remove redundant code in cpu_cgroup_create()
  sched_rt.c: resch needed in rt_rq_enqueue() for the root rt_rq
  cpusets: scan_for_empty_cpusets(), cpuset doesn't seem to be so const
  sched: minor optimizations in wake_affine and select_task_rq_fair
  sched: maintain only task entities in cfs_rq->tasks list
  sched: fixup buddy selection
  sched: more sanity checks on the bandwidth settings
  sched: add some comments to the bandwidth code
  sched: fixlet for group load balance
  sched: rework wakeup preemption
  CFS scheduler: documentation about scheduling policies
  sched: clarify ifdef tangle
  sched: fix list traversal to use _rcu variant
  sched: turn off WAKEUP_OVERLAP
  sched: wakeup preempt when small overlap
  kernel/cpu.c: create a CPU_STARTING cpu_chain notifier
  kernel/cpu.c: Move the CPU_DYING notifiers
  sched: fix __load_balance_iterator() for cfq with only one task
  ...

15 years ago[S390] Fix checkstack for s390
Christian Borntraeger [Fri, 10 Oct 2008 19:33:30 +0000 (21:33 +0200)]
[S390] Fix checkstack for s390

With -march=z990 and later gcc can use the long displacement facility
insruction lay for stack register handling. This patch adopts checkstack
to catch lay in addition to ahi and aghi.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] fix initialization of stp
Martin Schwidefsky [Fri, 10 Oct 2008 19:33:29 +0000 (21:33 +0200)]
[S390] fix initialization of stp

chsc_sstpc returns -EIO on error and 0 on success but stp_reset checks
against 1 instead of 0. chsc_sstpc used to return 1 on success, one
call location has not been updated ..

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] 3215: Remove tasklet.
Heiko Carstens [Fri, 10 Oct 2008 19:33:28 +0000 (21:33 +0200)]
[S390] 3215: Remove tasklet.

The 3215 console irq handler used to schedule a tasklet. However the
console irq handler also gets called from the infamous cio_tpi()
function. Which in turn does something like

local_bh_disable()
[call console irq handler]
_local_bh_enable()

_local_bh_enable() prevents execution of softirqs, which is intended
within cio_tpi(). However there might be a new softirq pending because
irq handler scheduled a tasklet.
In order to prevent this behaviour we just get rid of the tasklet.
It's not doing much anyway.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] console flush on panic / reboot
Holger Smolinski [Fri, 10 Oct 2008 19:33:27 +0000 (21:33 +0200)]
[S390] console flush on panic / reboot

The s390 console drivers use the unblank callback of the console
structure to flush the console buffer. In case of a panic or a
reboot the CPU doing the callback can block on the console i/o.
The other CPUs in the system continue to work. For panic this is
not a good idea.

Replace the unblank callback with proper panic/reboot notifier.
These get called after all but one CPU have been stopped.

Signed-off-by: Holger Smolinski <Holger.Smolinski@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] introduce dirty bit for kvm live migration
Florian Funke [Fri, 10 Oct 2008 19:33:26 +0000 (21:33 +0200)]
[S390] introduce dirty bit for kvm live migration

This patch defines a dirty bit in the PGSTE that can be used to implement
dirty pages logging for KVM's live migration. The bit is set in the
ptep_rcp_copy function, which is called to save dirty and referenced information
from the storage key in the PGSTE. The bit can be tested and reset by KVM using
the kvm_s390_test_and_clear_page_dirty function that is introduced by this patch.

Acked-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Florian Funke <ffunke@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] Add ioctl support for EMC Symmetrix Subsystem Control I/O
Nigel Hislop [Fri, 10 Oct 2008 19:33:25 +0000 (21:33 +0200)]
[S390] Add ioctl support for EMC Symmetrix Subsystem Control I/O

EMC Symmetrix Subsystem Control I/O through CKD dasd requires a
specific parameter list sent to the array via a Perform Subsystem
Function CCW. The Symmetrix response is retrieved from the array
via a Read Subsystem Data CCW.

Signed-off-by: Nigel Hislop <hislop_nigel@emc.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] xpram: per device block request queues.
Martin Schwidefsky [Fri, 10 Oct 2008 19:33:24 +0000 (21:33 +0200)]
[S390] xpram: per device block request queues.

The xpram driver uses a single block device queue for all of its
devices so far. With recent kernels removing xpram module fails to
clean up all sysfs files. The next time the xpram module is loaded
you'll get warnings:

  WARNING: at fs/sysfs/dir.c:463 sysfs_add_one+0x5e/0x64()
  sysfs: duplicate filename '35:0' can not be created
  Modules linked in: xpram(+) [last unloaded: xpram]

Followed by the usual WARN_ON output, followed by an error message
from kobject_add_internal, followed by a badness in genhd. Allocating
a block queue per device fixes this.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] dasd: fix message flood for unsolicited interrupts
Stefan Haberland [Fri, 10 Oct 2008 19:33:23 +0000 (21:33 +0200)]
[S390] dasd: fix message flood for unsolicited interrupts

In the unsolicited interupt handler fake IRBs from CIO have to be
ignored because there is nothing to do.
The function dump_sense should not be called if there is no sense
data available.

Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] Move private simple udelay function to arch/s390/lib/delay.c.
Heiko Carstens [Fri, 10 Oct 2008 19:33:22 +0000 (21:33 +0200)]
[S390] Move private simple udelay function to arch/s390/lib/delay.c.

Move cio's private simple udelay function to lib/delay.c and turn it
into something much more readable. So we have all implementations
at one place.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] dcssblk: add >2G DCSSs support and stacked contiguous DCSSs support.
Hongjie Yang [Fri, 10 Oct 2008 19:33:21 +0000 (21:33 +0200)]
[S390] dcssblk: add >2G DCSSs support and stacked contiguous DCSSs support.

The DCSS block device driver is modified to add >2G DCSSs support and
allow a DCSS block device to map to a set of contiguous DCSSs.  The
extmem code is also modified to use new Diagnose x'64' subcodes for
>2G DCSSs.

Signed-off-by: Hongjie Yang <hongjie@us.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] ptrace changes
Martin Schwidefsky [Fri, 10 Oct 2008 19:33:20 +0000 (21:33 +0200)]
[S390] ptrace changes

* System call parameter and result access functions
* Add tracehook calls
* Split syscall_trace into two functions do_syscall_trace_enter and
  do_syscall_trace_exit

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] s390: use sys_pause for 31bit pause entry point
Christoph Hellwig [Fri, 10 Oct 2008 19:33:19 +0000 (21:33 +0200)]
[S390] s390: use sys_pause for 31bit pause entry point

sys32_pause is a useless copy of the generic sys_pause.
(and it's certainly not there for old sparc32 binaries..)

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] qdio enhanced SIGA (iqdio) support.
Klaus-Dieter Wacker [Fri, 10 Oct 2008 19:33:18 +0000 (21:33 +0200)]
[S390] qdio enhanced SIGA (iqdio) support.

Add support for z10 HiperSockets multiwrite SBALs on output
queues. This is used on LPAR with EDDP enabled devices.

Signed-off-by: Klaus-Dieter Wacker <kdwacker@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] cio: fix cio_tpi.
Heiko Carstens [Fri, 10 Oct 2008 19:33:17 +0000 (21:33 +0200)]
[S390] cio: fix cio_tpi.

In cio_tpi only disable bottom halves when not in interrupt context.
Otherwise a WARN_ON gets triggered. Besides that, when we are in
interrupt context bottom halves are disabled anyway.
Fixes this one:

Badness at kernel/softirq.c:77
Modules linked in:
CPU: 2 Not tainted 2.6.26 #4
Process swapper (pid: 0, task: 000000003fe83db0, ksp: 000000003fea7d28)
Krnl PSW : 0404c00180000000 0000000000053f4e (__local_bh_disable+0xbe/0xcc)
           R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 EA:3
Krnl GPRS: 0000000000008ee0 00000000005f95e0 0000000000000000 0000000000000001
           000000000020be92 0000000000000000 0000000000000210 00000000005d36c0
           000000003fb5f4d8 0000000000000000 000000000020bed0 000000003fb5f3c8
           00000000009be920 0000000000364898 000000003fb5f408 000000003fb5f3c8
Krnl Code: 0000000000053f42bf2f1000           icm     %r2,15,0(%r1)
           0000000000053f46a774ffc5           brc     7,53ed0
           0000000000053f4aa7f40001           brc     15,53f4c
          >0000000000053f4ea7280001           lhi     %r2,1
           0000000000053f5250201000           st      %r2,0(%r1)
           0000000000053f56a7f4ffbd           brc     15,53ed0
           0000000000053f5a: 0707               bcr     0,%r7
           0000000000053f5ca7f13fc0           tmll    %r15,16320
Call Trace:
([<0000000000000210>] 0x210)
 [<0000000000053f86>] local_bh_disable+0x2a/0x38
 [<000000000020bed0>] wait_cons_dev+0xd4/0x154
 [<0000000000247cb2>] raw3215_make_room+0x6a/0x1a8
 [<000000000024861a>] raw3215_write+0x86/0x28c
 [<00000000002488a0>] con3215_write+0x80/0x110
 [<000000000004c3e0>] __call_console_drivers+0xc8/0xe4
 [<000000000004c47e>] _call_console_drivers+0x82/0xc4
 [<000000000004c744>] release_console_sem+0x218/0x2c0
 [<000000000004cf64>] vprintk+0x3c0/0x504
 [<0000000000354a4a>] printk+0x52/0x64
 [<0000000000088004>] __print_symbol+0x40/0x50
 [<0000000000071dbc>] print_stack_trace+0x78/0xac
 [<0000000000079e78>] print_lock_dependencies+0x148/0x208
 [<000000000007a050>] print_irq_inversion_bug+0x118/0x15c
 [<000000000007a106>] check_usage_forwards+0x72/0x84
 [<000000000007a36e>] mark_lock+0x1d2/0x594
 [<000000000007baca>] __lock_acquire+0x886/0xf48
 [<000000000007c234>] lock_acquire+0xa8/0xe0
 [<0000000000350316>] _write_lock+0x56/0x98
 [<000000000026cd92>] zfcp_erp_adapter_reopen+0x4e/0x8c
 [<000000000026f1e8>] zfcp_qdio_int_resp+0x2e4/0x2f4
 [<00000000002210f4>] qdio_int_handler+0x274/0x888
 [<00000000002177b6>] ccw_device_call_handler+0x6e/0xd8
 [<0000000000215336>] ccw_device_irq+0xd6/0x160
 [<0000000000212f88>] io_subchannel_irq+0x8c/0x118
 [<000000000020c120>] do_IRQ+0x1d0/0x1fc
 [<00000000000270b2>] io_return+0x0/0x8
 [<000000000001c8a4>] cpu_idle+0x178/0x21c
([<000000000001c884>] cpu_idle+0x158/0x21c)
 [<00000000003483a2>] start_secondary+0xb6/0xc8
INFO: lockdep is turned off.
Last Breaking-Event-Address:
 [<0000000000053f4a>] __local_bh_disable+0xba/0xcc

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] cio: Correct use of ! and &
Julia Lawall [Fri, 10 Oct 2008 19:33:16 +0000 (21:33 +0200)]
[S390] cio: Correct use of ! and &

In commit e6bafba5b4765a5a252f1b8d31cbf6d2459da337, a bug was fixed that
involved converting !x & y to !(x & y).  The code below shows the same
pattern, and thus should perhaps be fixed in the same way.  In particular,
the result of !scsw_stctl(&request->irb.scsw) & SCSW_STCTL_STATUS_PEND is
always just !scsw_stctl(&request->irb.scsw).

The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@ expression E; constant C; @@
(
  !E & !C
|
- !E & C
+ !(E & C)
)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] cio: inline assembly cleanup
Peter Oberparleiter [Fri, 10 Oct 2008 19:33:15 +0000 (21:33 +0200)]
[S390] cio: inline assembly cleanup

Fix incorrect in- and output constraints, remove volatile declaration
of inline assembly parameters and reformat constraint declarations to
be more consistent.

Signed-off-by: Peter Oberparleiter <peter.oberparleiter@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] bus_id -> dev_set_name() for css and ccw busses
Cornelia Huck [Fri, 10 Oct 2008 19:33:14 +0000 (21:33 +0200)]
[S390] bus_id -> dev_set_name() for css and ccw busses

Convert remaining s390 users setting bus_id to dev_set_name()
or init_name.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] bus_id ->dev_name() conversions in qdio
Martin Schwidefsky [Fri, 10 Oct 2008 19:33:13 +0000 (21:33 +0200)]
[S390] bus_id ->dev_name() conversions in qdio

Use dev_name() in the new qdio driver.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] Use s390_root_dev_* in kvm_virtio.
Cornelia Huck [Fri, 10 Oct 2008 19:33:12 +0000 (21:33 +0200)]
[S390] Use s390_root_dev_* in kvm_virtio.

No need to define a static device for the kvm_s390 root device,
just use s390_root_dev_register().

This is needed for the bus_id rework

Acked-by: Carsten Otte <cotte@de.ibm.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] more bus_id -> dev_name conversions
Cornelia Huck [Fri, 10 Oct 2008 19:33:11 +0000 (21:33 +0200)]
[S390] more bus_id -> dev_name conversions

Some further bus_id -> dev_name() conversions in s390 code.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] bus_id -> dev_set_name() changes
Cornelia Huck [Fri, 10 Oct 2008 19:33:10 +0000 (21:33 +0200)]
[S390] bus_id -> dev_set_name() changes

Convert most s390 users setting bus_id to dev_set_name().
css and ccw busses are deferred since they need some special
treatment.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>