Skip to contentSkip to conversation

Correct removal of procfs host enteries [1/2]

PATCH New Mike Anderson 1 participant 2 messages Aug 1, 2003

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

PATCH 1/1 Correct removal of procfs host enteries [1/2]

This is against scsi-misc-2.5 cset 1.1595.

This is been reposted a few times. Alan Stern just reposted yesterday. My part 1 patch differs on a few lines, but is functionally the same.

Selecting a different part one will give some offset errors, but should work. (YMMV).

-andmike
--
Michael Anderson
[email protected]

DESC
This is a refresh of a patch by Alan Stern to correct the removal of scsi procfs host enteries

http://marc.theaimsgroup.com/?l=linux-scsi&m=105545175600506&w=2
EDESC

 drivers/scsi/hosts.c     |    4 +--
 drivers/scsi/scsi_priv.h |    4 +++
 drivers/scsi/scsi_proc.c |   49 ++++++++++++++++++++++++++++++-----------------
 3 files changed, 38 insertions(+), 19 deletions(-)
drivers/scsi/hosts.c renamed from drivers/scsi/hosts.c~stern_present +2 -2
diff -puN drivers/scsi/hosts.c~stern_present drivers/scsi/hosts.c
@@ -108,7 +108,7 @@ void scsi_free_shost(struct Scsi_Host *s
 		shost->eh_notify = NULL;
 	}
 
-	shost->hostt->present--;
+	scsi_proc_hostdir_rm(shost->hostt);
 	scsi_destroy_command_freelist(shost);
 	kfree(shost);
 }
@@ -209,7 +209,7 @@ struct Scsi_Host *scsi_host_alloc(struct
 	kernel_thread((int (*)(void *))scsi_error_handler, shost, 0);
 	wait_for_completion(&complete);
 	shost->eh_notify = NULL;
-	shost->hostt->present++;
+	scsi_proc_hostdir_add(shost->hostt);
 	return shost;
  fail:
 	kfree(shost);
drivers/scsi/scsi_priv.h renamed from drivers/scsi/scsi_priv.h~stern_present +4 -0
diff -puN drivers/scsi/scsi_priv.h~stern_present drivers/scsi/scsi_priv.h
@@ -90,11 +90,15 @@ extern void scsi_exit_queue(void);
 
 /* scsi_proc.c */
 #ifdef CONFIG_PROC_FS
+extern void scsi_proc_hostdir_add(struct scsi_host_template *);
+extern void scsi_proc_hostdir_rm(struct scsi_host_template *);
 extern void scsi_proc_host_add(struct Scsi_Host *);
 extern void scsi_proc_host_rm(struct Scsi_Host *);
 extern int scsi_init_procfs(void);
 extern void scsi_exit_procfs(void);
 #else
+# define scsi_proc_hostdir_add(sht)	do { } while (0)
+# define scsi_proc_hostdir_rm(sht)	do { } while (0)
 # define scsi_proc_host_add(shost)	do { } while (0)
 # define scsi_proc_host_rm(shost)	do { } while (0)
 # define scsi_init_procfs()		(0)
drivers/scsi/scsi_proc.c renamed from drivers/scsi/scsi_proc.c~stern_present +32 -17

80 lines not on this page · raw message

_

#1 lore raw

PATCH 1/1 Correct removal of procfs host enteries [2/2]

-andmike
--
Michael Anderson
[email protected]

DESC
This patch reduces the user of scsi_host present.

aic79xx_osm and aic7xxx_osm are 2.4 code. ioctl_probe has side effect of needing present value.
EDESC

 drivers/scsi/NCR53c406a.c    |    5 +++--
 drivers/scsi/aacraid/linit.c |    1 -
 drivers/scsi/scsi_module.c   |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/NCR53c406a.c renamed from drivers/scsi/NCR53c406a.c~shost_present +3 -2
diff -puN drivers/scsi/NCR53c406a.c~shost_present drivers/scsi/NCR53c406a.c
@@ -450,6 +450,7 @@ static __inline__ int NCR53c406a_pio_wri
 
 static int __init NCR53c406a_detect(Scsi_Host_Template * tpnt)
 {
+	int present = 0;
 	struct Scsi_Host *shpnt = NULL;
 #ifndef PORT_BASE
 	int i;
@@ -522,7 +523,7 @@ static int __init NCR53c406a_detect(Scsi
 
 	DEB(printk("NCR53c406a: using port_base 0x%x\n", port_base));
 
-	tpnt->present = 1;
+	present = 1;
 	tpnt->proc_name = "NCR53c406a";
 
 	shpnt = scsi_register(tpnt, 0);
@@ -576,7 +577,7 @@ static int __init NCR53c406a_detect(Scsi
 	sprintf(info_msg, "NCR53c406a at 0x%x, IRQ %d, %s PIO mode.", port_base, irq_level, fast_pio ? "fast" : "slow");
 #endif
 
-	return (tpnt->present);
+	return (present);
 
 #if USE_DMA
       err_free_irq:
drivers/scsi/aacraid/linit.c renamed from drivers/scsi/aacraid/linit.c~shost_present +0 -1
diff -puN drivers/scsi/aacraid/linit.c~shost_present drivers/scsi/aacraid/linit.c
@@ -295,7 +295,6 @@ static int aac_detect(Scsi_Host_Template
 			printk(KERN_WARNING "aacraid: unable to register \"aac\" device.\n");
 	}
 
-	template->present = aac_count; /* # of cards of this type found */
 	return aac_count;
 }
 
drivers/scsi/scsi_module.c renamed from drivers/scsi/scsi_module.c~shost_present +1 -1
diff -puN drivers/scsi/scsi_module.c~shost_present drivers/scsi/scsi_module.c
@@ -33,7 +33,7 @@ static int __init init_this_scsi_driver(
 	INIT_LIST_HEAD(&sht->legacy_hosts);
 
 	sht->detect(sht);
-	if (!sht->present)
+	if (list_empty(&sht->legacy_hosts))
 		return -ENODEV;
 
 	list_for_each_entry(shost, &sht->legacy_hosts, sht_legacy_list) {

_