SCSI: misc possible cleanups
PATCH 1/1 SCSI: misc possible cleanups
This patch below does:
- remove unused code
- make global code without external users static
It is meant for review and not for being applied immediately. It should simply demonstrate with users are possible with the current in-kernel users today.
diffstat output:
drivers/scsi/constants.c | 58 -------- drivers/scsi/hosts.c | 44 +++--- drivers/scsi/scsi.c | 2 drivers/scsi/scsi.h | 8 - drivers/scsi/scsi_debug.c | 2 drivers/scsi/scsi_error.c | 5 drivers/scsi/scsi_lib.c | 5 drivers/scsi/scsi_syms.c | 1 drivers/scsi/scsi_transport_fc.c | 202 ------------------------------ drivers/scsi/scsi_transport_spi.c | 4 include/scsi/scsi_dbg.h | 2 include/scsi/scsi_device.h | 1 include/scsi/scsi_eh.h | 2 include/scsi/scsi_host.h | 1 include/scsi/scsi_transport_fc.h | 4 15 files changed, 32 insertions(+), 309 deletions(-)
include/scsi/scsi_dbg.h renamed from include/scsi/scsi_dbg.h.old +0 -2
@@ -8,8 +8,6 @@extern void __scsi_print_command (unsigned char *);extern void scsi_print_sense (const char *,struct scsi_cmnd *);extern void scsi_print_req_sense (const char *,struct scsi_request *); -extern void scsi_print_driverbyte (int ); -extern void scsi_print_hostbyte (int );extern void scsi_print_status (unsigned char );extern int scsi_print_msg (const unsigned char *);extern const char *scsi_sense_key_string (unsigned char );
drivers/scsi/scsi.h renamed from drivers/scsi/scsi.h.old +0 -8
@@ -80,14 +80,6 @@ {return scsi_print_req_sense (devclass, req); } -static inline void print_driverbyte (int scsiresult) -{ -return scsi_print_driverbyte (scsiresult); -} -static inline void print_hostbyte (int scsiresult) -{ -return scsi_print_hostbyte (scsiresult); -}static inline void print_status (unsigned char status) {return scsi_print_status (status);
drivers/scsi/scsi_syms.c renamed from drivers/scsi/scsi_syms.c.old +0 -1
@@ -28,7 +28,6 @@EXPORT_SYMBOL (scsi_add_host);EXPORT_SYMBOL (scsi_scan_host);EXPORT_SYMBOL (scsi_remove_host); -EXPORT_SYMBOL (scsi_host_get);EXPORT_SYMBOL (scsi_host_put);EXPORT_SYMBOL (scsi_host_lookup);EXPORT_SYMBOL (scsi_register);
drivers/scsi/constants.c renamed from drivers/scsi/constants.c.old +0 -58
61 lines not on this page · raw message
include/scsi/scsi_host.h renamed from include/scsi/scsi_host.h.old +0 -1
@@ -528,7 +528,6 @@extern int __must_check scsi_add_host (struct Scsi_Host *,struct device *);extern void scsi_scan_host (struct Scsi_Host *);extern void scsi_remove_host (struct Scsi_Host *); -extern struct Scsi_Host *scsi_host_get (struct Scsi_Host *);extern void scsi_host_put (struct Scsi_Host *t);extern struct Scsi_Host *scsi_host_lookup (unsigned short );
drivers/scsi/hosts.c renamed from drivers/scsi/hosts.c.old +22 -22
62 lines not on this page · raw message
drivers/scsi/scsi.c renamed from drivers/scsi/scsi.c.old +1 -1
@@ -90,7 +90,7 @@/* * Data declarations. */ -unsigned long scsi_pid; +static unsigned long scsi_pid;static unsigned long serial_number;/*
drivers/scsi/scsi_debug.c renamed from drivers/scsi/scsi_debug.c.old +1 -1
@@ -1781,7 +1781,7 @@device_initcall (scsi_debug_init);module_exit (scsi_debug_exit); -void pseudo_0_release (struct device * dev) +static void pseudo_0_release (struct device * dev) {if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)printk (KERN_INFO "scsi_debug: pseudo_0_release() called\n" );
include/scsi/scsi_eh.h renamed from include/scsi/scsi_eh.h.old +0 -2
@@ -33,8 +33,6 @@extern void scsi_report_bus_reset (struct Scsi_Host *,int );extern void scsi_report_device_reset (struct Scsi_Host *,int ,int );extern int scsi_block_when_processing_errors (struct scsi_device *); -extern int scsi_normalize_sense (const u8 *sense_buffer,int sb_len, -struct scsi_sense_hdr *sshdr);extern int scsi_request_normalize_sense (struct scsi_request *sreq,struct scsi_sense_hdr *sshdr); extern int scsi_command_normalize_sense(struct scsi_cmnd *cmd,
drivers/scsi/scsi_error.c renamed from drivers/scsi/scsi_error.c.old +2 -3
@@ -1863,8 +1863,8 @@* Return value: * 1 if valid sense data information found, else 0; **/ -int scsi_normalize_sense (const u8 *sense_buffer,int sb_len, -struct scsi_sense_hdr *sshdr) +static int scsi_normalize_sense (const u8 *sense_buffer,int sb_len, +struct scsi_sense_hdr *sshdr) {if (!sense_buffer || !sb_len || (sense_buffer[0 ] &0x70 ) !=0x70 )return 0 ;
@@ -1902,7 +1902,6 @@return 1 ; } -EXPORT_SYMBOL (scsi_normalize_sense);int scsi_request_normalize_sense (struct scsi_request *sreq,struct scsi_sense_hdr *sshdr)
include/scsi/scsi_device.h renamed from include/scsi/scsi_device.h.old +0 -1
@@ -219,7 +219,6 @@extern int scsi_device_set_state (struct scsi_device *sdev,enum scsi_device_state state);extern int scsi_device_quiesce (struct scsi_device *sdev); -extern void scsi_device_resume (struct scsi_device *sdev);extern void scsi_target_quiesce (struct scsi_target *);extern void scsi_target_resume (struct scsi_target *);extern const char *scsi_device_state_name (enum scsi_device_state );
drivers/scsi/scsi_lib.c renamed from drivers/scsi/scsi_lib.c.old +2 -3
@@ -43,7 +43,7 @@#endif #define SP (x) { x, "sgpool-" #x } -struct scsi_host_sg_pool scsi_sg_pools[] = { +static struct scsi_host_sg_pool scsi_sg_pools[] = {SP (8 ),SP (16 ),SP (32 ),
@@ -1755,14 +1755,13 @@* * Must be called with user context, may sleep. **/ -void +static void scsi_device_resume (struct scsi_device *sdev) {if (scsi_device_set_state (sdev,SDEV_RUNNING ))return ;scsi_run_queue (sdev->request_queue); } -EXPORT_SYMBOL (scsi_device_resume);static int device_quiesce_fn (struct device *dev,void *data)
include/scsi/scsi_transport_fc.h renamed from include/scsi/scsi_transport_fc.h.old +0 -4
@@ -83,9 +83,5 @@struct scsi_transport_template *fc_attach_transport (struct fc_function_template *);void fc_release_transport (struct scsi_transport_template *); -int fc_target_block (struct scsi_target *starget); -void fc_target_unblock (struct scsi_target *starget); -int fc_host_block (struct Scsi_Host *shost); -void fc_host_unblock (struct Scsi_Host *shost);#endif /* SCSI_TRANSPORT_FC_H */
drivers/scsi/scsi_transport_fc.c renamed from drivers/scsi/scsi_transport_fc.c.old +2 -200
218 lines not on this page · raw message
drivers/scsi/scsi_transport_spi.c renamed from drivers/scsi/scsi_transport_spi.c.old +2 -2
@@ -119,12 +119,12 @@ } -struct class spi_transport_class = { +static struct class spi_transport_class = { .name ="spi_transport" , .release = transport_class_release, }; -struct class spi_host_class = { +static struct class spi_host_class = { .name ="spi_host" , .release = host_class_release, };
Quoted 2 lines · Adrian Bunk
This patch below does:
- remove unused code
Erm, some of the code you're trying to remove was recently added as enablers for fibre channel drivers, like this:
[...]
Quoted 1 line
drivers/scsi/scsi_transport_fc.c | 202 ------------------------------
It's really not safe to remove code without understanding why it's there in the first place.
James
Quoted 7 lines · James Bottomley
Quoted 2 lines · Adrian Bunk
This patch below does:
- remove unused codeErm, some of the code you're trying to remove was recently added as enablers for fibre channel drivers, like this:
Quoted 6 lines
[...]
Quoted 1 line
drivers/scsi/scsi_transport_fc.c | 202 ------------------------------It's really not safe to remove code without understanding why it's there in the first place.
That's exactly why I wrote:
<-- snip -->
It is meant for review and not for being applied immediately. It should simply demonstrate with users are possible with the current in-kernel users today.
<-- snip -->
OK, the last wasn't a correct sentence.
I wanted to say:
It should simply demonstrate with changes are possible with the current in-kernel users.
Quoted 1 line
James
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