aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_debug.c
diff options
context:
space:
mode:
authorNicholas Bellinger <nab@linux-iscsi.org>2010-09-06 20:24:28 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-09-16 22:54:08 -0400
commit9b906779568f009b53254a15b283b53ae4570b93 (patch)
treed5f625a6c7a032fc299510c29d6fd3ce04710d38 /drivers/scsi/scsi_debug.c
parent78d16341facf829a71b6f7c68ec5511b9c168060 (diff)
[SCSI] scsi_debug: Convert to use root_device_register() and root_device_unregister()
This patch updates the scsi_debug virtual LLD to use root_device_register() and root_device_unregister() from include/linux/device.h instead of device_register() and device_unregister() respectively within scsi_debug_init() and scsi_debug_exit() This simply involved converting the static struct device pseudo_primary into a pointer that is setup by the call to root_device_register(). This patch also contains the correct IS_ERR() conditional check of root_device_register() from within scsi_debug_init(). Thanks to Richard Sharpe and Dmitry Torokhov for their help with this item. Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org> Acked-by: Douglas Gilbert <dgilbert@interlog.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/scsi_debug.c')
-rw-r--r--drivers/scsi/scsi_debug.c25
1 files changed, 8 insertions, 17 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 06329d47b38..2c36bae3bd4 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -3226,16 +3226,7 @@ static void do_remove_driverfs_files(void)
3226 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_add_host); 3226 driver_remove_file(&sdebug_driverfs_driver, &driver_attr_add_host);
3227} 3227}
3228 3228
3229static void pseudo_0_release(struct device *dev) 3229struct device *pseudo_primary;
3230{
3231 if (SCSI_DEBUG_OPT_NOISE & scsi_debug_opts)
3232 printk(KERN_INFO "scsi_debug: pseudo_0_release() called\n");
3233}
3234
3235static struct device pseudo_primary = {
3236 .init_name = "pseudo_0",
3237 .release = pseudo_0_release,
3238};
3239 3230
3240static int __init scsi_debug_init(void) 3231static int __init scsi_debug_init(void)
3241{ 3232{
@@ -3382,10 +3373,10 @@ static int __init scsi_debug_init(void)
3382 map_region(0, 2); 3373 map_region(0, 2);
3383 } 3374 }
3384 3375
3385 ret = device_register(&pseudo_primary); 3376 pseudo_primary = root_device_register("pseudo_0");
3386 if (ret < 0) { 3377 if (IS_ERR(pseudo_primary)) {
3387 printk(KERN_WARNING "scsi_debug: device_register error: %d\n", 3378 printk(KERN_WARNING "scsi_debug: root_device_register() error\n");
3388 ret); 3379 ret = PTR_ERR(pseudo_primary);
3389 goto free_vm; 3380 goto free_vm;
3390 } 3381 }
3391 ret = bus_register(&pseudo_lld_bus); 3382 ret = bus_register(&pseudo_lld_bus);
@@ -3432,7 +3423,7 @@ del_files:
3432bus_unreg: 3423bus_unreg:
3433 bus_unregister(&pseudo_lld_bus); 3424 bus_unregister(&pseudo_lld_bus);
3434dev_unreg: 3425dev_unreg:
3435 device_unregister(&pseudo_primary); 3426 root_device_unregister(pseudo_primary);
3436free_vm: 3427free_vm:
3437 if (map_storep) 3428 if (map_storep)
3438 vfree(map_storep); 3429 vfree(map_storep);
@@ -3453,7 +3444,7 @@ static void __exit scsi_debug_exit(void)
3453 do_remove_driverfs_files(); 3444 do_remove_driverfs_files();
3454 driver_unregister(&sdebug_driverfs_driver); 3445 driver_unregister(&sdebug_driverfs_driver);
3455 bus_unregister(&pseudo_lld_bus); 3446 bus_unregister(&pseudo_lld_bus);
3456 device_unregister(&pseudo_primary); 3447 root_device_unregister(pseudo_primary);
3457 3448
3458 if (dif_storep) 3449 if (dif_storep)
3459 vfree(dif_storep); 3450 vfree(dif_storep);
@@ -3504,7 +3495,7 @@ static int sdebug_add_adapter(void)
3504 spin_unlock(&sdebug_host_list_lock); 3495 spin_unlock(&sdebug_host_list_lock);
3505 3496
3506 sdbg_host->dev.bus = &pseudo_lld_bus; 3497 sdbg_host->dev.bus = &pseudo_lld_bus;
3507 sdbg_host->dev.parent = &pseudo_primary; 3498 sdbg_host->dev.parent = pseudo_primary;
3508 sdbg_host->dev.release = &sdebug_release_adapter; 3499 sdbg_host->dev.release = &sdebug_release_adapter;
3509 dev_set_name(&sdbg_host->dev, "adapter%d", scsi_debug_add_host); 3500 dev_set_name(&sdbg_host->dev, "adapter%d", scsi_debug_add_host);
3510 3501