From linux-kernel@vger.kernel.org Mon Jul 23 00:34:21 2007 Date: Sun, 22 Jul 2007 21:01:11 GMT From: Linux Kernel Mailing List To: git-commits-head@vger.kernel.org Subject: [SCSI] a4000t, zorro7xx, mvme16x, bvme6000, sim710: xxx_device_remove seems buggy Gitweb: http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3ac709c113daa19e375e8b0fef318fab1713f687 Commit: 3ac709c113daa19e375e8b0fef318fab1713f687 Parent: 88e2f98e1b3eb27ae708daa3b37dd50f3f06c952 Author: Matthew Wilcox AuthorDate: Tue Jul 17 13:38:03 2007 -0600 Committer: James Bottomley CommitDate: Wed Jul 18 11:17:57 2007 -0500 [SCSI] a4000t, zorro7xx, mvme16x, bvme6000,sim710: xxx_device_remove seems buggy Fix drivers misusing dev_to_shost Some drivers were using dev_to_shost to go from a struct device to the corresponding shost. Unfortunately, dev_to_shost only looks up the tree to find an shost (it's designed to go from a scsi_device or a scsi_target to the parent scsi_host), and these drivers were calling it with the parent of the scsi_host. I've fixed this by saving a pointer to the Scsi_Host in the drvdata, which matches what most scsi drivers do. Signed-off-by: Matthew Wilcox Cc: Geert Uytterhoeven Signed-off-by: James Bottomley Signed-off-by: Geert Uytterhoeven --- drivers/scsi/a4000t.c | 3 ++- drivers/scsi/bvme6000_scsi.c | 3 ++- drivers/scsi/mvme16x_scsi.c | 3 ++- drivers/scsi/sim710.c | 3 ++- drivers/scsi/zorro7xx.c | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) --- a/drivers/scsi/a4000t.c +++ b/drivers/scsi/a4000t.c @@ -79,6 +79,7 @@ static int __devinit a4000t_probe(struct goto out_put_host; } + dev_set_drvdata(dev, host); scsi_scan_host(host); return 0; @@ -95,7 +96,7 @@ static int __devinit a4000t_probe(struct static __devexit int a4000t_device_remove(struct device *dev) { - struct Scsi_Host *host = dev_to_shost(dev); + struct Scsi_Host *host = dev_get_drvdata(dev); struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)host->hostdata[0]; --- a/drivers/scsi/bvme6000_scsi.c +++ b/drivers/scsi/bvme6000_scsi.c @@ -74,6 +74,7 @@ bvme6000_probe(struct device *dev) goto out_put_host; } + dev_set_drvdata(dev, host); scsi_scan_host(host); return 0; @@ -89,7 +90,7 @@ bvme6000_probe(struct device *dev) static __devexit int bvme6000_device_remove(struct device *dev) { - struct Scsi_Host *host = dev_to_shost(dev); + struct Scsi_Host *host = dev_get_drvdata(dev); struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)host->hostdata[0]; --- a/drivers/scsi/mvme16x_scsi.c +++ b/drivers/scsi/mvme16x_scsi.c @@ -89,6 +89,7 @@ mvme16x_probe(struct device *dev) out_be32(0xfff4202c, v); } + dev_set_drvdata(dev, host); scsi_scan_host(host); return 0; @@ -104,7 +105,7 @@ mvme16x_probe(struct device *dev) static __devexit int mvme16x_device_remove(struct device *dev) { - struct Scsi_Host *host = dev_to_shost(dev); + struct Scsi_Host *host = dev_get_drvdata(dev); struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)host->hostdata[0]; --- a/drivers/scsi/sim710.c +++ b/drivers/scsi/sim710.c @@ -139,6 +139,7 @@ sim710_probe_common(struct device *dev, goto out_put_host; } + dev_set_drvdata(dev, host); scsi_scan_host(host); return 0; @@ -156,7 +157,7 @@ sim710_probe_common(struct device *dev, static __devexit int sim710_device_remove(struct device *dev) { - struct Scsi_Host *host = dev_to_shost(dev); + struct Scsi_Host *host = dev_get_drvdata(dev); struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)host->hostdata[0]; --- a/drivers/scsi/zorro7xx.c +++ b/drivers/scsi/zorro7xx.c @@ -130,6 +130,7 @@ static int __devinit zorro7xx_init_one(s goto out_put_host; } + zorro_set_drvdata(z, host); scsi_scan_host(host); return 0; @@ -148,7 +149,7 @@ static int __devinit zorro7xx_init_one(s static __devexit void zorro7xx_remove_one(struct zorro_dev *z) { - struct Scsi_Host *host = dev_to_shost(&z->dev); + struct Scsi_Host *host = zorro_get_drvdata(z); struct NCR_700_Host_Parameters *hostdata = (struct NCR_700_Host_Parameters *)host->hostdata[0];