mirror of
https://gitee.com/openharmony/kernel_linux
synced 2025-01-07 16:33:34 +00:00
[S390] struct class_device -> struct device conversion.
Convert struct class_device users under drivers/s390/char to use struct device. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
5bf04b2062
commit
7f021ce195
@ -48,8 +48,8 @@ struct raw3270 {
|
|||||||
struct timer_list timer; /* Device timer. */
|
struct timer_list timer; /* Device timer. */
|
||||||
|
|
||||||
unsigned char *ascebc; /* ascii -> ebcdic table */
|
unsigned char *ascebc; /* ascii -> ebcdic table */
|
||||||
struct class_device *clttydev; /* 3270-class tty device ptr */
|
struct device *clttydev; /* 3270-class tty device ptr */
|
||||||
struct class_device *cltubdev; /* 3270-class tub device ptr */
|
struct device *cltubdev; /* 3270-class tub device ptr */
|
||||||
|
|
||||||
struct raw3270_request init_request;
|
struct raw3270_request init_request;
|
||||||
unsigned char init_data[256];
|
unsigned char init_data[256];
|
||||||
@ -1107,11 +1107,9 @@ raw3270_delete_device(struct raw3270 *rp)
|
|||||||
/* Remove from device chain. */
|
/* Remove from device chain. */
|
||||||
mutex_lock(&raw3270_mutex);
|
mutex_lock(&raw3270_mutex);
|
||||||
if (rp->clttydev && !IS_ERR(rp->clttydev))
|
if (rp->clttydev && !IS_ERR(rp->clttydev))
|
||||||
class_device_destroy(class3270,
|
device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor));
|
||||||
MKDEV(IBM_TTY3270_MAJOR, rp->minor));
|
|
||||||
if (rp->cltubdev && !IS_ERR(rp->cltubdev))
|
if (rp->cltubdev && !IS_ERR(rp->cltubdev))
|
||||||
class_device_destroy(class3270,
|
device_destroy(class3270, MKDEV(IBM_FS3270_MAJOR, rp->minor));
|
||||||
MKDEV(IBM_FS3270_MAJOR, rp->minor));
|
|
||||||
list_del_init(&rp->list);
|
list_del_init(&rp->list);
|
||||||
mutex_unlock(&raw3270_mutex);
|
mutex_unlock(&raw3270_mutex);
|
||||||
|
|
||||||
@ -1181,24 +1179,22 @@ static int raw3270_create_attributes(struct raw3270 *rp)
|
|||||||
if (rc)
|
if (rc)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rp->clttydev = class_device_create(class3270, NULL,
|
rp->clttydev = device_create(class3270, &rp->cdev->dev,
|
||||||
MKDEV(IBM_TTY3270_MAJOR, rp->minor),
|
MKDEV(IBM_TTY3270_MAJOR, rp->minor),
|
||||||
&rp->cdev->dev, "tty%s",
|
"tty%s", rp->cdev->dev.bus_id);
|
||||||
rp->cdev->dev.bus_id);
|
|
||||||
if (IS_ERR(rp->clttydev)) {
|
if (IS_ERR(rp->clttydev)) {
|
||||||
rc = PTR_ERR(rp->clttydev);
|
rc = PTR_ERR(rp->clttydev);
|
||||||
goto out_ttydev;
|
goto out_ttydev;
|
||||||
}
|
}
|
||||||
|
|
||||||
rp->cltubdev = class_device_create(class3270, NULL,
|
rp->cltubdev = device_create(class3270, &rp->cdev->dev,
|
||||||
MKDEV(IBM_FS3270_MAJOR, rp->minor),
|
MKDEV(IBM_FS3270_MAJOR, rp->minor),
|
||||||
&rp->cdev->dev, "tub%s",
|
"tub%s", rp->cdev->dev.bus_id);
|
||||||
rp->cdev->dev.bus_id);
|
|
||||||
if (!IS_ERR(rp->cltubdev))
|
if (!IS_ERR(rp->cltubdev))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
rc = PTR_ERR(rp->cltubdev);
|
rc = PTR_ERR(rp->cltubdev);
|
||||||
class_device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor));
|
device_destroy(class3270, MKDEV(IBM_TTY3270_MAJOR, rp->minor));
|
||||||
|
|
||||||
out_ttydev:
|
out_ttydev:
|
||||||
sysfs_remove_group(&rp->cdev->dev.kobj, &raw3270_attr_group);
|
sysfs_remove_group(&rp->cdev->dev.kobj, &raw3270_attr_group);
|
||||||
|
@ -69,12 +69,9 @@ struct tape_class_device *register_tape_dev(
|
|||||||
if (rc)
|
if (rc)
|
||||||
goto fail_with_cdev;
|
goto fail_with_cdev;
|
||||||
|
|
||||||
tcd->class_device = class_device_create(
|
tcd->class_device = device_create(tape_class, device,
|
||||||
tape_class,
|
tcd->char_device->dev,
|
||||||
NULL,
|
"%s", tcd->device_name
|
||||||
tcd->char_device->dev,
|
|
||||||
device,
|
|
||||||
"%s", tcd->device_name
|
|
||||||
);
|
);
|
||||||
rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0;
|
rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0;
|
||||||
if (rc)
|
if (rc)
|
||||||
@ -90,7 +87,7 @@ struct tape_class_device *register_tape_dev(
|
|||||||
return tcd;
|
return tcd;
|
||||||
|
|
||||||
fail_with_class_device:
|
fail_with_class_device:
|
||||||
class_device_destroy(tape_class, tcd->char_device->dev);
|
device_destroy(tape_class, tcd->char_device->dev);
|
||||||
|
|
||||||
fail_with_cdev:
|
fail_with_cdev:
|
||||||
cdev_del(tcd->char_device);
|
cdev_del(tcd->char_device);
|
||||||
@ -105,11 +102,9 @@ EXPORT_SYMBOL(register_tape_dev);
|
|||||||
void unregister_tape_dev(struct tape_class_device *tcd)
|
void unregister_tape_dev(struct tape_class_device *tcd)
|
||||||
{
|
{
|
||||||
if (tcd != NULL && !IS_ERR(tcd)) {
|
if (tcd != NULL && !IS_ERR(tcd)) {
|
||||||
sysfs_remove_link(
|
sysfs_remove_link(&tcd->class_device->kobj,
|
||||||
&tcd->class_device->dev->kobj,
|
tcd->mode_name);
|
||||||
tcd->mode_name
|
device_destroy(tape_class, tcd->char_device->dev);
|
||||||
);
|
|
||||||
class_device_destroy(tape_class, tcd->char_device->dev);
|
|
||||||
cdev_del(tcd->char_device);
|
cdev_del(tcd->char_device);
|
||||||
kfree(tcd);
|
kfree(tcd);
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
#define TAPECLASS_NAME_LEN 32
|
#define TAPECLASS_NAME_LEN 32
|
||||||
|
|
||||||
struct tape_class_device {
|
struct tape_class_device {
|
||||||
struct cdev * char_device;
|
struct cdev *char_device;
|
||||||
struct class_device * class_device;
|
struct device *class_device;
|
||||||
char device_name[TAPECLASS_NAME_LEN];
|
char device_name[TAPECLASS_NAME_LEN];
|
||||||
char mode_name[TAPECLASS_NAME_LEN];
|
char mode_name[TAPECLASS_NAME_LEN];
|
||||||
};
|
};
|
||||||
|
@ -74,7 +74,7 @@ struct vmlogrdr_priv_t {
|
|||||||
int dev_in_use; /* 1: already opened, 0: not opened*/
|
int dev_in_use; /* 1: already opened, 0: not opened*/
|
||||||
spinlock_t priv_lock;
|
spinlock_t priv_lock;
|
||||||
struct device *device;
|
struct device *device;
|
||||||
struct class_device *class_device;
|
struct device *class_device;
|
||||||
int autorecording;
|
int autorecording;
|
||||||
int autopurge;
|
int autopurge;
|
||||||
};
|
};
|
||||||
@ -762,12 +762,10 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
|
|||||||
device_unregister(dev);
|
device_unregister(dev);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
priv->class_device = class_device_create(
|
priv->class_device = device_create(vmlogrdr_class, dev,
|
||||||
vmlogrdr_class,
|
MKDEV(vmlogrdr_major,
|
||||||
NULL,
|
priv->minor_num),
|
||||||
MKDEV(vmlogrdr_major, priv->minor_num),
|
"%s", dev->bus_id);
|
||||||
dev,
|
|
||||||
"%s", dev->bus_id );
|
|
||||||
if (IS_ERR(priv->class_device)) {
|
if (IS_ERR(priv->class_device)) {
|
||||||
ret = PTR_ERR(priv->class_device);
|
ret = PTR_ERR(priv->class_device);
|
||||||
priv->class_device=NULL;
|
priv->class_device=NULL;
|
||||||
@ -783,8 +781,7 @@ static int vmlogrdr_register_device(struct vmlogrdr_priv_t *priv)
|
|||||||
|
|
||||||
static int vmlogrdr_unregister_device(struct vmlogrdr_priv_t *priv)
|
static int vmlogrdr_unregister_device(struct vmlogrdr_priv_t *priv)
|
||||||
{
|
{
|
||||||
class_device_destroy(vmlogrdr_class,
|
device_destroy(vmlogrdr_class, MKDEV(vmlogrdr_major, priv->minor_num));
|
||||||
MKDEV(vmlogrdr_major, priv->minor_num));
|
|
||||||
if (priv->device != NULL) {
|
if (priv->device != NULL) {
|
||||||
sysfs_remove_group(&priv->device->kobj, &vmlogrdr_attr_group);
|
sysfs_remove_group(&priv->device->kobj, &vmlogrdr_attr_group);
|
||||||
device_unregister(priv->device);
|
device_unregister(priv->device);
|
||||||
|
Loading…
Reference in New Issue
Block a user