Skip to contentSkip to conversation

gpib: cleanup and fix error code

PATCH New Dave Penkler 1 participant 3 messages Apr 11

Subsystems (2)
lore
Share & tools
lore

Dave Penkler

author maintainer
#0 lore raw

cover gpib: cleanup and fix error code

Patch 1: Removes some useless old code
Patch 2: Fixes the error return code on invalid ioctl commands

Dave Penkler (2):
gpib: Remove useless code
gpib: Fix inappropriate ioctl error return

 drivers/gpib/common/gpib_os.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
Signature · 1 line
2.53.0
author maintainer
#1 lore raw

PATCH 1/2 gpib: Remove useless code

This code is a hangover from an earlier approach in the driver where the driver modules were called gpibXX It no longer serves any purpose.

---
 drivers/gpib/common/gpib_os.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/gpib/common/gpib_os.c +0 -7
index 2b4ec6aa893b..fca181b8c749 100644
@@ -544,13 +544,6 @@ int ibopen(struct inode *inode, struct file *filep)
 	priv = filep->private_data;
 	init_gpib_file_private((struct gpib_file_private *)filep->private_data);
 
-	if (board->use_count == 0) {
-		int retval;
-
-		retval = request_module("gpib%i", minor);
-		if (retval)
-			dev_dbg(board->gpib_dev, "request module returned %i\n", retval);
-	}
 	if (board->interface) {
 		if (!try_module_get(board->provider_module)) {
 			dev_err(board->gpib_dev, "try_module_get() failed\n");
Signature · 1 line
2.53.0
author maintainer
#2 lore raw

PATCH 2/2 gpib: Fix inappropriate ioctl error return

In reply to Dave Penkler

The driver was returning -ENOTTY in the case the ioctl command was not recognised. Change it to -EBADRQC.

Fixes 9dde4559e939 ("staging: gpib: Add GPIB common core driver")
---
 drivers/gpib/common/gpib_os.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpib/common/gpib_os.c +1 -2
index fca181b8c749..aafc4439b2fa 100644
@@ -606,7 +606,7 @@ long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 	unsigned int minor = iminor(file_inode(filep));
 	struct gpib_board *board;
 	struct gpib_file_private *file_priv = filep->private_data;
-	long retval = -ENOTTY;
+	long retval = -EBADRQC;
 
 	if (minor >= GPIB_MAX_NUM_BOARDS) {
 		pr_err("gpib: invalid minor number of device file\n");
@@ -799,7 +799,6 @@ long ibioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 		mutex_unlock(&board->big_gpib_mutex);
 		return write_ioctl(file_priv, board, arg);
 	default:
-		retval = -ENOTTY;
 		goto done;
 	}
 
Signature · 1 line
2.53.0