Kiyoshi Ueda [Tue, 11 Dec 2007 22:53:03 +0000 (17:53 -0500)]
blk_end_request: cleanup 'uptodate' related code (take 4)
This patch converts 'uptodate' arguments of no longer exported
interfaces, end_that_request_first/last, to 'error', and removes
internal conversions for it in blk_end_request interfaces.
Also, this patch removes no longer needed end_io_error().
This patch removes the following functions:
o end_that_request_first()
o end_that_request_chunk()
and stops exporting the functions below:
o end_that_request_last()
This patch adds a variant of the interface, blk_end_bidi_request(),
which completes a bidi request.
Bidi request must be completed as a whole, both rq and rq->next_rq
at once. So the interface has 2 arguments for completion size.
As for ->end_io, only rq->end_io is called (rq->next_rq->end_io is not
called). So if special completion handling is needed, the handler
must be set to rq->end_io.
And the handler must take care of freeing next_rq too, since
the interface doesn't care of it if rq->end_io is not NULL.
Kiyoshi Ueda [Tue, 11 Dec 2007 22:51:23 +0000 (17:51 -0500)]
blk_end_request: changing ide-cd (take 4)
This patch converts ide-cd (cdrom_newpc_intr()) to use blk_end_request
interfaces. Related 'uptodate' arguments are converted to 'error'.
In PIO mode, ide-cd (cdrom_newpc_intr()) needs to defer
end_that_request_last() until the device clears DRQ_STAT and raises
an interrupt after end_that_request_first().
So blk_end_request() has to return without completing request
even if no leftover in the request.
ide-cd uses blk_end_request_callback() and a dummy callback function,
which just returns value '1', to tell blk_end_request_callback()
about that.
Kiyoshi Ueda [Tue, 11 Dec 2007 22:51:02 +0000 (17:51 -0500)]
blk_end_request: add callback feature (take 4)
This patch adds a variant of the interface, blk_end_request_callback(),
which has driver callback feature.
Drivers may need to do special works between end_that_request_first()
and end_that_request_last().
For such drivers, blk_end_request_callback() allows it to pass
a callback function which is called between end_that_request_first()
and end_that_request_last().
This interface is only for fallback of other blk_end_request interfaces.
Drivers should avoid their tricky behaviors and use other interfaces
as much as possible.
Currently, only one driver, ide-cd, needs this interface.
So this interface should/will be removed, after the driver removes
such tricky behaviors.
o ide-cd (cdrom_newpc_intr())
In PIO mode, cdrom_newpc_intr() needs to defer end_that_request_last()
until the device clears DRQ_STAT and raises an interrupt after
end_that_request_first().
So end_that_request_first() and end_that_request_last() are called
separately in cdrom_newpc_intr().
This means blk_end_request_callback() has to return without
completing request even if no leftover in the request.
To satisfy the requirement, callback function has return value
so that drivers can tell blk_end_request_callback() to return
without completing request.
Kiyoshi Ueda [Mon, 28 Jan 2008 09:34:20 +0000 (10:34 +0100)]
blk_end_request: changing ide normal caller (take 4)
This patch converts "normal" parts of ide to use blk_end_request
interfaces. Related 'uptodate' arguments are converted to 'error'.
The conversion of 'uptodate' to 'error' is done only for the internal
function, __ide_end_request().
ide_end_request() was not changed since it's exported and used
by many ide drivers.
With this patch, blkdev_dequeue_request() in __ide_end_request() is
moved to blk_end_request, since blk_end_request takes care of
dequeueing request like below:
if (!list_empty(&rq->queuelist))
blkdev_dequeue_request(rq);
In the case of ide,
o 'dequeue' variable of __ide_end_request() is 1 only when the request
is still linked to the queue (i.e. rq->queuelist is not empty)
o 'dequeue' variable of __ide_end_request() is 0 only when the request
has already been removed from the queue (i.e. rq->queuelist is empty)
So blk_end_request can handle it correctly although ide always run
thought the code above.
Kiyoshi Ueda [Tue, 11 Dec 2007 22:50:21 +0000 (17:50 -0500)]
blk_end_request: changing cpqarray (take 4)
This patch converts cpqarray to use blk_end_request interfaces.
Related 'ok' arguments are converted to 'error'.
cpqarray is a little bit different from "normal" drivers.
cpqarray directly calls bio_endio() and disk_stat_add()
when completing request. But those can be replaced with
__end_that_request_first().
After the replacement, request completion procedures of
those drivers become like the following:
o end_that_request_first()
o add_disk_randomness()
o end_that_request_last()
This can be converted to __blk_end_request() by following
the rule (b) mentioned in the patch subject
"[PATCH 01/30] blk_end_request: add new request completion interface".
Cc: Mike Miller <mike.miller@hp.com> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Kiyoshi Ueda [Tue, 11 Dec 2007 22:50:03 +0000 (17:50 -0500)]
blk_end_request: changing cciss (take 4)
This patch converts cciss to use blk_end_request interfaces.
Related 'uptodate' arguments are converted to 'error'.
cciss is a little bit different from "normal" drivers.
cciss directly calls bio_endio() and disk_stat_add()
when completing request. But those can be replaced with
__end_that_request_first().
After the replacement, request completion procedures of
those drivers become like the following:
o end_that_request_first()
o add_disk_randomness()
o end_that_request_last()
This can be converted to blk_end_request() by following
the rule (a) mentioned in the patch subject
"[PATCH 01/30] blk_end_request: add new request completion interface".
Cc: Mike Miller <mike.miller@hp.com> Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com> Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com> Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Kiyoshi Ueda [Tue, 11 Dec 2007 22:46:10 +0000 (17:46 -0500)]
blk_end_request: changing sx8 (take 4)
This patch converts sx8 to use blk_end_request interfaces.
Related 'uptodate' and 'is_ok' arguments are converted to 'error'.
As a result, the interfaces of internal functions below are changed.
o carm_end_request_queued
o carm_end_rq
o carm_handle_array_info
o carm_handle_scan_chan
o carm_handle_generic
o carm_handle_rw
The 'is_ok' is set at only one place in carm_handle_resp() below:
int is_ok = (status == RMSG_OK);
And the value is propagated to all functions above, and no modification
in other places.
So the actual conversion of the 'is_ok' is done at only one place above.
Kiyoshi Ueda [Tue, 11 Dec 2007 22:42:27 +0000 (17:42 -0500)]
blk_end_request: changing arm (take 4)
This patch converts arm's OMAP mailbox driver to use
blk_end_request interfaces.
If the original code was converted literally, blk_end_request would
be called with '-EIO' because end_that_request_last() were called
with '0' (i.e. failure).
But I think these '0's are bugs in the original code because it's
unlikely that all requests are treated as failure.
(The bugs should have no effect unless these requests have an end_io
callback.)
So I changed them to pass '0' (i.e. success) to blk_end_request.
This patch converts core parts of block layer to use blk_end_request
interfaces. Related 'uptodate' arguments are converted to 'error'.
'dequeue' argument was originally introduced for end_dequeued_request(),
where no attempt should be made to dequeue the request as it's already
dequeued.
However, it's not necessary as it can be checked with
list_empty(&rq->queuelist).
(Dequeued request has empty list and queued request doesn't.)
And it has been done in blk_end_request interfaces.
As a result of this patch, end_queued_request() and
end_dequeued_request() become identical. A future patch will merge
and rename them and change users of those functions.
Kiyoshi Ueda [Tue, 11 Dec 2007 22:41:17 +0000 (17:41 -0500)]
blk_end_request: add/export functions to get request size (take 4)
This patch adds/exports functions to get the size of request in bytes.
They are useful because blk_end_request interfaces take bytes
as a completed I/O size instead of sectors.
Kiyoshi Ueda [Tue, 11 Dec 2007 22:40:30 +0000 (17:40 -0500)]
blk_end_request: add new request completion interface (take 4)
This patch adds 2 new interfaces for request completion:
o blk_end_request() : called without queue lock
o __blk_end_request() : called with queue lock held
blk_end_request takes 'error' as an argument instead of 'uptodate',
which current end_that_request_* take.
The meanings of values are below and the value is used when bio is
completed.
0 : success
< 0 : error
Some device drivers call some generic functions below between
end_that_request_{first/chunk} and end_that_request_last().
o add_disk_randomness()
o blk_queue_end_tag()
o blkdev_dequeue_request()
These are called in the blk_end_request interfaces as a part of
generic request completion.
So all device drivers become to call above functions.
To decide whether to call blkdev_dequeue_request(), blk_end_request
uses list_empty(&rq->queuelist) (blk_queued_rq() macro is added for it).
So drivers must re-initialize it using list_init() or so before calling
blk_end_request if drivers use it for its specific purpose.
(Currently, there is no driver which completes request without
re-initializing the queuelist after used it. So rq->queuelist
can be used for the purpose above.)
"Normal" drivers can be converted to use blk_end_request()
in a standard way shown below.
a) end_that_request_{chunk/first}
spin_lock_irqsave()
(add_disk_randomness(), blk_queue_end_tag(), blkdev_dequeue_request())
end_that_request_last()
spin_unlock_irqrestore()
=> blk_end_request()
Linus Torvalds [Sun, 27 Jan 2008 21:15:24 +0000 (08:15 +1100)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/blackfin-2.6: (54 commits)
MAINTIANERS: just use Mike gmail e-mail for contact and pawn the serial driver off onto Sonic
[Blackfin] arch: remove old I2C BF54x porting.
[Blackfin] arch: Add the semtimedop syscall. Upstream uClibc doesn't compile without it.
[Blackfin] arch: fix bug kernel boot message: memory information is not reasonable
[Blackfin] arch: use common flash driver to setup partitions rather than the bf5xx-flash driver
[Blackfin] arch: Fix bug - kernel build with Debug option enabled fails to boot up
[Blackfin] arch: Fix bug Only RTC interrupt can wake up deeper sleep core.
[Blackfin] arch: Add proper SW System Reset delay sequence
[Blackfin] arch: Update copyright date
[Blackfin] arch: GPIO API cleanup and anomaly update
[Blackfin] arch: Fix BUG gpio_direction_output API is not compatitable with GENERIC_GPIO API interface
[Blackfin] arch: Initial checkin of the memory protection support.
[Blackfin] arch: set_bfin_dma_config shouldnt set SYNC or RESTART by default - add argument or option
[Blackfin] arch: Add some comments - fix semicolons
[Blackfin] arch: move all code related to CPLB handling into a new subdirectory under kernel/
[Blackfin] arch: print out list of modules if kernel is crashing and tell people if the kernel is tainted
[Blackfin] arch: enable generic GPIO based I2C driver in STAMP-BF533, EZKIT-BF533 and EZKIT-BF561 boards
[Blackfin] arch: Don't oops_in_progress if single step is comming from the kernel
[Blackfin] arch: Fix BUG - kernel sometimes would stuck with KEYBOARD_GPIO on
[Blackfin] arch: update to latest anomaly sheets
...
Zero-bytes transfers would leave the bus transaction unfinished
(no i2c stop is sent), with the following transfer actually
sending the slave address to the previously addressed device,
resulting in weird device failures (e.g. reset minute register
values in my RTC).
This patch instructs the controller to send an I2C STOP right after
the slave address in case of a zero-byte transfer.
Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
David Brownell [Sun, 27 Jan 2008 17:14:51 +0000 (18:14 +0100)]
i2c-remove-redundant-i2c_client-list.patch
This goes on top of the patch removing most i2c_adapter.clients usage,
updating i2c_attach_client:
- Don't call device_register() while holding clist_lock. This
removes a self-deadlock when on the i2c_driver.probe() path,
for drivers that need to attach new devices (e.g. dummies).
- Remove a redundant address check. The driver model core does
this as a consequence of guaranteeing unique names.
- Move the "device registered" diagnostic so that it never lies;
previously, on error paths it would falsely report success.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Sun, 27 Jan 2008 17:14:51 +0000 (18:14 +0100)]
i2c: Drivers stop using the redundant client list
The redundant i2c client list maintained by i2c-core is going away
soon, so drivers should stop using it now. Instead, they can use the
standard iterator provided by the device driver model
(device_for_each_child).
Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: David Brownell <david-b@pacbell.net> Cc: Michael Hunold <michael@mihu.de>
David Brownell [Sun, 27 Jan 2008 17:14:51 +0000 (18:14 +0100)]
i2c: Stop using the redundant client list
The i2c_adapter.clients list of i2c_client nodes duplicates driver
model state. This patch starts removing that list, letting us remove
most existing users of those i2c-core lists.
* The core I2C code now iterates over the driver model's list instead
of the i2c-internal one in some places where it's safe:
- Passing a command/ioctl to each client, a mechanims
used almost exclusively by DVB adapters;
- Device address checking, in both i2c-core and i2c-dev.
* Provide i2c_verify_client() to use with driver model iterators.
* Flag the relevant i2c_adapter and i2c_client fields as deprecated,
to help prevent new users from appearing.
For the moment the list needs to stick around, since some issues show
up when deleting devices created by legacy I2C drivers. (They don't
follow standard driver model rules. Removing those devices can cause
self-deadlocks.)
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Sun, 27 Jan 2008 17:14:51 +0000 (18:14 +0100)]
i2c: Let the user specify PCI driver data through new_id
The i2c-amd756 and i2c-viapro drivers make use of the driver_data
field of the PCI device ID. When adding device IDs dynamically (by
writing to the new_id sysfs file) you cannot set the value of this
field by default. It has to be allowed explicitly. Do that, and
check the value so that the user can't crash the kernel accidentally.
Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Mike Rapoport [Sun, 27 Jan 2008 17:14:50 +0000 (18:14 +0100)]
i2c: Support i2c_transfer in atomic contexts
Allow i2c_transfer to be called in contexts where sleeping is not allowed.
It is the reponsability of the caller to ensure that the underlying i2c bus
driver will not sleep either.
Signed-off-by: Mike Rapoport <mike@compulab.co.il> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Sun, 27 Jan 2008 17:14:50 +0000 (18:14 +0100)]
i2c: Discard unused driver IDs
Discard all I2C driver IDs that aren't used anywhere. That's not just a
couple of them, but more like 49 or one quarter of all defined IDs! And
this is just a first pass, next will come all IDs that are set but
never used, or used but never set.
Jean Delvare [Sun, 27 Jan 2008 17:14:50 +0000 (18:14 +0100)]
i2c-i801: Implement I2C block read support
I2C block read is supported since the ICH5. I couldn't get it to work
using the block buffer, so it's using the old-style byte-by-byte mode
for now.
Note: I'm also updating the driver author... The i2c-i801 driver was
really written by Mark Studebaker, even though he based his work on
the i2c-piix4 driver which was written by Philip Edelbrock.
David Brownell [Sun, 27 Jan 2008 17:14:49 +0000 (18:14 +0100)]
i2c/tps65010: move header to <linux/i2c/...>
Move the tps65010 header file from the OMAP arch directory to the
more generic <linux/i2c/...> directory, and remove the spurious
dependency of this driver on OMAP.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Sun, 27 Jan 2008 17:14:48 +0000 (18:14 +0100)]
i2c: Change prototypes of refcounting functions
Use more standard prototypes for i2c_use_client() and
i2c_release_client(). The former now returns a pointer to the client,
and the latter no longer returns anything. This matches what all other
subsystems do.
Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: David Brownell <david-b@pacbell.net>
Jean Delvare [Sun, 27 Jan 2008 17:14:46 +0000 (18:14 +0100)]
i2c-algo-pcf: Delete broken 10-bit address support
The 10-bit address support in i2c-algo-pcf is so heavily broken that
it can't have ever been used. Nobody ever complained, so I'll take it
that nobody needs it. Let's just delete it.
David Brownell [Sun, 27 Jan 2008 17:14:46 +0000 (18:14 +0100)]
i2c-algo-bit: Fix NAK/ARB comments
Update comments and logging on return path for byte writes. NAK is
an error, to be reported or optionally ignored. Timeouts are always
errors. Lost arbitration is not currently handled, so don't even list
it as an option in the error message.
Don't return bogus EFAULT code for inappropriate NAK; EIO is better,
there is no bad userspace address in question.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Olof Johansson [Sun, 27 Jan 2008 17:14:44 +0000 (18:14 +0100)]
i2c-pasemi: use i2c_add_numbered_adapter()
Use numbered adapter registration to always have the same hardware bus
show up at the same number.
PWRficient 1682M has three buses, they are all on the same PCI device but
different functions. So do the simple thing and register them based on
function number. Future products, if having a different number of busses,
are expected to have similar behaviour w.r.t. device/function layout.
Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Jean Delvare [Sun, 27 Jan 2008 17:14:44 +0000 (18:14 +0100)]
i2c-nforce2: The nForce2 can do block transactions
My guess is that all the chips supported by this driver support block
transactions and reset, but for now we play it safe and only list the
ones for which this was actually tested.
Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Oleg Ryjkov <olegr@olegr.ca>
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
[CIFS] DFS build fixes
[CIFS] DFS support: provide shrinkable mounts
[CIFS] Do not log path names in lookup errors
[CIFS] DFS support patchset: Added mountdata
[CIFS] Forgot to add two new files from previous commit
[CIFS] DNS name resolution helper upcall for cifs
[CIFS] fix checkpatch warnings in fs/cifs/inode.c
[CIFS] hold ses sem on tcp session reconnect during mount
[CIFS] Allow setting mode via cifs acl
[CIFS] fix unicode string alignment in SPNEGO setup
[CIFS] cifs_partialpagewrite() cleanup
[CIFS] use krb5 session key from first SMB session after a NegProt
[CIFS] redo existing session setup if needed in cifs_mount
[CIFS] Only dump SPNEGO key if CONFIG_CIFS_DEBUG2 is set
[CIFS] fix SetEA failure to some Samba versions
* git://git.kernel.org/pub/scm/linux/kernel/git/bart/ide-2.6: (63 commits)
ide: remove REQ_TYPE_ATA_CMD
ide: switch ide_cmd_ioctl() to use REQ_TYPE_ATA_TASKFILE requests
ide: switch set_xfer_rate() to use REQ_TYPE_ATA_TASKFILE requests
ide: fix final status check in drive_cmd_intr()
ide: check BUSY and ERROR status bits before reading data in drive_cmd_intr()
ide: don't enable local IRQs for PIO-in in driver_cmd_intr() (take 2)
ide: convert "empty" REQ_TYPE_ATA_CMD requests to use REQ_TYPE_ATA_TASKFILE
ide: initialize rq->cmd_type in ide_init_drive_cmd() callers
ide: use wait_drive_not_busy() in drive_cmd_intr() (take 2)
ide: kill DATA_READY define
ide: task_end_request() fix
ide: use rq->nr_sectors in task_end_request()
ide: remove needless ->cursg clearing from task_end_request()
ide: set IDE_TFLAG_IN_* flags before queuing/executing command
ide-tape: fix handling of non-special requests in ->end_request method
ide: fix final status check in task_in_intr()
ide: clear HOB bit for REQ_TYPE_ATA_CMD requests in ide_end_drive_cmd()
ide: fix ->io_32bit race in ide_taskfile_ioctl()
cmd64x: remove /proc/ide/cmd64x
ide: remove broken disk byte-swapping support
...
Linus Torvalds [Sun, 27 Jan 2008 06:52:53 +0000 (22:52 -0800)]
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6: (56 commits)
[S390] replace lock_cpu_hotplug with get_online_cpus
[S390] usage of s390dbf: shrink number of debug areas to use.
[S390] constify function pointer tables.
[S390] do local_irq_restore while spinning in spin_lock_irqsave.
[S390] add smp_call_function_mask
[S390] dasd: fix loop in request expiration handling
[S390] Unused field / extern declaration in processor.h
[S390] Remove TOPDIR from Makefile
[S390] dasd: add hyper PAV support to DASD device driver, part 1
[S390] single-step cleanup
[S390] Move NOTES and BUG_TABLE.
[S390] drivers/s390/: Spelling fixes
[S390] include/asm-s390/: Spelling fixes
[S390] arch/s390/: Spelling fixes
[S390] Use diag308 subcodes 3 and 6 for reboot and dump when possible.
[S390] vmemmap: allocate struct pages before 1:1 mapping
[S390] Initialize sclp_ipl_info
[S390] Allocate and free cpu lowcores and stacks when needed/possible.
[S390] use LIST_HEAD instead of LIST_HEAD_INIT
[S390] Load disabled wait psw instead of stopping cpu on halt.
...
Tejun Heo [Sat, 26 Jan 2008 19:13:11 +0000 (20:13 +0100)]
ide: task_end_request() fix
task_end_request() modified to always call ide_end_drive_cmd()
for taskfile requests. Previously, ide_end_drive_cmd() was
called only when IDE_TFLAG_FLAGGED was set. Also,
ide_dma_intr() is modified to use task_end_request().
Enables TASKFILE ioctls to get valid register outputs on
successful completion.
Tejun Heo [Sat, 26 Jan 2008 19:13:10 +0000 (20:13 +0100)]
ide: fix ->io_32bit race in ide_taskfile_ioctl()
In ide_taskfile_ioctl(), there was a race condition involving
drive->io_32bit. It was cleared and restored during ioctl
requests but there was no synchronization with other requests.
So, other requests could execute with the altered ->io_32bit
setting or updated drive->io_32bit could be overwritten by
ide_taskfile_ioctl().
This patch adds IDE_TFLAG_IO_16BIT flag to indicate to
ide_pio_datablock() that 16-bit I/O is needed regardless of
drive->io_32bit settting.
Remove broken disk byte-swapping support:
- it can cause a data corruption on SMP (or if using PREEMPT on UP)
- all data coming from disk are byte-swapped by taskfile_*_data() which
results in incorrect identify data being reported by /proc/ide/ and IOCTLs
- "hdx=bswap/byteswap" kernel parameter has been broken on m68k host drivers
(including Atari/Q40 ones) since 2.5.x days (because of 'hwif' zero-ing)
- byte-swapping is limited to PIO transfers (for working with TiVo disks on
x86 machines using user-space solutions or dm-byteswap should result in
much better performance because DMA can be used)