提交 2ced5514 编写于 作者: S Sebastian Ott 提交者: Martin Schwidefsky

s390/claw: switch to ccwgroup_create_dev

Switch to the new ccwgroup_create_dev interface. Also wrap device
attributes in a struct device_type and let the driver core create
these attributes automagically.
Reviewed-by: NCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: NSebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
上级 00d5bdd1
master alk-4.19.24 alk-4.19.30 alk-4.19.34 alk-4.19.36 alk-4.19.43 alk-4.19.48 alk-4.19.57 ck-4.19.67 ck-4.19.81 ck-4.19.91 github/fork/deepanshu1422/fix-typo-in-comment github/fork/haosdent/fix-typo linux-next v4.19.91 v4.19.90 v4.19.89 v4.19.88 v4.19.87 v4.19.86 v4.19.85 v4.19.84 v4.19.83 v4.19.82 v4.19.81 v4.19.80 v4.19.79 v4.19.78 v4.19.77 v4.19.76 v4.19.75 v4.19.74 v4.19.73 v4.19.72 v4.19.71 v4.19.70 v4.19.69 v4.19.68 v4.19.67 v4.19.66 v4.19.65 v4.19.64 v4.19.63 v4.19.62 v4.19.61 v4.19.60 v4.19.59 v4.19.58 v4.19.57 v4.19.56 v4.19.55 v4.19.54 v4.19.53 v4.19.52 v4.19.51 v4.19.50 v4.19.49 v4.19.48 v4.19.47 v4.19.46 v4.19.45 v4.19.44 v4.19.43 v4.19.42 v4.19.41 v4.19.40 v4.19.39 v4.19.38 v4.19.37 v4.19.36 v4.19.35 v4.19.34 v4.19.33 v4.19.32 v4.19.31 v4.19.30 v4.19.29 v4.19.28 v4.19.27 v4.19.26 v4.19.25 v4.19.24 v4.19.23 v4.19.22 v4.19.21 v4.19.20 v4.19.19 v4.19.18 v4.19.17 v4.19.16 v4.19.15 v4.19.14 v4.19.13 v4.19.12 v4.19.11 v4.19.10 v4.19.9 v4.19.8 v4.19.7 v4.19.6 v4.19.5 v4.19.4 v4.19.3 v4.19.2 v4.19.1 v4.19 v4.19-rc8 v4.19-rc7 v4.19-rc6 v4.19-rc5 v4.19-rc4 v4.19-rc3 v4.19-rc2 v4.19-rc1 ck-release-21 ck-release-20 ck-release-19.2 ck-release-19.1 ck-release-19 ck-release-18 ck-release-17.2 ck-release-17.1 ck-release-17 ck-release-16 ck-release-15.1 ck-release-15 ck-release-14 ck-release-13.2 ck-release-13 ck-release-12 ck-release-11 ck-release-10 ck-release-9 ck-release-7 alk-release-15 alk-release-14 alk-release-13.2 alk-release-13 alk-release-12 alk-release-11 alk-release-10 alk-release-9 alk-release-7
无相关合并请求
......@@ -230,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);
......@@ -266,7 +264,7 @@ static struct ccwgroup_driver claw_group_driver = {
},
.max_slaves = 2,
.driver_id = 0xC3D3C1E6,
.probe = claw_probe,
.setup = claw_probe,
.remove = claw_remove_device,
.set_online = claw_new_device,
.set_offline = claw_shutdown_device,
......@@ -290,17 +288,14 @@ 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.driver_id,
&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[] = {
......@@ -321,60 +316,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 *
*-------------------------------------------------------------------*/
......@@ -3090,7 +3031,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);
......@@ -3318,7 +3258,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[] = {
......@@ -3329,24 +3268,61 @@ 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 *
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部