bcache: Fix incompatible pointer type warning

The function pointer release in struct block_device_operations
should point to functions declared as void.

Sparse warnings:

drivers/md/bcache/super.c:656:27: warning:
	incorrect type in initializer (different base types)
	drivers/md/bcache/super.c:656:27:
	expected void ( *release )( ... )
	drivers/md/bcache/super.c:656:27:
	got int ( static [toplevel] *<noident> )( ... )

drivers/md/bcache/super.c:656:2: warning:
	initialization from incompatible pointer type [enabled by default]

drivers/md/bcache/super.c:656:2: warning:
	(near initialization for ‘bcache_ops.release’) [enabled by default]

Signed-off-by: Emil Goode <emilgoode@gmail.com>
Signed-off-by: Kent Overstreet <koverstreet@google.com>
bcache: drop "select CLOSURES"

The Kconfig entry for BCACHE selects CLOSURES. But there's no Kconfig
symbol CLOSURES. That symbol was used in development versions of bcache,
but was removed when the closures code was no longer provided as a
kernel library. It can safely be dropped.

Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
bcache: clarify free/available/unused space

Don't describe bcache_available_percent as free space but as
non-writeback space.  Describe priority_stats in more detail
and point to that for total bcache occupation.

Signed-off-by: Gabriel de Perthuis <g2p.code+bcache@gmail.com>
Signed-off-by: Kent Overstreet <koverstreet@google.com>
bcache: Fix error handling in init code

This code appears to have rotted... fix various bugs and do some
refactoring.

Signed-off-by: Kent Overstreet <koverstreet@google.com>
mtip32xx: Fix NULL pointer dereference during module unload

An open file-handle to one or more of the driver exported debugfs
nodes causes raciness in recursive removal during module unload;
sometimes a stale parent dentry is dereferenced when more than 1
pci device is present.

Signed-off-by: Sam Bradshaw <sbradshaw@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
mtip32xx: Correctly handle bio->bi_idx != 0 conditions

Stacking drivers may append bvecs to existing bio's, resulting
in non-zero bi_idx conditions.  This patch counts the loops of
bio_for_each_segment() rather than inheriting the bi_idx value
to pass as a segment count to the hardware submission routine.

Signed-off-by: Sam Bradshaw <sbradshaw@micron.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Merge branch 'bcache-for-upstream' of git://evilpiepirate.org/~kent/linux-bcache into for-linus

Kent writes:

Jens - couple more bcache patches. Bug fixes and a doc update.
blkpm: avoid sleep when holding queue lock

In blk_post_runtime_resume, an autosuspend request will be initiated for
the device. Since we are holding the queue lock, we can't sleep and thus
we should use the async version to initiate an autosuspend, i.e.
pm_request_suspend instead of pm_runtime_suspend, which might sleep.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block: remove refs to XD disks from documentation

Commit d1a6f4f19728d6e90480e53601a90fc9f6a348ad
"block: delete super ancient PC-XT driver for 1980's hardware"
deleted the XD disk driver, but there are still a few
references to it in the documentation directory. Delete
the remnants and thus also free up the major block device
13 for reuse.

Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
blkpm: use CONFIG_PM instead of CONFIG_RUNTIME_PM

Block layer runtime PM code can be useful to implement fast s3 resume
for ata disks, so mark these code as CONFIG_PM instead of CONFIG_RUNTIME_PM.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
scsi: pm: consolidate CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME

We are going to make use of runtime PM to implement fast ata disk resume
in S3, so mark scsi pm code as long as CONFIG_PM is defined.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
scsi: pm: consolidate scsi device system and runtime PM callbacks

Modify scsi device PM callback to handle both system suspend and runtime
suspend, as a result, we will need to dry run the scsi device's queue
to make sure there is no request left in its queue before putting it into
suspended state in system suspend path.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
ata/scsi: pm: fast s3 resume for ata disk

During system suspend, after successfully put the device into suspended
state, mark its runtime status as runtime suspended. On resume, make use
of runtime PM to do the actual resume work by calling pm_request_resume
for the device.

ATA port and scsi device are modified to use this for fast S3 resume.

Signed-off-by: Aaron Lu <aaron.lu@intel.com>
ata/scsi: set scsi device state to TRANSPORT_OFFLINE
blkpm: debug nr_pending
scsi: sr: use block layer runtime PM