block: check_events: don't bother with events if unsupported
authorMartin Wilck <mwilck@suse.com>
Wed, 27 Mar 2019 13:51:05 +0000 (14:51 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 12 Apr 2019 19:35:28 +0000 (13:35 -0600)
commitcdf3e3deb747d5e193dee617ed37c83060eb576f
treec93a8bd77329c69d7843058071ef5c78160efc58
parent773008f6fe0544aa28140ced0504cefba17381aa
block: check_events: don't bother with events if unsupported

Drivers now report to the block layer if they support media change
events. If this is not the case, there's no need to allocate the event
structure, and all event handling code can effectively be skipped. This
simplifies code flow in particular for non-removable sd devices.

This effectively reverts commit 75e3f3ee3c64 ("block: always allocate
genhd->ev if check_events is implemented").

The sysfs files for the events are kept in place even if no events are
supported, as user space may rely on them being present. The only
difference is that an error code is now returned if the user tries to
set poll_msecs.

Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin Wilck <mwilck@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/genhd.c