safe/jmp/linux-2.6
15 years agoide-tape: unify idetape_create_read/write_cmd
Borislav Petkov [Tue, 15 Jul 2008 19:22:03 +0000 (21:22 +0200)]
ide-tape: unify idetape_create_read/write_cmd

A straightforward one. There should be no functional change resulting from this
change.

[bart: minor fixups]

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add ide_pc_intr() helper
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:03 +0000 (21:22 +0200)]
ide: add ide_pc_intr() helper

* ide-tape.c: add 'drive' argument to idetape_update_buffers().

* Add generic ide_pc_intr() helper to ide-atapi.c and then
  convert ide-{floppy,tape,scsi} device drivers to use it.

* ide-tape.c: remove no longer needed DBG_PC_INTR.

There should be no functional changes caused by this patch
(unless the debugging is explicitely compiled in).

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-{floppy,scsi}: read Status Register before stopping DMA engine
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:03 +0000 (21:22 +0200)]
ide-{floppy,scsi}: read Status Register before stopping DMA engine

Read Status Register before stopping DMA engine to match ide-tape
device driver - it should be safe and shouldn't affect anything.

This is a preparation for adding generic ide_pc_intr() helper.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: add more debugging to idescsi_pc_intr()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:02 +0000 (21:22 +0200)]
ide-scsi: add more debugging to idescsi_pc_intr()

Add more debugging to idescsi_pc_intr() to match ide-tape's
idetape_pc_intr().

While at it:

* Correct the first debug message.

This is a preparation for adding generic ide_pc_intr() helper.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: use pc->callback
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:02 +0000 (21:22 +0200)]
ide-scsi: use pc->callback

* Add ide_scsi_callback() pc->callback implementation, then update
  idescsi_check_condition() and idescsi_queue() to setup ->callback.

* Convert idescsi_pc_intr() to use pc->callback.

This is a preparation for adding generic ide_pc_intr() helper.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: add more debugging to idefloppy_pc_intr()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:02 +0000 (21:22 +0200)]
ide-floppy: add more debugging to idefloppy_pc_intr()

Add more debugging to idefloppy_pc_intr() to match ide-tape's
idetape_pc_intr().

While at it:

* Correct the first debug message.

* Log device name with "DMA finished" message.

This is a preparation for adding generic ide_pc_intr() helper.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: always log debug info in idetape_pc_intr() if debugging is enabled
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:01 +0000 (21:22 +0200)]
ide-tape: always log debug info in idetape_pc_intr() if debugging is enabled

Add DBG_PC_INTR debug level and use it to always log debug info
in idetape_pc_intr() if debugging is enabled.

While at it:

* Use drive->name instead of tape->name.

* Log device name with "DMA finished" message.

This is a preparation for adding generic ide_pc_intr() helper.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: add ide_tape_io_buffers() helper
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:01 +0000 (21:22 +0200)]
ide-tape: add ide_tape_io_buffers() helper

* Add ide_tape_io_buffers() helper which is a wrapper for
  idetape_{in,out}put_buffers() and convert idetape_pc_intr()
  to use it.

* Remove no longer used idetape_io_buf typedef.

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-tape: factor out DSC handling from idetape_pc_intr()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:01 +0000 (21:22 +0200)]
ide-tape: factor out DSC handling from idetape_pc_intr()

Factor out DSC handling from idetape_pc_intr() to ide_tape_handle_dsc()
helper as a preparation for adding generic ide_pc_intr() helper.

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}: move checking of ->failed_pc to ->callback
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:01 +0000 (21:22 +0200)]
ide-{floppy,tape}: move checking of ->failed_pc to ->callback

Move checking/resetting of ->failed_pc from ide*_pc_intr() to ->callback
as a preparation for adding generic ide_pc_intr() helper.

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: add ide_issue_pc() helper
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:22:00 +0000 (21:22 +0200)]
ide: add ide_issue_pc() helper

Add generic ide_issue_pc() helper to ide-atapi.c and then
convert ide-{floppy,tape,scsi} device drivers to use it.

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: add PC_FLAG_DRQ_INTERRUPT pc flag
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:59 +0000 (21:21 +0200)]
ide: add PC_FLAG_DRQ_INTERRUPT pc flag

Add PC_FLAG_DRQ_INTERRUPT pc flag, set it in ide*_do_request()
and check for it (instead of checking for IDE*_FLAG_DRQ_INTERRUPT)
in ide*_issue_pc().  This is a preparation for adding generic
ide_issue_pc() helper.

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-scsi: move idescsi_map_sg() call out from idescsi_issue_pc()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:58 +0000 (21:21 +0200)]
ide-scsi: move idescsi_map_sg() call out from idescsi_issue_pc()

Move idescsi_map_sg() call out from idescsi_issue_pc()
to idescsi_do_request() as a preparation to adding generic
ide_issue_pc() helper.

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: add ide_transfer_pc() helper
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:58 +0000 (21:21 +0200)]
ide: add ide_transfer_pc() helper

* Add ide-atapi.c file for generic ATAPI support together with
  CONFIG_IDE_ATAPI config option.

* Add generic ide_transfer_pc() helper to ide-atapi.c and then
  convert ide-{floppy,tape,scsi} device drivers to use it.

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-scsi: set drive->scsi flag for devices handled by the driver
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:58 +0000 (21:21 +0200)]
ide-scsi: set drive->scsi flag for devices handled by the driver

This is a preparation for adding generic ide_transfer_pc() helper.

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-{cd,floppy,tape}: remove checking for drive->scsi
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:57 +0000 (21:21 +0200)]
ide-{cd,floppy,tape}: remove checking for drive->scsi

Remove checking for drive->scsi which is no longer set by IDE core code
(leave the flag since it will be re-used for generic ATAPI support).

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: add PC_FLAG_ZIP_DRIVE pc flag
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:57 +0000 (21:21 +0200)]
ide: add PC_FLAG_ZIP_DRIVE pc flag

Add PC_FLAG_ZIP_DRIVE pc flag, set it in idefloppy_do_request()
and check for it (instead of checking for IDEFLOPPY_FLAG_ZIP_DRIVE)
in idefloppy_transfer_pc().  This is a preparation for adding
generic ide_transfer_pc() helper.

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-tape: factor out waiting for good ireason from idetape_transfer_pc()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:57 +0000 (21:21 +0200)]
ide-tape: factor out waiting for good ireason from idetape_transfer_pc()

Factor out waiting for good ireason from idetape_transfer_pc()
to ide_tape_wait_ireason() as a preparation for adding generic
ide_transfer_pc() helper.

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-tape: set PC_FLAG_DMA_IN_PROGRESS flag in idetape_transfer_pc()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:57 +0000 (21:21 +0200)]
ide-tape: set PC_FLAG_DMA_IN_PROGRESS flag in idetape_transfer_pc()

Set PC_FLAG_DMA_IN_PROGRESS flag in idetape_transfer_pc() instead of
idetape_issue_pc() to match the other ATAPI device drivers.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: start DMA engine in idefloppy_transfer_pc1()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:56 +0000 (21:21 +0200)]
ide-floppy: start DMA engine in idefloppy_transfer_pc1()

Start DMA engine and set PC_FLAG_DMA_IN_PROGRESS flag in
idefloppy_transfer_pc1() instead of idefloppy_issue_pc()
so the Status Register and the Interrupt Reason Register
are checked first.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-{floppy,tape}: PC_FLAG_DMA_RECOMMENDED -> PC_FLAG_DMA_OK
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:56 +0000 (21:21 +0200)]
ide-{floppy,tape}: PC_FLAG_DMA_RECOMMENDED -> PC_FLAG_DMA_OK

* Use PC_FLAG_DMA_OK flag instead of PC_FLAG_DMA_RECOMMENDED one.

* Remove no longer used PC_FLAG_DMA_RECOMMENDED flag.

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}: merge pc->idefloppy_callback and pc->idetape_callback
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:56 +0000 (21:21 +0200)]
ide-{floppy,tape}: merge pc->idefloppy_callback and pc->idetape_callback

Merge pc->idefloppy_callback and pc->idetape_callback into pc->callback.

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: merge callbacks
Borislav Petkov [Tue, 15 Jul 2008 19:21:56 +0000 (21:21 +0200)]
ide-floppy: merge callbacks

The appropriate functionality of the callback is established through querying
the ATAPI packet command in pc->c[0].

While at it, simplify if (floppy->failed_pc)-branch to be found in the original
idefloppy_request_sense_callback().

Bart:
- keep handling for blk_pc_request() requests unchanged + add FIXME
- add uptodate variable + leave just one idefloppy_end_request() call
- add newline to the debug message

Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: make pc->idetape_callback void
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:55 +0000 (21:21 +0200)]
ide-tape: make pc->idetape_callback void

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-tape: merge callbacks
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:55 +0000 (21:21 +0200)]
ide-tape: merge callbacks

The appropriate functionality of the callback is established through querying
the ATAPI packet command in pc->c[0].

While at it:
- add uptodate variable + leave just one idetape_end_request() call
- don't use HWGROUP() macro

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: make idetape_retry_pc() void
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:55 +0000 (21:21 +0200)]
ide-tape: make idetape_retry_pc() void

idetape_retry_pc() always returns ide_stopped so make it void.

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,scsi}: log device name instead of driver name
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:54 +0000 (21:21 +0200)]
ide-{floppy,tape,scsi}: log device name instead of driver name

Log device name instead of driver name in *_pc_intr() and *_transfer_pc*().

While at it:

* Merge two consecutive printk()-s in *_pc_intr() together.

* Replace "floppy"/"tape"/"scsi" references in printk()-s by "device".

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:54 +0000 (21:21 +0200)]
ide-floppy: merge idefloppy_transfer_pc() and idefloppy_transfer_pc1()

* Check IDEFLOPPY_FLAG_ZIP_DRIVE flag in idefloppy_transfer_pc1()
  and skip idefloppy_transfer_pc2()-phase if the flag is not set.

* Always use idefloppy_transfer_pc1() in idefloppy_issue_pc()
  and remove no longer needed idefloppy_transfer_pc().

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-tape: remove SIMULATE_ERRORS debug code
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:54 +0000 (21:21 +0200)]
ide-tape: remove SIMULATE_ERRORS debug code

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: remove stale comments from idetape_pc_intr()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:54 +0000 (21:21 +0200)]
ide-tape: remove stale comments from idetape_pc_intr()

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: remove unneeded CONFIG_BLK_DEV_IDEDMA ifdef
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:54 +0000 (21:21 +0200)]
ide-tape: remove unneeded CONFIG_BLK_DEV_IDEDMA ifdef

PC_FLAG_DMA_IN_PROGRESS flag is never set if DMA support is disabled.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: remove superfluous warning message from idetape_issue_pc()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:53 +0000 (21:21 +0200)]
ide-tape: remove superfluous warning message from idetape_issue_pc()

ide_dma_off() prints info about DMA being disabled.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: remove superfluous error message from idetape_pc_intr()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:53 +0000 (21:21 +0200)]
ide-tape: remove superfluous error message from idetape_pc_intr()

ide_dma_off() prints info about DMA being disabled.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: idetape_pc_intr() should use local_irq_enable_in_hardirq()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:53 +0000 (21:21 +0200)]
ide-tape: idetape_pc_intr() should use local_irq_enable_in_hardirq()

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: add debug_log() macro
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:52 +0000 (21:21 +0200)]
ide-scsi: add debug_log() macro

Add debug_log() macro and convert the driver to use it.

[ This makes debug messages to be always prefixed with "ide-scsi: "
  and use KERN_INFO level. ]

While at it:

* Change "DMA complete" debug message to "DMA finished" to match
  other ATAPI device drivers.

* Use __func__.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: remove superfluous BUG_ON() from idescsi_transfer_pc()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:52 +0000 (21:21 +0200)]
ide-scsi: remove superfluous BUG_ON() from idescsi_transfer_pc()

ide_set_handler() bugs on ->handler == NULL so no need to do it
in idescsi_transfer_pc().

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-scsi: merge idescsi_input_buffers() and idescsi_output_buffers()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:52 +0000 (21:21 +0200)]
ide-scsi: merge idescsi_input_buffers() and idescsi_output_buffers()

* Merge idescsi_input_buffers() and idescsi_output_buffers()
  into ide_scsi_io_buffers() helper.

While at it:

* Log device name instead of driver name on error.

* Use xfer_func_t.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: fix Interrupt Reason checking in idescsi_pc_intr()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:52 +0000 (21:21 +0200)]
ide-scsi: fix Interrupt Reason checking in idescsi_pc_intr()

Set PC_FLAG_WRITING pc flag in idescsi_queue() (if needed)
and then fix Interrupt Reason checking in idescsi_pc_intr().

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: fix handling of DMA errors in idescsi_pc_intr()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:51 +0000 (21:21 +0200)]
ide-scsi: fix handling of DMA errors in idescsi_pc_intr()

Check return value of ->dma_end method and if there was a DMA error
handle it accordingly (set PC_FLAG_DMA_ERROR pc flag, don't update
pc->xferred and increase rq->errors).

Also move debug message in the right place while at it.

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: fix DRQ checking for DMA transfers in idescsi_pc_intr()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:51 +0000 (21:21 +0200)]
ide-scsi: fix DRQ checking for DMA transfers in idescsi_pc_intr()

If DRQ bit of Status Register is not cleared it is an error condition
and should be handled accordingly (disable DMA + reset the device).

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: fix race in idescsi_transfer_pc()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:51 +0000 (21:21 +0200)]
ide-scsi: fix race in idescsi_transfer_pc()

Start DMA engine before sending content of packet command (otherwise
it is possible that IRQ will happen before DMA engine is started).

Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove action argument in ide_do_drive_cmd
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:51 +0000 (21:21 +0200)]
ide: remove action argument in ide_do_drive_cmd

ide_do_drive_cmd is called only with ide_preempt action argument. So
we can remove the action argument in ide_do_drive_cmd and ide_action_t
typedef.

This patch also includes two minor cleanups: 1) ide_do_drive_cmd
always succeeds so we don't need the return value; 2) the callers use
blk_rq_init before ide_do_drive_cmd so there is no need to initialize
rq->errors.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-scsi: replace ide_do_drive_cmd with blk_execute_rq_nowait
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:50 +0000 (21:21 +0200)]
ide-scsi: replace ide_do_drive_cmd with blk_execute_rq_nowait

All the callers of ide_do_drive_cmd() except for ide-scsi use
ide_preempt action argument. This converts ide-scsi to use
blk_execute_rq_nowait instead of ide_do_drive_cmd so that we can
remove the action argument in ide_do_drive_cmd and ide_action_t
typedef.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove drive->ctl
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:50 +0000 (21:21 +0200)]
ide: remove drive->ctl

Remove drive->ctl (it is always equal to 0x08 after init time).

While at it:

* Use ATA_DEVCTL_OBS define.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use ->OUTBSYNC in ide_set_irq()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:50 +0000 (21:21 +0200)]
ide: use ->OUTBSYNC in ide_set_irq()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use ->OUTBSYNC in init_irq()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:50 +0000 (21:21 +0200)]
ide: use ->OUTBSYNC in init_irq()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: pass 'hwif *' instead of 'drive *' to ->OUTBSYNC method
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:49 +0000 (21:21 +0200)]
ide: pass 'hwif *' instead of 'drive *' to ->OUTBSYNC method

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove ->mmio flag from ide_hwif_t
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:49 +0000 (21:21 +0200)]
ide: remove ->mmio flag from ide_hwif_t

Since scc_pata host driver no longer uses IDE PCI layer / ide_dma_setup()
and all other ->mmio users set also IDE_HFLAG_MMIO host flag we can safely
remove ->mmio flag.

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: move IRQ unmasking out from ->tf_load method
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:48 +0000 (21:21 +0200)]
ide: move IRQ unmasking out from ->tf_load method

Move IRQ unmasking out from ->tf_load method to its users.

There should be no functional changes caused by this patch
(SELECT_MASK() is NOP except for hpt366, icside and sgiioc4).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove IDE_TFLAG_NO_SELECT_MASK taskfile flag
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:48 +0000 (21:21 +0200)]
ide: remove IDE_TFLAG_NO_SELECT_MASK taskfile flag

Always call SELECT_MASK(..., 0) in ide_tf_load() (needs to be done
to match ide_set_irq(..., 1)) and then remove IDE_TFLAG_NO_SELECT_MASK
taskfile flag.

This change should only affect hpt366 and icside host drivers since
->maskproc(..., 0) for sgiioc4 is equivalent to ide_set_irq(..., 1).

Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: fix do_probe() to use SELECT_DRIVE()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:48 +0000 (21:21 +0200)]
ide: fix do_probe() to use SELECT_DRIVE()

Fix one place in do_probe() which used ->OUTB directly instead
of calling SELECT_DRIVE() (so ->selectproc method is also used).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove commented out code from ide_config_drive_speed()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:47 +0000 (21:21 +0200)]
ide: remove commented out code from ide_config_drive_speed()

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agosgiioc4: use ->extra_base instead of ->dma_status for dma_handle
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:47 +0000 (21:21 +0200)]
sgiioc4: use ->extra_base instead of ->dma_status for dma_handle

This is a preparation for removal of ->dma_status field from ide_hwif_t.

There should be no functional changes caused by this patch.

Acked-by: Jeremy Higdon <jeremy@sgi.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove try_to_flush_leftover_data()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:47 +0000 (21:21 +0200)]
ide: remove try_to_flush_leftover_data()

Just use the new & shiny ide_pad_transfer() helper instead.

Also remove the superfluous check for 'drive->media == ide_disk'
while at it (ide_ata_error() is used only for ide_disk devices).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove obsoleted "ide=" kernel parameters
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:47 +0000 (21:21 +0200)]
ide: remove obsoleted "ide=" kernel parameters

* Remove obsoleted "ide=" kernel parameters.

* Remove no longer needed:
  - ide_setup()
  - parse_options()
  - __setup("", ...)
  - module_param(options, ...)

* Use module_{init,exit}() for MODULE=y case and remove MODULE ifdef.

* Make ide_*acpi* and ide_doubler variables static.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: cleanup init_ide_data()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:46 +0000 (21:21 +0200)]
ide: cleanup init_ide_data()

* Remove no longer need init_ide_data() call from ide_setup().

* Cleanup init_ide_data().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove obsoleted "hdx=" kernel parameters
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:46 +0000 (21:21 +0200)]
ide: remove obsoleted "hdx=" kernel parameters

* Remove obsoleted "hdx=" kernel parameters.

* Remove no longer used stridx() and match_parm().

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove obsoleted "idebus=" kernel parameter
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:46 +0000 (21:21 +0200)]
ide: remove obsoleted "idebus=" kernel parameter

* Remove obsoleted "idebus=" kernel parameter.

* Remove no longer needed ide_system_bus_speed() and system_bus_clock()
  (together with idebus_parameter and system_bus_speed variables).

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoblock: unexport blk_end_sync_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:45 +0000 (21:21 +0200)]
block: unexport blk_end_sync_rq

All the users of blk_end_sync_rq has gone (they are converted to use
blk_execute_rq). This unexports blk_end_sync_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoblock: remove the checking for NULL queue in blk_put_request
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:45 +0000 (21:21 +0200)]
block: remove the checking for NULL queue in blk_put_request

Some uses blk_put_request asymmetrically, that is, they uses it with
requests that not allocated by blk_get_request. As a result,
blk_put_request has a hack to catch a NULL request_queue. Now such
callers are fixed (they use blk_get_request properly). So we can
safely remove the hack in blk_put_request.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoblock: convert pd_special_command to use blk_execute_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:45 +0000 (21:21 +0200)]
block: convert pd_special_command to use blk_execute_rq

pd_special_command uses blk_put_request with struct request on the
stack. As a result, blk_put_request needs a hack to catch a NULL
request_queue.  This converts pd_special_command to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: remove ide_cd_init_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:45 +0000 (21:21 +0200)]
ide-cd: remove ide_cd_init_rq

ide_cd_init_rq is not used by ide-cd_ioctl any more. Only
cdrom_queue_request_sense use it. This converts
cdrom_queue_request_sense to use blk_rq_init directly and removes
ide_cd_init_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove ide_init_drive_cmd
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:44 +0000 (21:21 +0200)]
ide: remove ide_init_drive_cmd

ide_init_drive_cmd just calls blk_rq_init. This converts the users of
ide_init_drive_cmd to use blk_rq_init directly and removes
ide_init_drive_cmd.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: remove ide_wait/head_wait path in ide_do_drive_cmd
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:44 +0000 (21:21 +0200)]
ide: remove ide_wait/head_wait path in ide_do_drive_cmd

Now all the users of ide_do_drive_cmd using ide_wait/head_wait are
converted to use blk_execute_rq this removes the ide_wait/head_wait
path in ide_do_drive_cmd.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: convert ide_do_drive_cmd path to use blk_execute_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:44 +0000 (21:21 +0200)]
ide: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_[head_]wait to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoblock: handle blk_pm_resume_request() requests in blk_execute_rq_nowait()
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:43 +0000 (21:21 +0200)]
block: handle blk_pm_resume_request() requests in blk_execute_rq_nowait()

For blk_pm_resume_request() requests (which are used only by IDE subsystem
currently) the queue is stopped so we need to call ->request_fn explicitly.

Thanks to:
- Rafael for reporting/bisecting the bug
- Borislav/Rafael for testing the fix

This is a preparation for converting IDE to use blk_execute_rq().

Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: convert ide_do_drive_cmd path to use blk_execute_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:43 +0000 (21:21 +0200)]
ide-tape: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-taskfile: convert ide_do_drive_cmd path to use blk_execute_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:43 +0000 (21:21 +0200)]
ide-taskfile: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-floppy: convert ide_do_drive_cmd path to use blk_execute_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:43 +0000 (21:21 +0200)]
ide-floppy: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-disk: convert ide_do_drive_cmd path to use blk_execute_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:43 +0000 (21:21 +0200)]
ide-disk: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: convert ide_do_drive_cmd path to use blk_execute_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:42 +0000 (21:21 +0200)]
ide-cd: convert ide_do_drive_cmd path to use blk_execute_rq

This converts the ide_do_drive_cmd path using ide_wait to use
blk_execute_rq.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-cd: convert ide_cd_queue_pc to use blk_execute_rq
FUJITA Tomonori [Tue, 15 Jul 2008 19:21:42 +0000 (21:21 +0200)]
ide-cd: convert ide_cd_queue_pc to use blk_execute_rq

This converts ide_cd_queue_pc to use blk_execute_rq, necessitating
changing the ide_cd_queue_pc prototype into a form that doesn't takes
a pointer to request struct. ide_cd_queue_pc works like scsi_execute.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use __generic_unplug_device() in ide_do_drive_cmd() (take 2)
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:42 +0000 (21:21 +0200)]
ide: use __generic_unplug_device() in ide_do_drive_cmd() (take 2)

* Call __elv_add_request() with 'plug' == 1 (so the device will be
  plugged) and then use __generic_unplug_device() instead of calling
  ide_do_request() directly.

v2:
* For blk_pm_resume_request() requests the queue is stopped so we
  need to call ->request_fn explicitly.

  Thanks to:
  - Rafael for reporting/bisecting the bug
  - Borislav/Rafael for testing the fix

This is a preparation for converting IDE to use blk_execute_rq().

Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: set REQ_PREEMPT request flag in ide_do_drive_cmd() users
Bartlomiej Zolnierkiewicz [Tue, 15 Jul 2008 19:21:41 +0000 (21:21 +0200)]
ide: set REQ_PREEMPT request flag in ide_do_drive_cmd() users

* Set REQ_PREEMPT request flag in ide_do_drive_cmd() users
  for ide_preempt and ide_head_wait action types.

* Remove setting REQ_PREEMPT from ide_do_drive_cmd().

While at it:

* Set 'where' variable outside ide_lock.

This is a preparation for converting IDE to use blk_execute_rq().

There should be no functional changes caused by this patch.

Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Borislav Petkov <petkovbb@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: use get_unaligned_* helpers
Harvey Harrison [Tue, 15 Jul 2008 19:21:41 +0000 (21:21 +0200)]
ide: use get_unaligned_* helpers

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide-tape: use clamp_t() rather than nested min_t()/max_t()
Harvey Harrison [Tue, 15 Jul 2008 19:21:41 +0000 (21:21 +0200)]
ide-tape: use clamp_t() rather than nested min_t()/max_t()

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: eliminate FIT() macro
Harvey Harrison [Tue, 15 Jul 2008 19:21:41 +0000 (21:21 +0200)]
ide: eliminate FIT() macro

Replace the FIT() macro with the kernel-provided clamp_val() macro.

FIT was always being called with a member of a struct ide_timing,
which are shorts, and constant constraints for the min and max.

Thus we can use clamp_val, rather than clamp_t.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoide: disable drive interrupts in ide_driveid_update()
Mikhail Cherkashin [Tue, 15 Jul 2008 19:21:40 +0000 (21:21 +0200)]
ide: disable drive interrupts in ide_driveid_update()

Since ide_driveid_update() uses polling to execute the IDENTIFY DEVICE command
but clears nIEN bit in the control register and doesn't mask the IDE interrupt,
the latter does happen and lead to the corresponding message to appear:

ide0: unexpected interrupt, status=0x58, count=1

when e.g. running hdparm with option -X with a non-PCI IDE driver...

Signed-off-by: Mikhail Cherkashin <mcherkashin@ru.mvista.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agopalm_bk3710: fix tRP for UDMA mode 4
Mikhail Cherkashin [Tue, 15 Jul 2008 19:21:40 +0000 (21:21 +0200)]
palm_bk3710: fix tRP for UDMA mode 4

Fix tRP timing for UDMA mode 4 according to the ATA specification.

Signed-off-by: Mikhail Cherkashin <mcherkhashin@ru.mvista.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
15 years agoLinux 2.6.26 v2.6.26
Linus Torvalds [Sun, 13 Jul 2008 21:51:29 +0000 (14:51 -0700)]
Linux 2.6.26

15 years agodevcgroup: fix permission check when adding entry to child cgroup
Li Zefan [Sun, 13 Jul 2008 19:14:04 +0000 (12:14 -0700)]
devcgroup: fix permission check when adding entry to child cgroup

 # cat devices.list
 c 1:3 r
 # echo 'c 1:3 w' > sub/devices.allow
 # cat sub/devices.list
 c 1:3 w

As illustrated, the parent group has no write permission to /dev/null, so
it's child should not be allowed to add this write permission.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agodevcgroup: always show positive major/minor num
Li Zefan [Sun, 13 Jul 2008 19:14:02 +0000 (12:14 -0700)]
devcgroup: always show positive major/minor num

 # echo "b $((0x7fffffff)):$((0x80000000)) rwm" > devices.allow
 # cat devices.list
 b 214748364:-21474836 rwm

though a major/minor number of 0x800000000 is meaningless, we
should not cast it to a negative value.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Cc: Serge Hallyn <serue@us.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoDocumentation/HOWTO: correct wrong kernel bugzilla FAQ URL
Jiri Pirko [Sun, 13 Jul 2008 19:13:59 +0000 (12:13 -0700)]
Documentation/HOWTO: correct wrong kernel bugzilla FAQ URL

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 13 Jul 2008 18:03:59 +0000 (11:03 -0700)]
Merge branch 'sched-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'sched-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  cpusets, hotplug, scheduler: fix scheduler domain breakage

15 years agocpusets, hotplug, scheduler: fix scheduler domain breakage
Dmitry Adamushko [Sun, 13 Jul 2008 00:10:29 +0000 (02:10 +0200)]
cpusets, hotplug, scheduler: fix scheduler domain breakage

Commit f18f982ab ("sched: CPU hotplug events must not destroy scheduler
domains created by the cpusets") introduced a hotplug-related problem as
described below:

Upon CPU_DOWN_PREPARE,

  update_sched_domains() -> detach_destroy_domains(&cpu_online_map)

does the following:

/*
 * Force a reinitialization of the sched domains hierarchy. The domains
 * and groups cannot be updated in place without racing with the balancing
 * code, so we temporarily attach all running cpus to the NULL domain
 * which will prevent rebalancing while the sched domains are recalculated.
 */

The sched-domains should be rebuilt when a CPU_DOWN ops. has been
completed, effectively either upon CPU_DEAD{_FROZEN} (upon success) or
CPU_DOWN_FAILED{_FROZEN} (upon failure -- restore the things to their
initial state). That's what update_sched_domains() also does but only
for !CPUSETS case.

With f18f982ab, sched-domains' reinitialization is delegated to
CPUSETS code:

cpuset_handle_cpuhp() -> common_cpu_mem_hotplug_unplug() ->
rebuild_sched_domains()

Being called for CPU_UP_PREPARE and if its callback is called after
update_sched_domains()), it just negates all the work done by
update_sched_domains() -- i.e. a soon-to-be-offline cpu is included in
the sched-domains and that makes it visible for the load-balancer
while the CPU_DOWN ops. is in progress.

