From fcfe100b7976ab81496c71dcd5353b100b500ee8 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 1 May 2012 18:22:30 +0000 Subject: [PATCH] ib_srpt, procfs: Remove code that shows the login information - it is redundant to the ibsrpdm output anyway. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4260 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 128 +-------------------------------------------- srpt/src/ib_srpt.h | 7 --- 2 files changed, 1 insertion(+), 134 deletions(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index e030f3a40..8e7eab953 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -3482,32 +3482,18 @@ static uint16_t srpt_get_scsi_transport_version(struct scst_tgt *scst_tgt) return 0x0940; /* SRP */ } -#if defined(CONFIG_SCST_PROC) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) -static ssize_t show_login_info(struct class_device *dev, char *buf) -#else -static ssize_t show_login_info(struct device *dev, - struct device_attribute *attr, char *buf) -#endif -#else +#if !defined(CONFIG_SCST_PROC) static ssize_t show_login_info(struct kobject *kobj, struct kobj_attribute *attr, char *buf) -#endif { -#if !defined(CONFIG_SCST_PROC) struct scst_tgt *scst_tgt; -#endif struct srpt_device *sdev; struct srpt_port *sport; int i; int len; -#if defined(CONFIG_SCST_PROC) - sdev = container_of(dev, struct srpt_device, dev); -#else scst_tgt = container_of(kobj, struct scst_tgt, tgt_kobj); sdev = scst_tgt_get_tgt_priv(scst_tgt); -#endif len = 0; for (i = 0; i < sdev->device->phys_port_cnt; i++) { sport = &sdev->port[i]; @@ -3532,7 +3518,6 @@ static ssize_t show_login_info(struct kobject *kobj, return len; } -#if !defined(CONFIG_SCST_PROC) static struct kobj_attribute srpt_show_login_info_attr = __ATTR(login_info, S_IRUGO, show_login_info, NULL); @@ -3642,50 +3627,6 @@ static struct scst_proc_data srpt_log_proc_data = { }; #endif -/** - * srpt_dev_release() - Device release callback function. - * - * The callback function srpt_dev_release() is called whenever a device is - * removed from the /sys/class/infiniband_srpt device class. This function - * has been left empty because device nodes are embedded in struct - * srpt_device. - */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) -static void srpt_dev_release(struct class_device *dev) -#else -static void srpt_dev_release(struct device *dev) -#endif -{ -} - -static struct class_attribute srpt_class_attrs[] = { - __ATTR_NULL, -}; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) -static struct class_device_attribute srpt_dev_attrs[] = { -#else -static struct device_attribute srpt_dev_attrs[] = { -#endif - __ATTR(login_info, S_IRUGO, show_login_info, NULL), - __ATTR_NULL, -}; - -static struct class srpt_class = { - .name = "infiniband_srpt", -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - .release = srpt_dev_release, -#else - .dev_release = srpt_dev_release, -#endif - .class_attrs = srpt_class_attrs, -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - .class_dev_attrs = srpt_dev_attrs, -#else - .dev_attrs = srpt_dev_attrs, -#endif -}; - #endif /*CONFIG_SCST_PROC*/ /** @@ -3729,48 +3670,16 @@ static void srpt_add_one(struct ib_device *device) scst_tgt_set_tgt_priv(sdev->scst_tgt, sdev); -#ifdef CONFIG_SCST_PROC - sdev->dev.class = &srpt_class; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - sdev->dev.dev = device->dma_device; -#else - sdev->dev.parent = device->dma_device; -#endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - snprintf(sdev->dev.class_id, BUS_ID_SIZE, "srpt-%s", device->name); -#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30) - snprintf(sdev->dev.bus_id, BUS_ID_SIZE, "srpt-%s", device->name); -#else - dev_set_name(&sdev->dev, "srpt-%s", device->name); -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - if (class_device_register(&sdev->dev)) - goto unregister_tgt; -#else - if (device_register(&sdev->dev)) - goto unregister_tgt; -#endif -#endif /*CONFIG_SCST_PROC*/ - ret = ib_query_device(device, &sdev->dev_attr); if (ret) { PRINT_ERROR("ib_query_device() failed: %d", ret); -#ifdef CONFIG_SCST_PROC - goto err_dev; -#else goto unregister_tgt; -#endif } sdev->pd = ib_alloc_pd(device); if (IS_ERR(sdev->pd)) { PRINT_ERROR("ib_alloc_pd() failed: %ld", PTR_ERR(sdev->pd)); -#ifdef CONFIG_SCST_PROC - goto err_dev; -#else goto unregister_tgt; -#endif } sdev->mr = ib_get_dma_mr(sdev->pd, IB_ACCESS_LOCAL_WRITE); @@ -3894,14 +3803,6 @@ err_mr: ib_dereg_mr(sdev->mr); err_pd: ib_dealloc_pd(sdev->pd); -#ifdef CONFIG_SCST_PROC -err_dev: -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - class_device_unregister(&sdev->dev); -#else - device_unregister(&sdev->dev); -#endif -#endif /*CONFIG_SCST_PROC*/ unregister_tgt: scst_unregister_target(sdev->scst_tgt); free_dev: @@ -3959,14 +3860,6 @@ static void srpt_remove_one(struct ib_device *device) ib_dereg_mr(sdev->mr); ib_dealloc_pd(sdev->pd); -#ifdef CONFIG_SCST_PROC -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - class_device_unregister(&sdev->dev); -#else - device_unregister(&sdev->dev); -#endif -#endif /*CONFIG_SCST_PROC*/ - srpt_free_ioctx_ring((struct srpt_ioctx **)sdev->ioctx_ring, sdev, sdev->srq_size, srp_max_req_size, DMA_FROM_DEVICE); sdev->ioctx_ring = NULL; @@ -4085,23 +3978,11 @@ static int __init srpt_init_module(void) "update your SCST config file accordingly to use HCAs " "GUIDs."); -#ifdef CONFIG_SCST_PROC - ret = class_register(&srpt_class); - if (ret) { - PRINT_ERROR("couldn't register class ib_srpt"); - goto out; - } -#endif - ret = scst_register_target_template(&srpt_template); if (ret < 0) { PRINT_ERROR("couldn't register with scst"); ret = -ENODEV; -#ifdef CONFIG_SCST_PROC - goto out_unregister_class; -#else goto out; -#endif } ret = ib_register_client(&srpt_client); @@ -4126,10 +4007,6 @@ out_unregister_client: #endif /*CONFIG_SCST_PROC*/ out_unregister_target: scst_unregister_target_template(&srpt_template); -#ifdef CONFIG_SCST_PROC -out_unregister_class: - class_unregister(&srpt_class); -#endif /*CONFIG_SCST_PROC*/ out: return ret; } @@ -4143,9 +4020,6 @@ static void __exit srpt_cleanup_module(void) srpt_unregister_procfs_entry(&srpt_template); #endif /*CONFIG_SCST_PROC*/ scst_unregister_target_template(&srpt_template); -#ifdef CONFIG_SCST_PROC - class_unregister(&srpt_class); -#endif /*CONFIG_SCST_PROC*/ TRACE_EXIT(); } diff --git a/srpt/src/ib_srpt.h b/srpt/src/ib_srpt.h index 8cfcd3525..9f896dcae 100644 --- a/srpt/src/ib_srpt.h +++ b/srpt/src/ib_srpt.h @@ -398,13 +398,6 @@ struct srpt_device { spinlock_t spinlock; struct srpt_port port[2]; struct ib_event_handler event_handler; -#ifdef CONFIG_SCST_PROC -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) - struct class_device dev; -#else - struct device dev; -#endif -#endif /*CONFIG_SCST_PROC*/ struct scst_tgt *scst_tgt; bool enabled; };