summaryrefslogtreecommitdiff
path: root/drivers/ide
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2020-09-03 07:40:57 +0200
committerJens Axboe <axboe@kernel.dk>2020-09-25 08:18:57 -0600
commitfa01b1e9733fd59ecb8b5b6d85dfb481d2025fbf (patch)
treef627199fb47da3dc4fa57dcbf305fff12997a918 /drivers/ide
parent250eec9e390e2be6f672f9a77cf29791c189f7da (diff)
block: add a bdev_is_partition helper
Add a littler helper to make the somewhat arcane bd_contains checks a little more obvious. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/ide-ioctls.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c
index 09491098047b..58994da10c06 100644
--- a/drivers/ide/ide-ioctls.c
+++ b/drivers/ide/ide-ioctls.c
@@ -49,7 +49,7 @@ read_val:
return err >= 0 ? put_user_long(err, arg) : err;
set_val:
- if (bdev != bdev->bd_contains)
+ if (bdev_is_partition(bdev))
err = -EINVAL;
else {
if (!capable(CAP_SYS_ADMIN))
@@ -257,7 +257,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct block_device *bdev,
switch (cmd) {
case HDIO_OBSOLETE_IDENTITY:
case HDIO_GET_IDENTITY:
- if (bdev != bdev->bd_contains)
+ if (bdev_is_partition(bdev))
return -EINVAL;
return ide_get_identity_ioctl(drive, cmd, argp);
case HDIO_GET_NICE: