Commit 80dc35df authored by David S. Miller's avatar David S. Miller

[SPARC64]: Simplify VDC device probing.

We just need to match on the vdc-port nodes, the parent
is really not interesting at all.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 920c3ed7
...@@ -45,8 +45,6 @@ struct vdc_req_entry { ...@@ -45,8 +45,6 @@ struct vdc_req_entry {
struct vdc_port { struct vdc_port {
struct vio_driver_state vio; struct vio_driver_state vio;
struct vdc *vp;
struct gendisk *disk; struct gendisk *disk;
struct vdc_completion *cmp; struct vdc_completion *cmp;
...@@ -72,8 +70,6 @@ struct vdc_port { ...@@ -72,8 +70,6 @@ struct vdc_port {
struct vio_disk_geom geom; struct vio_disk_geom geom;
struct vio_disk_vtoc label; struct vio_disk_vtoc label;
struct list_head list;
}; };
static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio)
...@@ -81,15 +77,6 @@ static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio) ...@@ -81,15 +77,6 @@ static inline struct vdc_port *to_vdc_port(struct vio_driver_state *vio)
return container_of(vio, struct vdc_port, vio); return container_of(vio, struct vdc_port, vio);
} }
struct vdc {
/* Protects prot_list. */
spinlock_t lock;
struct vio_dev *dev;
struct list_head port_list;
};
/* Ordered from largest major to lowest */ /* Ordered from largest major to lowest */
static struct vio_version vdc_versions[] = { static struct vio_version vdc_versions[] = {
{ .major = 1, .minor = 0 }, { .major = 1, .minor = 0 },
...@@ -747,21 +734,23 @@ static struct vio_driver_ops vdc_vio_ops = { ...@@ -747,21 +734,23 @@ static struct vio_driver_ops vdc_vio_ops = {
.handshake_complete = vdc_handshake_complete, .handshake_complete = vdc_handshake_complete,
}; };
static void print_version(void)
{
static int version_printed;
if (version_printed++ == 0)
printk(KERN_INFO "%s", version);
}
static int __devinit vdc_port_probe(struct vio_dev *vdev, static int __devinit vdc_port_probe(struct vio_dev *vdev,
const struct vio_device_id *id) const struct vio_device_id *id)
{ {
struct mdesc_handle *hp; struct mdesc_handle *hp;
struct vdc_port *port; struct vdc_port *port;
unsigned long flags;
struct vdc *vp;
const u64 *port_id; const u64 *port_id;
int err; int err;
vp = dev_get_drvdata(vdev->dev.parent); print_version();
if (!vp) {
printk(KERN_ERR PFX "Cannot find port parent vdc.\n");
return -ENODEV;
}
hp = mdesc_grab(); hp = mdesc_grab();
...@@ -783,7 +772,6 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev, ...@@ -783,7 +772,6 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev,
goto err_out_release_mdesc; goto err_out_release_mdesc;
} }
port->vp = vp;
port->dev_no = *port_id; port->dev_no = *port_id;
if (port->dev_no >= 26) if (port->dev_no >= 26)
...@@ -818,12 +806,6 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev, ...@@ -818,12 +806,6 @@ static int __devinit vdc_port_probe(struct vio_dev *vdev,
if (err) if (err)
goto err_out_free_tx_ring; goto err_out_free_tx_ring;
INIT_LIST_HEAD(&port->list);
spin_lock_irqsave(&vp->lock, flags);
list_add(&port->list, &vp->port_list);
spin_unlock_irqrestore(&vp->lock, flags);
dev_set_drvdata(&vdev->dev, port); dev_set_drvdata(&vdev->dev, port);
mdesc_release(hp); mdesc_release(hp);
...@@ -879,58 +861,6 @@ static struct vio_driver vdc_port_driver = { ...@@ -879,58 +861,6 @@ static struct vio_driver vdc_port_driver = {
} }
}; };
static int __devinit vdc_probe(struct vio_dev *vdev,
const struct vio_device_id *id)
{
static int vdc_version_printed;
struct vdc *vp;
if (vdc_version_printed++ == 0)
printk(KERN_INFO "%s", version);
vp = kzalloc(sizeof(struct vdc), GFP_KERNEL);
if (!vp)
return -ENOMEM;
spin_lock_init(&vp->lock);
vp->dev = vdev;
INIT_LIST_HEAD(&vp->port_list);
dev_set_drvdata(&vdev->dev, vp);
return 0;
}
static int vdc_remove(struct vio_dev *vdev)
{
struct vdc *vp = dev_get_drvdata(&vdev->dev);
if (vp) {
kfree(vp);
dev_set_drvdata(&vdev->dev, NULL);
}
return 0;
}
static struct vio_device_id vdc_match[] = {
{
.type = "block",
},
{},
};
MODULE_DEVICE_TABLE(vio, vdc_match);
static struct vio_driver vdc_driver = {
.id_table = vdc_match,
.probe = vdc_probe,
.remove = vdc_remove,
.driver = {
.name = "vdc",
.owner = THIS_MODULE,
}
};
static int __init vdc_init(void) static int __init vdc_init(void)
{ {
int err; int err;
...@@ -940,19 +870,13 @@ static int __init vdc_init(void) ...@@ -940,19 +870,13 @@ static int __init vdc_init(void)
goto out_err; goto out_err;
vdc_major = err; vdc_major = err;
err = vio_register_driver(&vdc_driver);
if (err)
goto out_unregister_blkdev;
err = vio_register_driver(&vdc_port_driver); err = vio_register_driver(&vdc_port_driver);
if (err) if (err)
goto out_unregister_vdc; goto out_unregister_blkdev;
return 0; return 0;
out_unregister_vdc:
vio_unregister_driver(&vdc_driver);
out_unregister_blkdev: out_unregister_blkdev:
unregister_blkdev(vdc_major, VDCBLK_NAME); unregister_blkdev(vdc_major, VDCBLK_NAME);
vdc_major = 0; vdc_major = 0;
...@@ -964,7 +888,6 @@ out_err: ...@@ -964,7 +888,6 @@ out_err:
static void __exit vdc_exit(void) static void __exit vdc_exit(void)
{ {
vio_unregister_driver(&vdc_port_driver); vio_unregister_driver(&vdc_port_driver);
vio_unregister_driver(&vdc_driver);
unregister_blkdev(vdc_major, VDCBLK_NAME); unregister_blkdev(vdc_major, VDCBLK_NAME);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment