diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2007-10-11 00:50:55 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-10-11 06:40:45 -0400 |
commit | 73be7d5267774b8fef1d83ebffc070cd090c4398 (patch) | |
tree | 4266c8ad059faadd8f1cdf89f92f2dfa27d88cc9 /drivers | |
parent | b707f517d2c72c6b340ba762ed8a7de2b22935e9 (diff) |
[POWERPC] iSeries: Simplify viocd initialisation
We don't need to keep a lump of dma coherent memory around for the life
of the module.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cdrom/viocd.c | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index e51550db1575..b88fdebe77f6 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -136,17 +136,12 @@ struct cdrom_info { | |||
136 | char type[4]; | 136 | char type[4]; |
137 | char model[3]; | 137 | char model[3]; |
138 | }; | 138 | }; |
139 | /* | ||
140 | * This needs to be allocated since it is passed to the | ||
141 | * Hypervisor and we may be a module. | ||
142 | */ | ||
143 | static struct cdrom_info *viocd_unitinfo; | ||
144 | static dma_addr_t unitinfo_dmaaddr; | ||
145 | 139 | ||
146 | struct disk_info { | 140 | struct disk_info { |
147 | struct gendisk *viocd_disk; | 141 | struct gendisk *viocd_disk; |
148 | struct cdrom_device_info viocd_info; | 142 | struct cdrom_device_info viocd_info; |
149 | struct device *dev; | 143 | struct device *dev; |
144 | struct cdrom_info unitinfo; | ||
150 | }; | 145 | }; |
151 | static struct disk_info viocd_diskinfo[VIOCD_MAX_CD]; | 146 | static struct disk_info viocd_diskinfo[VIOCD_MAX_CD]; |
152 | 147 | ||
@@ -164,9 +159,9 @@ static int proc_viocd_show(struct seq_file *m, void *v) | |||
164 | for (i = 0; i < viocd_numdev; i++) { | 159 | for (i = 0; i < viocd_numdev; i++) { |
165 | seq_printf(m, "viocd device %d is iSeries resource %10.10s" | 160 | seq_printf(m, "viocd device %d is iSeries resource %10.10s" |
166 | "type %4.4s, model %3.3s\n", | 161 | "type %4.4s, model %3.3s\n", |
167 | i, viocd_unitinfo[i].rsrcname, | 162 | i, viocd_diskinfo[i].unitinfo.rsrcname, |
168 | viocd_unitinfo[i].type, | 163 | viocd_diskinfo[i].unitinfo.type, |
169 | viocd_unitinfo[i].model); | 164 | viocd_diskinfo[i].unitinfo.model); |
170 | } | 165 | } |
171 | return 0; | 166 | return 0; |
172 | } | 167 | } |
@@ -222,6 +217,8 @@ static void __init get_viocd_info(void) | |||
222 | HvLpEvent_Rc hvrc; | 217 | HvLpEvent_Rc hvrc; |
223 | int i; | 218 | int i; |
224 | struct viocd_waitevent we; | 219 | struct viocd_waitevent we; |
220 | struct cdrom_info *viocd_unitinfo; | ||
221 | dma_addr_t unitinfo_dmaaddr; | ||
225 | 222 | ||
226 | viocd_unitinfo = dma_alloc_coherent(iSeries_vio_dev, | 223 | viocd_unitinfo = dma_alloc_coherent(iSeries_vio_dev, |
227 | sizeof(*viocd_unitinfo) * VIOCD_MAX_CD, | 224 | sizeof(*viocd_unitinfo) * VIOCD_MAX_CD, |
@@ -259,16 +256,15 @@ static void __init get_viocd_info(void) | |||
259 | goto error_ret; | 256 | goto error_ret; |
260 | } | 257 | } |
261 | 258 | ||
262 | for (i = 0; (i < VIOCD_MAX_CD) && viocd_unitinfo[i].rsrcname[0]; i++) | 259 | for (i = 0; (i < VIOCD_MAX_CD) && viocd_unitinfo[i].rsrcname[0]; i++) { |
260 | viocd_diskinfo[viocd_numdev].unitinfo = viocd_unitinfo[i]; | ||
263 | viocd_numdev++; | 261 | viocd_numdev++; |
262 | } | ||
264 | 263 | ||
265 | error_ret: | 264 | error_ret: |
266 | if (viocd_numdev == 0) { | 265 | dma_free_coherent(iSeries_vio_dev, |
267 | dma_free_coherent(iSeries_vio_dev, | 266 | sizeof(*viocd_unitinfo) * VIOCD_MAX_CD, |
268 | sizeof(*viocd_unitinfo) * VIOCD_MAX_CD, | 267 | viocd_unitinfo, unitinfo_dmaaddr); |
269 | viocd_unitinfo, unitinfo_dmaaddr); | ||
270 | viocd_unitinfo = NULL; | ||
271 | } | ||
272 | } | 268 | } |
273 | 269 | ||
274 | static int viocd_open(struct cdrom_device_info *cdi, int purpose) | 270 | static int viocd_open(struct cdrom_device_info *cdi, int purpose) |
@@ -674,7 +670,7 @@ static int viocd_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
674 | 670 | ||
675 | d = &viocd_diskinfo[deviceno]; | 671 | d = &viocd_diskinfo[deviceno]; |
676 | c = &d->viocd_info; | 672 | c = &d->viocd_info; |
677 | ci = &viocd_unitinfo[deviceno]; | 673 | ci = &d->unitinfo; |
678 | 674 | ||
679 | c->ops = &viocd_dops; | 675 | c->ops = &viocd_dops; |
680 | c->speed = 4; | 676 | c->speed = 4; |
@@ -816,9 +812,6 @@ static int __init viocd_init(void) | |||
816 | return 0; | 812 | return 0; |
817 | 813 | ||
818 | out_free_info: | 814 | out_free_info: |
819 | dma_free_coherent(iSeries_vio_dev, | ||
820 | sizeof(*viocd_unitinfo) * VIOCD_MAX_CD, | ||
821 | viocd_unitinfo, unitinfo_dmaaddr); | ||
822 | vio_clearHandler(viomajorsubtype_cdio); | 815 | vio_clearHandler(viomajorsubtype_cdio); |
823 | viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2); | 816 | viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2); |
824 | out_unregister: | 817 | out_unregister: |
@@ -830,10 +823,6 @@ static void __exit viocd_exit(void) | |||
830 | { | 823 | { |
831 | remove_proc_entry("iSeries/viocd", NULL); | 824 | remove_proc_entry("iSeries/viocd", NULL); |
832 | vio_unregister_driver(&viocd_driver); | 825 | vio_unregister_driver(&viocd_driver); |
833 | if (viocd_unitinfo != NULL) | ||
834 | dma_free_coherent(iSeries_vio_dev, | ||
835 | sizeof(*viocd_unitinfo) * VIOCD_MAX_CD, | ||
836 | viocd_unitinfo, unitinfo_dmaaddr); | ||
837 | viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2); | 826 | viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2); |
838 | vio_clearHandler(viomajorsubtype_cdio); | 827 | vio_clearHandler(viomajorsubtype_cdio); |
839 | unregister_blkdev(VIOCD_MAJOR, VIOCD_DEVICE); | 828 | unregister_blkdev(VIOCD_MAJOR, VIOCD_DEVICE); |