__migrate_live_tasks() moves the tasks off a 'dead' cpu (it's already
"offline" when this function is called).

try_to_wake_up() is called for one of these tasks from another CPU ->
the load-balancer (wake_idle()) picks up a "dead" CPU and places the
task on it. Then e.g. BUG_ON(rq->nr_running) detects this a bit later
-> oops.

Signed-off-by: Dmitry Adamushko <dmitry.adamushko@gmail.com>
Tested-by: Vegard Nossum <vegard.nossum@gmail.com>
Cc: Paul Menage <menage@google.com>
Cc: Max Krasnyansky <maxk@qualcomm.com>
Cc: Paul Jackson <pj@sgi.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: miaox@cn.fujitsu.com
Cc: rostedt@goodmis.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
15 years agoMerge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 12 Jul 2008 21:34:31 +0000 (14:34 -0700)]
Merge branch 'x86-fixes-for-linus' of git://git./linux/kernel/git/tip/linux-2.6-tip

* 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  x86: fix ldt limit for 64 bit

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
Linus Torvalds [Sat, 12 Jul 2008 21:34:11 +0000 (14:34 -0700)]
Merge git://git./linux/kernel/git/jejb/scsi-rc-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] bsg: fix oops on remove
  [SCSI] fusion: default MSI to disabled for SPI and FC controllers
  [SCSI] ipr: Fix HDIO_GET_IDENTITY oops for SATA devices
  [SCSI] mptspi: fix oops in mptspi_dv_renegotiate_work()
  [SCSI] erase invalid data returned by device

15 years agocifs: fix wksidarr declaration to be big-endian friendly
Jeff Layton [Sat, 12 Jul 2008 20:48:00 +0000 (13:48 -0700)]
cifs: fix wksidarr declaration to be big-endian friendly

The current definition of wksidarr works fine on little endian arches
(since cpu_to_le32 is a no-op there), but on big-endian arches, it fails
to compile with this error:

error: braced-group within expression allowed only inside a function

The problem is that this static declaration has cpu_to_le32 embedded
within it, and that expands into a function macro.  We need to use
__constant_cpu_to_le32() instead.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: Steven French <sfrench@us.ibm.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agocifs: fix inode leak in cifs_get_inode_info_unix
Jeff Layton [Sat, 12 Jul 2008 20:47:59 +0000 (13:47 -0700)]
cifs: fix inode leak in cifs_get_inode_info_unix

Try this:

    mount a share with unix extensions
    create a file on it
    umount the share

You'll get the following message in the ring buffer:

VFS: Busy inodes after unmount of cifs. Self-destruct in 5 seconds.  Have a
nice day...

...the problem is that cifs_get_inode_info_unix is creating and hashing
a new inode even when it's going to return error anyway. The first
lookup when creating a file returns an error so we end up leaking this
inode before we do the actual create. This appears to be a regression
caused by commit 0e4bbde94fdc33f5b3d793166b21bf768ca3e098.

The following patch seems to fix it for me, and fixes a minor
formatting nit as well.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Steven French <sfrench@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agofrv: fix irqs_disabled() to return an int, not an unsigned long
David Howells [Sat, 12 Jul 2008 20:47:58 +0000 (13:47 -0700)]
frv: fix irqs_disabled() to return an int, not an unsigned long

Fix FRV irqs_disabled() to return an int, not an unsigned long to avoid
this warning:

kernel/sched.c: In function '__might_sleep':
kernel/sched.c:8198: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoOProfile kernel maintainership changes
Robert Richter [Sat, 12 Jul 2008 20:47:57 +0000 (13:47 -0700)]
OProfile kernel maintainership changes

Cc: Philippe Elie <phil.el@wanadoo.fr>
Cc: John Levon <levon@movementarian.org>
Cc: Maynard Johnson <maynardj@us.ibm.com>
Cc: Richard Purdie <rpurdie@openedhand.com>
Cc: Daniel Hansel <daniel.hansel@linux.vnet.ibm.com>
Cc: Jason Yeh <jason.yeh@amd.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agortc-pcf8563: add chip id
Jon Smirl [Sat, 12 Jul 2008 20:47:56 +0000 (13:47 -0700)]
rtc-pcf8563: add chip id

Add the rtc8564 chip entry

Signed-off-by: Jon Smirl <jonsmirl@gmail.com>
Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agortc-fm3130: fix chip naming
Alessandro Zummo [Sat, 12 Jul 2008 20:47:55 +0000 (13:47 -0700)]
rtc-fm3130: fix chip naming

Fix chip naming from fm3031-rtc to fm3031

Signed-off-by: Alessandro Zummo <a.zummo@towertech.it>
Cc: Sergey Lapin <slapin@ossfans.org>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoov7670: clean up ov7670_read semantics
Andres Salomon [Sat, 12 Jul 2008 20:47:54 +0000 (13:47 -0700)]
ov7670: clean up ov7670_read semantics

Cortland Setlow pointed out a bug in ov7670.c where the result from
ov7670_read() was just being checked for !0, rather than <0.  This made me
realize that ov7670_read's semantics were rather confusing; it both fills
in 'value' with the result, and returns it.  This is goes against general
kernel convention; so rather than fixing callers, let's fix the function.

This makes ov7670_read return <0 in the case of an error, and 0 upon
success. Thus, code like:

res = ov7670_read(...);
if (!res)
goto error;

..will work properly.

Signed-off-by: Cortland Setlow <csetlow@tower-research.com>
Signed-off-by: Andres Salomon <dilinger@debian.org>
Acked-by: Jonathan Corbet <corbet@lwn.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoserial8250: sanity check nr_uarts on all paths.
Eric W. Biederman [Sat, 12 Jul 2008 20:47:53 +0000 (13:47 -0700)]
serial8250: sanity check nr_uarts on all paths.

I had 8250.nr_uarts=16 in the boot line of a test kernel and I had a weird
mysterious crash in sysfs.  After taking an in-depth look I realized that
CONFIG_SERIAL_8250_NR_UARTS was set to 4 and I was walking off the end of
the serial8250_ports array.

Ouch!!!

Don't let this happen to someone else.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Alan Cox <alan@redhat.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agofbdev: bugfix for multiprocess defio
Jaya Kumar [Sat, 12 Jul 2008 20:47:51 +0000 (13:47 -0700)]
fbdev: bugfix for multiprocess defio

This patch is a bugfix for how defio handles multiple processes manipulating
the same framebuffer.

Thanks to Bernard Blackham for identifying this bug.

It occurs when two applications mmap the same framebuffer and concurrently
write to the same page.  Normally, this doesn't occur since only a single
process mmaps the framebuffer.  The symptom of the bug is that the mapping
applications will hang.  The cause is that defio incorrectly tries to add the
same page twice to the pagelist.  The solution I have is to walk the pagelist
and check for a duplicate before adding.  Since I needed to walk the pagelist,
I now also keep the pagelist in sorted order.

Signed-off-by: Jaya Kumar <jayakumar.lkml@gmail.com>
Cc: Bernard Blackham <bernard@largestprime.net>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agodrivers/isdn/i4l/isdn_common.c fix small resource leak
Darren Jenkins [Sat, 12 Jul 2008 20:47:50 +0000 (13:47 -0700)]
drivers/isdn/i4l/isdn_common.c fix small resource leak

Coverity CID: 1356 RESOURCE_LEAK

I found a very old patch for this that was Acked but did not get applied
https://lists.linux-foundation.org/pipermail/kernel-janitors/2006-September/016362.html

There looks to be a small leak in isdn_writebuf_stub() in isdn_common.c, when
copy_from_user() returns an un-copied data length (length != 0).  The below
patch should be a minimally invasive fix.

Signed-off-by: Darren Jenkins <darrenrjenkins@gmailcom>
Acked-by: Karsten Keil <kkeil@suse.de>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agodrivers/char/pcmcia/ipwireless/hardware.c fix resource leak
Darren Jenkins [Sat, 12 Jul 2008 20:47:49 +0000 (13:47 -0700)]
drivers/char/pcmcia/ipwireless/hardware.c fix resource leak

Coverity CID: 2172 RESOURCE_LEAK

When pool_allocate() tries to enlarge a packet, if it can not allocate enough
memory, it returns NULL without first freeing the old packet.

This patch just frees the packet first.

Signed-off-by: Darren Jenkins <darrenrjenkins@gmail.com>
Acked-by: Jiri Kosina <jkosina@suse.cz>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years ago[SCSI] bsg: fix oops on remove
James Bottomley [Mon, 7 Jul 2008 20:50:01 +0000 (15:50 -0500)]
[SCSI] bsg: fix oops on remove

If you do a modremove of any sas driver, you run into an oops on
shutdown when the host is removed (coming from the host bsg device).
The root cause seems to be that there's a use after free of the
bsg_class_device:  In bsg_kref_release_function, this is used (to do a
put_device(bcg->parent) after bcg->release has been called.  In sas (and
possibly many other things) bcd->release frees the queue which contains
the bsg_class_device, so we get a put_device on unreferenced memory.
Fix this by taking a copy of the pointer to the parent before releasing
bsg.

Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years ago[SCSI] fusion: default MSI to disabled for SPI and FC controllers
James Bottomley [Fri, 11 Jul 2008 03:10:55 +0000 (22:10 -0500)]
[SCSI] fusion: default MSI to disabled for SPI and FC controllers

There's a fault on the FC controllers that makes them not respond
correctly to MSI.  The SPI controllers are fine, but are likely to be
onboard on older motherboards which don't handle MSI correctly, so
default both these cases to disabled.  Enable by setting the module
parameter mpt_msi_enable=1.

For the SAS case, enable MSI by default, but it can be disabled by
setting the module parameter mpt_msi_enable=0.

Cc: "Prakash, Sathya" <sathya.prakash@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>