Skip to contentSkip to conversation

remove unused includes and misleading comments from scsi_lib.c

PATCH In review Christoph Hellwig 3 participants 5 messages Nov 17, 2002 – Nov 20, 2002 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remove unused includes and misleading comments from scsi_lib.c

Some of that stuff might have been right for 2.4, but..

(and btw, scsi_lib is pretty misleading, what about reusing scsi_queue.c?)

drivers/scsi/scsi_lib.c +0 -32
@@ -7,50 +7,18 @@
  *                        of people at Linux Expo.
  */
 
-/*
- * The fundamental purpose of this file is to contain a library of utility
- * routines that can be used by low-level drivers.   Ultimately the idea
- * is that there should be a sufficiently rich number of functions that it
- * would be possible for a driver author to fashion a queueing function for
- * a low-level driver if they wished.   Note however that this file also
- * contains the "default" versions of these functions, as we don't want to
- * go through and retrofit queueing functions into all 30 some-odd drivers.
- */
-
-#include <linux/module.h>
-
-#include <linux/sched.h>
-#include <linux/timer.h>
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/bio.h>
-#include <linux/ioport.h>
 #include <linux/kernel.h>
-#include <linux/stat.h>
 #include <linux/blk.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/smp_lock.h>
 #include <linux/completion.h>
 
-
-#define __KERNEL_SYSCALLS__
-
-#include <linux/unistd.h>
-
-#include <asm/system.h>
-#include <asm/irq.h>
-#include <asm/dma.h>
-
 #include "scsi.h"
 #include "hosts.h"
 #include <scsi/scsi_ioctl.h>
 
 /*
- * This entire source file deals with the new queueing code.
- */
-
-/*
  * Function:    scsi_insert_special_cmd()
  *
  * Purpose:     Insert pre-formed command into request queue.
#1 lore raw
Quoted 26 lines · Christoph Hellwig
drivers/scsi/scsi_lib.c +0 -16
@@ -7,50 +7,18 @@
  *                        of people at Linux Expo.
  */
 
-/*
- * The fundamental purpose of this file is to contain a library of utility
- * routines that can be used by low-level drivers.   Ultimately the idea
- * is that there should be a sufficiently rich number of functions that it
- * would be possible for a driver author to fashion a queueing function for
- * a low-level driver if they wished.   Note however that this file also
- * contains the "default" versions of these functions, as we don't want to
- * go through and retrofit queueing functions into all 30 some-odd drivers.
- */
-
-#include <linux/module.h>
-
-#include <linux/sched.h>
-#include <linux/timer.h>
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/bio.h>
-#include <linux/ioport.h>
 #include <linux/kernel.h>
-#include <linux/stat.h>

drivers/scsi/scsi_lib.c line 39

Quoted 10 lines
drivers/scsi/scsi_lib.c +0 -7
 #include <linux/blk.h>
-#include <linux/interrupt.h>
-#include <linux/delay.h>
-#include <linux/smp_lock.h>
 #include <linux/completion.h>
 
-
-#define __KERNEL_SYSCALLS__
-
-#include <linux/unistd.h>

I had to add back the smp_lock.h include to compile with CONFIG_PREEMPT, as kernel_locked was not defined and is used by in_atomic().

Patch against the latest scsi-misc-2.5:

drivers/scsi/scsi_lib.c +1 -0
@@ -12,6 +12,7 @@
 #include <linux/bio.h>
 #include <linux/kernel.h>
 #include <linux/blk.h>
+#include <linux/smp_lock.h>
 #include <linux/completion.h>
 
 #include "scsi.h"

-- Patrick Mansfield

#2 lore raw
Quoted 2 lines · Patrick Mansfield

I had to add back the smp_lock.h include to compile with CONFIG_PREEMPT, as kernel_locked was not defined and is used by in_atomic().

Bah. Any chance you could fix the header declaring in_atomic() to pull in smp_lock.h by itself instead?

#3 lore raw
Quoted 6 lines · Christoph Hellwig
Quoted 2 lines · Patrick Mansfield

I had to add back the smp_lock.h include to compile with CONFIG_PREEMPT, as kernel_locked was not defined and is used by in_atomic().

Bah. Any chance you could fix the header declaring in_atomic() to pull in smp_lock.h by itself instead?

It is in hardirq.h, arch specific, 11 of the 20 hardirq.h files would need the change (they reference kernel_locked) to include smp_lock.h.

665 files include smp_lock.h
89 files include hardirq.h
32 files include both

So, should I change the arch hardirq.h files to include smp_lock.h, or just add smp_lock.h to scsi_lib.c?

-- Patrick Mansfield

#4 lore raw
Quoted 8 lines · [email protected] said:

It is in hardirq.h, arch specific, 11 of the 20 hardirq.h files would need the change (they reference kernel_locked) to include smp_lock.h.

665 files include smp_lock.h 89 files include hardirq.h 32 files include both

So, should I change the arch hardirq.h files to include smp_lock.h, or just add smp_lock.h to scsi_lib.c?

That magnitude of change needs to go in through the header files project. I'll just apply the smp_lock.h in scsi_lib fix to the scsi tree for now. They can always take it out again for the proper fix.

James