Skip to contentSkip to conversation

bsg: Fix warning with CONFIG_BLK_DEV_BSG=n

PATCH In review Roland Dreier 2 participants 3 messages Jul 29, 2007 BSG (block layer generic sg v4 driver)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bsg: Fix warning with CONFIG_BLK_DEV_BSG=n

The current stub definitions of bsg_register_queue() and bsg_unregister_queue() as macros leads to

drivers/scsi/scsi_sysfs.c: In function 'scsi_sysfs_add_sdev':
drivers/scsi/scsi_sysfs.c:718: warning: unused variable 'rq'

because the first parameter of bsg_register_queue() is completely discarded. As akpm says, "program in C, not in cpp." We might as well get a little bit better type-checking when we fix this by converting the stubs to empty inline functions.

---
 include/linux/bsg.h |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
include/linux/bsg.h +7 -2
index f415f89..69e23e1 100644
@@ -60,8 +60,13 @@ struct bsg_class_device {
 extern int bsg_register_queue(struct request_queue *, struct device *, const char *);
 extern void bsg_unregister_queue(struct request_queue *);
 #else
-#define bsg_register_queue(disk, dev, name)		(0)
-#define bsg_unregister_queue(disk)	do { } while (0)
+static inline int bsg_register_queue(struct request_queue *q, struct device *gdev,
+				     const char *name)
+{
+	return 0;
+}
+
+static inline void bsg_unregister_queue(struct request_queue *q) { }
 #endif
 
 #endif /* __KERNEL__ */
#1 lore raw
Quoted 10 lines · Roland Dreier

The current stub definitions of bsg_register_queue() and bsg_unregister_queue() as macros leads to

drivers/scsi/scsi_sysfs.c: In function 'scsi_sysfs_add_sdev':
drivers/scsi/scsi_sysfs.c:718: warning: unused variable 'rq'

because the first parameter of bsg_register_queue() is completely discarded. As akpm says, "program in C, not in cpp." We might as well get a little bit better type-checking when we fix this by converting the stubs to empty inline functions.

James should already have that patch queued for inclusion since last week.

Signature · 1 line
Jens Axboe
#2 lore raw
Quoted 2 lines

James should already have that patch queued for inclusion since last week.

OK thanks, I missed seeing it go by.