diff options
Diffstat (limited to 'drivers/s390/net/claw.c')
| -rw-r--r-- | drivers/s390/net/claw.c | 165 | 
1 files changed, 64 insertions, 101 deletions
diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index b41fae37d3a..6b1ff90d2f0 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c @@ -136,7 +136,6 @@ static inline void  claw_set_busy(struct net_device *dev)  {   ((struct claw_privbk *)dev->ml_priv)->tbusy = 1; - eieio();  }  static inline void @@ -144,13 +143,11 @@ claw_clear_busy(struct net_device *dev)  {  	clear_bit(0, &(((struct claw_privbk *) dev->ml_priv)->tbusy));  	netif_wake_queue(dev); -	eieio();  }  static inline int  claw_check_busy(struct net_device *dev)  { -	eieio();  	return ((struct claw_privbk *) dev->ml_priv)->tbusy;  } @@ -233,8 +230,6 @@ static ssize_t claw_rbuff_show(struct device *dev,  static ssize_t claw_rbuff_write(struct device *dev,  	struct device_attribute *attr,  	const char *buf, size_t count); -static int claw_add_files(struct device *dev); -static void claw_remove_files(struct device *dev);  /*   Functions for System Validate  */  static int claw_process_control( struct net_device *dev, struct ccwbk * p_ccw); @@ -267,12 +262,10 @@ static struct ccwgroup_driver claw_group_driver = {  		.owner	= THIS_MODULE,  		.name	= "claw",  	}, -        .max_slaves  = 2, -        .driver_id   = 0xC3D3C1E6, -        .probe       = claw_probe, -        .remove      = claw_remove_device, -        .set_online  = claw_new_device, -        .set_offline = claw_shutdown_device, +	.setup	     = claw_probe, +	.remove      = claw_remove_device, +	.set_online  = claw_new_device, +	.set_offline = claw_shutdown_device,  	.prepare     = claw_pm_prepare,  }; @@ -293,30 +286,24 @@ static struct ccw_driver claw_ccw_driver = {  	.int_class = IOINT_CLW,  }; -static ssize_t -claw_driver_group_store(struct device_driver *ddrv, const char *buf, -			size_t count) +static ssize_t claw_driver_group_store(struct device_driver *ddrv, +				       const char *buf,	size_t count)  {  	int err; -	err = ccwgroup_create_from_string(claw_root_dev, -					  claw_group_driver.driver_id, -					  &claw_ccw_driver, 2, buf); +	err = ccwgroup_create_dev(claw_root_dev, &claw_group_driver, 2, buf);  	return err ? err : count;  } -  static DRIVER_ATTR(group, 0200, NULL, claw_driver_group_store); -static struct attribute *claw_group_attrs[] = { +static struct attribute *claw_drv_attrs[] = {  	&driver_attr_group.attr,  	NULL,  }; - -static struct attribute_group claw_group_attr_group = { -	.attrs = claw_group_attrs, +static struct attribute_group claw_drv_attr_group = { +	.attrs = claw_drv_attrs,  }; - -static const struct attribute_group *claw_group_attr_groups[] = { -	&claw_group_attr_group, +static const struct attribute_group *claw_drv_attr_groups[] = { +	&claw_drv_attr_group,  	NULL,  }; @@ -324,60 +311,6 @@ static const struct attribute_group *claw_group_attr_groups[] = {  *       Key functions  */ -/*----------------------------------------------------------------* - *   claw_probe                                                   * - *      this function is called for each CLAW device.             * - *----------------------------------------------------------------*/ -static int -claw_probe(struct ccwgroup_device *cgdev) -{ -	int  		rc; -	struct claw_privbk *privptr=NULL; - -	CLAW_DBF_TEXT(2, setup, "probe"); -	if (!get_device(&cgdev->dev)) -		return -ENODEV; -	privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); -	dev_set_drvdata(&cgdev->dev, privptr); -	if (privptr == NULL) { -		probe_error(cgdev); -		put_device(&cgdev->dev); -		CLAW_DBF_TEXT_(2, setup, "probex%d", -ENOMEM); -		return -ENOMEM; -	} -	privptr->p_mtc_envelope= kzalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); -	privptr->p_env = kzalloc(sizeof(struct claw_env), GFP_KERNEL); -        if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { -                probe_error(cgdev); -		put_device(&cgdev->dev); -		CLAW_DBF_TEXT_(2, setup, "probex%d", -ENOMEM); -                return -ENOMEM; -        } -	memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8); -	memcpy(privptr->p_env->host_name,WS_NAME_NOT_DEF,8); -	memcpy(privptr->p_env->api_type,WS_NAME_NOT_DEF,8); -	privptr->p_env->packing = 0; -	privptr->p_env->write_buffers = 5; -	privptr->p_env->read_buffers = 5; -	privptr->p_env->read_size = CLAW_FRAME_SIZE; -	privptr->p_env->write_size = CLAW_FRAME_SIZE; -	rc = claw_add_files(&cgdev->dev); -	if (rc) { -		probe_error(cgdev); -		put_device(&cgdev->dev); -		dev_err(&cgdev->dev, "Creating the /proc files for a new" -		" CLAW device failed\n"); -		CLAW_DBF_TEXT_(2, setup, "probex%d", rc); -		return rc; -	} -	privptr->p_env->p_priv = privptr; -        cgdev->cdev[0]->handler = claw_irq_handler; -	cgdev->cdev[1]->handler = claw_irq_handler; -	CLAW_DBF_TEXT(2, setup, "prbext 0"); - -        return 0; -}  /*  end of claw_probe       */ -  /*-------------------------------------------------------------------*   *   claw_tx                                                         *   *-------------------------------------------------------------------*/ @@ -3093,7 +3026,6 @@ claw_remove_device(struct ccwgroup_device *cgdev)  	dev_info(&cgdev->dev, " will be removed.\n");  	if (cgdev->state == CCWGROUP_ONLINE)  		claw_shutdown_device(cgdev); -	claw_remove_files(&cgdev->dev);  	kfree(priv->p_mtc_envelope);  	priv->p_mtc_envelope=NULL;  	kfree(priv->p_env); @@ -3321,7 +3253,6 @@ claw_rbuff_write(struct device *dev, struct device_attribute *attr,  	CLAW_DBF_TEXT_(2, setup, "RB=%d", p_env->read_buffers);  	return count;  } -  static DEVICE_ATTR(read_buffer, 0644, claw_rbuff_show, claw_rbuff_write);  static struct attribute *claw_attr[] = { @@ -3332,40 +3263,73 @@ static struct attribute *claw_attr[] = {  	&dev_attr_host_name.attr,  	NULL,  }; -  static struct attribute_group claw_attr_group = {  	.attrs = claw_attr,  }; +static const struct attribute_group *claw_attr_groups[] = { +	&claw_attr_group, +	NULL, +}; +static const struct device_type claw_devtype = { +	.name = "claw", +	.groups = claw_attr_groups, +}; -static int -claw_add_files(struct device *dev) +/*----------------------------------------------------------------* + *   claw_probe 						  * + *	this function is called for each CLAW device.		  * + *----------------------------------------------------------------*/ +static int claw_probe(struct ccwgroup_device *cgdev)  { -	CLAW_DBF_TEXT(2, setup, "add_file"); -	return sysfs_create_group(&dev->kobj, &claw_attr_group); -} +	struct claw_privbk *privptr = NULL; -static void -claw_remove_files(struct device *dev) -{ -	CLAW_DBF_TEXT(2, setup, "rem_file"); -	sysfs_remove_group(&dev->kobj, &claw_attr_group); -} +	CLAW_DBF_TEXT(2, setup, "probe"); +	if (!get_device(&cgdev->dev)) +		return -ENODEV; +	privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); +	dev_set_drvdata(&cgdev->dev, privptr); +	if (privptr == NULL) { +		probe_error(cgdev); +		put_device(&cgdev->dev); +		CLAW_DBF_TEXT_(2, setup, "probex%d", -ENOMEM); +		return -ENOMEM; +	} +	privptr->p_mtc_envelope = kzalloc(MAX_ENVELOPE_SIZE, GFP_KERNEL); +	privptr->p_env = kzalloc(sizeof(struct claw_env), GFP_KERNEL); +	if ((privptr->p_mtc_envelope == NULL) || (privptr->p_env == NULL)) { +		probe_error(cgdev); +		put_device(&cgdev->dev); +		CLAW_DBF_TEXT_(2, setup, "probex%d", -ENOMEM); +		return -ENOMEM; +	} +	memcpy(privptr->p_env->adapter_name, WS_NAME_NOT_DEF, 8); +	memcpy(privptr->p_env->host_name, WS_NAME_NOT_DEF, 8); +	memcpy(privptr->p_env->api_type, WS_NAME_NOT_DEF, 8); +	privptr->p_env->packing = 0; +	privptr->p_env->write_buffers = 5; +	privptr->p_env->read_buffers = 5; +	privptr->p_env->read_size = CLAW_FRAME_SIZE; +	privptr->p_env->write_size = CLAW_FRAME_SIZE; +	privptr->p_env->p_priv = privptr; +	cgdev->cdev[0]->handler = claw_irq_handler; +	cgdev->cdev[1]->handler = claw_irq_handler; +	cgdev->dev.type = &claw_devtype; +	CLAW_DBF_TEXT(2, setup, "prbext 0"); + +	return 0; +}  /*  end of claw_probe       */  /*--------------------------------------------------------------------*  *    claw_init  and cleanup                                           *  *---------------------------------------------------------------------*/ -static void __exit -claw_cleanup(void) +static void __exit claw_cleanup(void)  { -	driver_remove_file(&claw_group_driver.driver, -			   &driver_attr_group);  	ccwgroup_driver_unregister(&claw_group_driver);  	ccw_driver_unregister(&claw_ccw_driver);  	root_device_unregister(claw_root_dev);  	claw_unregister_debug_facility();  	pr_info("Driver unloaded\n"); -  }  /** @@ -3374,8 +3338,7 @@ claw_cleanup(void)   *   * @return 0 on success, !0 on error.   */ -static int __init -claw_init(void) +static int __init claw_init(void)  {  	int ret = 0; @@ -3394,7 +3357,7 @@ claw_init(void)  	ret = ccw_driver_register(&claw_ccw_driver);  	if (ret)  		goto ccw_err; -	claw_group_driver.driver.groups = claw_group_attr_groups; +	claw_group_driver.driver.groups = claw_drv_attr_groups;  	ret = ccwgroup_driver_register(&claw_group_driver);  	if (ret)  		goto ccwgroup_err;  |