summaryrefslogtreecommitdiffstats
path: root/drivers/cdrom
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2007-10-11 14:50:55 +1000
committerPaul Mackerras <paulus@samba.org>2007-10-11 20:40:45 +1000
commit73be7d5267774b8fef1d83ebffc070cd090c4398 (patch)
tree4266c8ad059faadd8f1cdf89f92f2dfa27d88cc9 /drivers/cdrom
parentb707f517d2c72c6b340ba762ed8a7de2b22935e9 (diff)
downloadtalos-op-linux-73be7d5267774b8fef1d83ebffc070cd090c4398.tar.gz
talos-op-linux-73be7d5267774b8fef1d83ebffc070cd090c4398.zip
[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/cdrom')
-rw-r--r--drivers/cdrom/viocd.c37
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 {
char type[4];
char model[3];
};
-/*
- * This needs to be allocated since it is passed to the
- * Hypervisor and we may be a module.
- */
-static struct cdrom_info *viocd_unitinfo;
-static dma_addr_t unitinfo_dmaaddr;
struct disk_info {
struct gendisk *viocd_disk;
struct cdrom_device_info viocd_info;
struct device *dev;
+ struct cdrom_info unitinfo;
};
static struct disk_info viocd_diskinfo[VIOCD_MAX_CD];
@@ -164,9 +159,9 @@ static int proc_viocd_show(struct seq_file *m, void *v)
for (i = 0; i < viocd_numdev; i++) {
seq_printf(m, "viocd device %d is iSeries resource %10.10s"
"type %4.4s, model %3.3s\n",
- i, viocd_unitinfo[i].rsrcname,
- viocd_unitinfo[i].type,
- viocd_unitinfo[i].model);
+ i, viocd_diskinfo[i].unitinfo.rsrcname,
+ viocd_diskinfo[i].unitinfo.type,
+ viocd_diskinfo[i].unitinfo.model);
}
return 0;
}
@@ -222,6 +217,8 @@ static void __init get_viocd_info(void)
HvLpEvent_Rc hvrc;
int i;
struct viocd_waitevent we;
+ struct cdrom_info *viocd_unitinfo;
+ dma_addr_t unitinfo_dmaaddr;
viocd_unitinfo = dma_alloc_coherent(iSeries_vio_dev,
sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
@@ -259,16 +256,15 @@ static void __init get_viocd_info(void)
goto error_ret;
}
- for (i = 0; (i < VIOCD_MAX_CD) && viocd_unitinfo[i].rsrcname[0]; i++)
+ for (i = 0; (i < VIOCD_MAX_CD) && viocd_unitinfo[i].rsrcname[0]; i++) {
+ viocd_diskinfo[viocd_numdev].unitinfo = viocd_unitinfo[i];
viocd_numdev++;
+ }
error_ret:
- if (viocd_numdev == 0) {
- dma_free_coherent(iSeries_vio_dev,
- sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
- viocd_unitinfo, unitinfo_dmaaddr);
- viocd_unitinfo = NULL;
- }
+ dma_free_coherent(iSeries_vio_dev,
+ sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
+ viocd_unitinfo, unitinfo_dmaaddr);
}
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)
d = &viocd_diskinfo[deviceno];
c = &d->viocd_info;
- ci = &viocd_unitinfo[deviceno];
+ ci = &d->unitinfo;
c->ops = &viocd_dops;
c->speed = 4;
@@ -816,9 +812,6 @@ static int __init viocd_init(void)
return 0;
out_free_info:
- dma_free_coherent(iSeries_vio_dev,
- sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
- viocd_unitinfo, unitinfo_dmaaddr);
vio_clearHandler(viomajorsubtype_cdio);
viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2);
out_unregister:
@@ -830,10 +823,6 @@ static void __exit viocd_exit(void)
{
remove_proc_entry("iSeries/viocd", NULL);
vio_unregister_driver(&viocd_driver);
- if (viocd_unitinfo != NULL)
- dma_free_coherent(iSeries_vio_dev,
- sizeof(*viocd_unitinfo) * VIOCD_MAX_CD,
- viocd_unitinfo, unitinfo_dmaaddr);
viopath_close(viopath_hostLp, viomajorsubtype_cdio, MAX_CD_REQ + 2);
vio_clearHandler(viomajorsubtype_cdio);
unregister_blkdev(VIOCD_MAJOR, VIOCD_DEVICE);
OpenPOWER on IntegriCloud