diff mbox series

[02/11] mtip32xx: return -ENOTTY for all unhanled ioctls

Message ID 20201031085810.450489-3-hch@lst.de
State New
Headers show
Series None | expand

Commit Message

Christoph Hellwig Oct. 31, 2020, 8:58 a.m. UTC
-ENOTTY is the convention for "driver does not support this ioctl".
Use it properly in mtip32xx instead of the bogys -EINVAL.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/mtip32xx/mtip32xx.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

Comments

Jens Axboe Oct. 31, 2020, 2:58 p.m. UTC | #1
On 10/31/20 2:58 AM, Christoph Hellwig wrote:
> -ENOTTY is the convention for "driver does not support this ioctl".

> Use it properly in mtip32xx instead of the bogys -EINVAL.


While that's certainly true, there is a risk in making a change like this
years after the fact. Not that I expect there are any mtip32xx users
left at this point, but...

-- 
Jens Axboe
Christoph Hellwig Nov. 1, 2020, 10:27 a.m. UTC | #2
On Sat, Oct 31, 2020 at 08:58:52AM -0600, Jens Axboe wrote:
> On 10/31/20 2:58 AM, Christoph Hellwig wrote:

> > -ENOTTY is the convention for "driver does not support this ioctl".

> > Use it properly in mtip32xx instead of the bogys -EINVAL.

> 

> While that's certainly true, there is a risk in making a change like this

> years after the fact. Not that I expect there are any mtip32xx users

> left at this point, but...


-ENOTTY is what most drivers return.  That being said we can keep the
old behavior, so if you prepfer that I can respin to do that.
Jens Axboe Nov. 1, 2020, 4:45 p.m. UTC | #3
On 11/1/20 3:27 AM, Christoph Hellwig wrote:
> On Sat, Oct 31, 2020 at 08:58:52AM -0600, Jens Axboe wrote:

>> On 10/31/20 2:58 AM, Christoph Hellwig wrote:

>>> -ENOTTY is the convention for "driver does not support this ioctl".

>>> Use it properly in mtip32xx instead of the bogys -EINVAL.

>>

>> While that's certainly true, there is a risk in making a change like this

>> years after the fact. Not that I expect there are any mtip32xx users

>> left at this point, but...

> 

> -ENOTTY is what most drivers return.  That being said we can keep the

> old behavior, so if you prepfer that I can respin to do that.


Yeah I know that -ENOTTY is what they all should use (and most of course
does), just saying that this change carries some risk. Given that
mtip32xx can probably be retired in the not-too-distant future, I say we
just keep the -EINVAL here.

-- 
Jens Axboe
diff mbox series

Patch

diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index 153e2cdecb4d40..893be95eceb34e 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -2029,7 +2029,7 @@  static int mtip_hw_ioctl(struct driver_data *dd, unsigned int cmd,
 	}
 
 	default:
-		return -EINVAL;
+		return -ENOTTY;
 	}
 	return 0;
 }
@@ -3215,12 +3215,7 @@  static int mtip_block_ioctl(struct block_device *dev,
 	if (unlikely(test_bit(MTIP_DDF_REMOVE_PENDING_BIT, &dd->dd_flag)))
 		return -ENOTTY;
 
-	switch (cmd) {
-	case BLKFLSBUF:
-		return -ENOTTY;
-	default:
-		return mtip_hw_ioctl(dd, cmd, arg);
-	}
+	return mtip_hw_ioctl(dd, cmd, arg);
 }
 
 #ifdef CONFIG_COMPAT
@@ -3254,8 +3249,6 @@  static int mtip_block_compat_ioctl(struct block_device *dev,
 		return -ENOTTY;
 
 	switch (cmd) {
-	case BLKFLSBUF:
-		return -ENOTTY;
 	case HDIO_DRIVE_TASKFILE: {
 		struct mtip_compat_ide_task_request_s __user *compat_req_task;
 		ide_task_request_t req_task;