diff options
Diffstat (limited to 'drivers/s390/net/ctcm_main.c')
| -rw-r--r-- | drivers/s390/net/ctcm_main.c | 78 | 
1 files changed, 30 insertions, 48 deletions
diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 2c7d2d9be4d..03b6ad03557 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c @@ -1,6 +1,4 @@  /* - * drivers/s390/net/ctcm_main.c - *   * Copyright IBM Corp. 2001, 2009   * Author(s):   *	Original CTC driver(s): @@ -562,6 +560,9 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb)  		skb_queue_tail(&ch->io_queue, skb);  		ccw_idx = 3;  	} +	if (do_debug_ccw) +		ctcmpc_dumpit((char *)&ch->ccw[ccw_idx], +					sizeof(struct ccw1) * 3);  	ch->retry = 0;  	fsm_newstate(ch->fsm, CTC_STATE_TX);  	fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); @@ -671,7 +672,6 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb)  	int ccw_idx;  	unsigned long hi;  	unsigned long saveflags = 0;	/* avoids compiler warning */ -	__u16 block_len;  	CTCM_PR_DEBUG("Enter %s: %s, cp=%i ch=0x%p id=%s state=%s\n",  			__func__, dev->name, smp_processor_id(), ch, @@ -718,7 +718,6 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb)  	 */  	atomic_inc(&skb->users); -	block_len = skb->len + TH_HEADER_LENGTH + PDU_HEADER_LENGTH;  	/*  	 * IDAL support in CTCM is broken, so we have to  	 * care about skb's above 2G ourselves. @@ -1295,6 +1294,11 @@ static void ctcm_irq_handler(struct ccw_device *cdev,  } +static const struct device_type ctcm_devtype = { +	.name = "ctcm", +	.groups = ctcm_attr_groups, +}; +  /**   * Add ctcm specific attributes.   * Add ctcm private data. @@ -1306,7 +1310,6 @@ static void ctcm_irq_handler(struct ccw_device *cdev,  static int ctcm_probe_device(struct ccwgroup_device *cgdev)  {  	struct ctcm_priv *priv; -	int rc;  	CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO,  			"%s %p", @@ -1323,17 +1326,11 @@ static int ctcm_probe_device(struct ccwgroup_device *cgdev)  		put_device(&cgdev->dev);  		return -ENOMEM;  	} - -	rc = ctcm_add_files(&cgdev->dev); -	if (rc) { -		kfree(priv); -		put_device(&cgdev->dev); -		return rc; -	}  	priv->buffer_size = CTCM_BUFSIZE_DEFAULT;  	cgdev->cdev[0]->handler = ctcm_irq_handler;  	cgdev->cdev[1]->handler = ctcm_irq_handler;  	dev_set_drvdata(&cgdev->dev, priv); +	cgdev->dev.type = &ctcm_devtype;  	return 0;  } @@ -1457,7 +1454,7 @@ static int add_channel(struct ccw_device *cdev, enum ctcm_channel_types type,  				ch_fsm_len, GFP_KERNEL);  	}  	if (ch->fsm == NULL) -				goto free_return; +				goto nomem_return;  	fsm_newstate(ch->fsm, CTC_STATE_IDLE); @@ -1610,11 +1607,6 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev)  		goto out_dev;  	} -	if (ctcm_add_attributes(&cgdev->dev)) { -		result = -ENODEV; -		goto out_unregister; -	} -  	strlcpy(priv->fsm->name, dev->name, sizeof(priv->fsm->name));  	dev_info(&dev->dev, @@ -1628,8 +1620,6 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev)  			priv->channel[CTCM_WRITE]->id, priv->protocol);  	return 0; -out_unregister: -	unregister_netdev(dev);  out_dev:  	ctcm_free_netdevice(dev);  out_ccw2: @@ -1668,7 +1658,6 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev)  		/* Close the device */  		ctcm_close(dev);  		dev->flags &= ~IFF_RUNNING; -		ctcm_remove_attributes(&cgdev->dev);  		channel_free(priv->channel[CTCM_READ]);  	} else  		dev = NULL; @@ -1702,15 +1691,12 @@ static void ctcm_remove_device(struct ccwgroup_device *cgdev)  {  	struct ctcm_priv *priv = dev_get_drvdata(&cgdev->dev); -	BUG_ON(priv == NULL); -  	CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO,  			"removing device %p, proto : %d",  			cgdev, priv->protocol);  	if (cgdev->state == CCWGROUP_ONLINE)  		ctcm_shutdown_device(cgdev); -	ctcm_remove_files(&cgdev->dev);  	dev_set_drvdata(&cgdev->dev, NULL);  	kfree(priv);  	put_device(&cgdev->dev); @@ -1762,19 +1748,22 @@ static struct ccw_device_id ctcm_ids[] = {  MODULE_DEVICE_TABLE(ccw, ctcm_ids);  static struct ccw_driver ctcm_ccw_driver = { -	.owner	= THIS_MODULE, -	.name	= "ctcm", +	.driver = { +		.owner	= THIS_MODULE, +		.name	= "ctcm", +	},  	.ids	= ctcm_ids,  	.probe	= ccwgroup_probe_ccwdev,  	.remove	= ccwgroup_remove_ccwdev, +	.int_class = IRQIO_CTC,  };  static struct ccwgroup_driver ctcm_group_driver = { -	.owner       = THIS_MODULE, -	.name        = CTC_DRIVER_NAME, -	.max_slaves  = 2, -	.driver_id   = 0xC3E3C3D4,	/* CTCM */ -	.probe       = ctcm_probe_device, +	.driver = { +		.owner	= THIS_MODULE, +		.name	= CTC_DRIVER_NAME, +	}, +	.setup	     = ctcm_probe_device,  	.remove      = ctcm_remove_device,  	.set_online  = ctcm_new_device,  	.set_offline = ctcm_shutdown_device, @@ -1783,31 +1772,25 @@ static struct ccwgroup_driver ctcm_group_driver = {  	.restore     = ctcm_pm_resume,  }; -static ssize_t -ctcm_driver_group_store(struct device_driver *ddrv, const char *buf, -			size_t count) +static ssize_t ctcm_driver_group_store(struct device_driver *ddrv, +				       const char *buf,	size_t count)  {  	int err; -	err = ccwgroup_create_from_string(ctcm_root_dev, -					  ctcm_group_driver.driver_id, -					  &ctcm_ccw_driver, 2, buf); +	err = ccwgroup_create_dev(ctcm_root_dev, &ctcm_group_driver, 2, buf);  	return err ? err : count;  } -  static DRIVER_ATTR(group, 0200, NULL, ctcm_driver_group_store); -static struct attribute *ctcm_group_attrs[] = { +static struct attribute *ctcm_drv_attrs[] = {  	&driver_attr_group.attr,  	NULL,  }; - -static struct attribute_group ctcm_group_attr_group = { -	.attrs = ctcm_group_attrs, +static struct attribute_group ctcm_drv_attr_group = { +	.attrs = ctcm_drv_attrs,  }; - -static const struct attribute_group *ctcm_group_attr_groups[] = { -	&ctcm_group_attr_group, +static const struct attribute_group *ctcm_drv_attr_groups[] = { +	&ctcm_drv_attr_group,  	NULL,  }; @@ -1823,7 +1806,6 @@ static const struct attribute_group *ctcm_group_attr_groups[] = {   */  static void __exit ctcm_exit(void)  { -	driver_remove_file(&ctcm_group_driver.driver, &driver_attr_group);  	ccwgroup_driver_unregister(&ctcm_group_driver);  	ccw_driver_unregister(&ctcm_ccw_driver);  	root_device_unregister(ctcm_root_dev); @@ -1855,13 +1837,13 @@ static int __init ctcm_init(void)  	if (ret)  		goto out_err;  	ctcm_root_dev = root_device_register("ctcm"); -	ret = IS_ERR(ctcm_root_dev) ? PTR_ERR(ctcm_root_dev) : 0; +	ret = PTR_ERR_OR_ZERO(ctcm_root_dev);  	if (ret)  		goto register_err;  	ret = ccw_driver_register(&ctcm_ccw_driver);  	if (ret)  		goto ccw_err; -	ctcm_group_driver.driver.groups = ctcm_group_attr_groups; +	ctcm_group_driver.driver.groups = ctcm_drv_attr_groups;  	ret = ccwgroup_driver_register(&ctcm_group_driver);  	if (ret)  		goto ccwgroup_err;  | 
