Skip to contentSkip to conversation

drivers/scsi/scsi_sysfs.c:718: warning: unused variable `rq'

PATCH In review Frederik Deweerdt 3 participants 3 messages Jul 23, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/scsi/scsi_sysfs.c:718: warning: unused variable `rq'

Hi James,

A compile of the latest git on arm triggers the following warning:
CC [M] drivers/scsi/scsi_sysfs.o drivers/scsi/scsi_sysfs.c: In function `scsi_sysfs_add_sdev':
drivers/scsi/scsi_sysfs.c:718: warning: unused variable `rq'

The following patch kills the intermediary variable.

Regards,
Frederik

drivers/scsi/scsi_sysfs.c +2 -2
index 34cdce6..9e5cc4f 100644
@@ -715,7 +715,6 @@ static int attr_add(struct device *dev, struct device_attribute *attr)
 int scsi_sysfs_add_sdev(struct scsi_device *sdev)
 {
 	int error, i;
-	struct request_queue *rq = sdev->request_queue;
 
 	if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
 		return error;
@@ -736,7 +735,8 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
 	 * released by the sdev_class .release */
 	get_device(&sdev->sdev_gendev);
 
-	error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL);
+	error = bsg_register_queue(sdev->request_queue,
+				   &sdev->sdev_gendev, NULL);
 
 	if (error)
 		sdev_printk(KERN_INFO, sdev,
#1 lore raw

Review int scsi_sysfs_add_sdev(struct scsi_device *sdev) · line 739

Quoted 11 lines · Frederik Deweerdt
(quoted diff) +2 -2
-	struct request_queue *rq = sdev->request_queue;
 
 	if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
 		return error;
@@ -736,7 +735,8 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
 	 * released by the sdev_class .release */
 	get_device(&sdev->sdev_gendev);
 
-	error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL);
+	error = bsg_register_queue(sdev->request_queue,
+				   &sdev->sdev_gendev, NULL);

Actually, that's not really a good fix because the same problem will reoccur elsewhere. This is a more correct fix:

James

include/linux/bsg.h +7 -2
index f415f89..2344dab 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 * rq, struct device *dev, const char *name)
+{
+	return 0;
+}
+static inline void bsg_unregister_queue(struct request_queue *rq)
+{
+}
 #endif
 
 #endif /* __KERNEL__ */
#2 lore raw
In reply to Frederik Deweerdt
Quoted 27 lines · Frederik Deweerdt

Hi James,

A compile of the latest git on arm triggers the following warning:
CC [M] drivers/scsi/scsi_sysfs.o drivers/scsi/scsi_sysfs.c: In function `scsi_sysfs_add_sdev':
drivers/scsi/scsi_sysfs.c:718: warning: unused variable `rq'

The following patch kills the intermediary variable.

Regards,
Frederik

drivers/scsi/scsi_sysfs.c +0 -1
index 34cdce6..9e5cc4f 100644
@@ -715,7 +715,6 @@ static int attr_add(struct device *dev, struct device_attribute *attr)
 int scsi_sysfs_add_sdev(struct scsi_device *sdev)
 {
 	int error, i;
-	struct request_queue *rq = sdev->request_queue;
 
 	if ((error = scsi_device_set_state(sdev, SDEV_RUNNING)) != 0)
 		return error;

drivers/scsi/scsi_sysfs.c int scsi_sysfs_add_sdev(struct scsi_device *sdev) · line 742

Quoted 9 lines
drivers/scsi/scsi_sysfs.c +2 -1
@@ -736,7 +735,8 @@ int scsi_sysfs_add_sdev(struct scsi_device *sdev)
 	 * released by the sdev_class .release */
 	get_device(&sdev->sdev_gendev);
 
-	error = bsg_register_queue(rq, &sdev->sdev_gendev, NULL);
+	error = bsg_register_queue(sdev->request_queue,
+				   &sdev->sdev_gendev, NULL);
 
 	if (error)
 		sdev_printk(KERN_INFO, sdev,

A better solution would be to make the dummy bsg_{,un}register_queue() for the CONFIG_BLK_DEV_BSG=n case static inline's.

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed