Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 362787
b: refs/heads/master
c: afdfed0
h: refs/heads/master
i:
  362785: 53faa61
  362783: 55514e9
v: v3
  • Loading branch information
Sebastian Ott authored and Martin Schwidefsky committed Apr 17, 2013
1 parent f10176d commit 53e8ea3
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 44 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 863fc8492734822b95671780db803cd9a4b7d923
refs/heads/master: afdfed0f86d192c9957996d58d51c06ff2b9cb44
73 changes: 30 additions & 43 deletions trunk/drivers/s390/cio/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,19 +1087,12 @@ static int io_subchannel_probe(struct subchannel *sch)
dev_set_uevent_suppress(&sch->dev, 0);
kobject_uevent(&sch->dev.kobj, KOBJ_ADD);
cdev = sch_get_cdev(sch);
cdev->dev.groups = ccwdev_attr_groups;
device_initialize(&cdev->dev);
cdev->private->flags.initialized = 1;
ccw_device_register(cdev);
/*
* Check if the device is already online. If it is
* the reference count needs to be corrected since we
* didn't obtain a reference in ccw_device_set_online.
*/
if (cdev->private->state != DEV_STATE_NOT_OPER &&
cdev->private->state != DEV_STATE_OFFLINE &&
cdev->private->state != DEV_STATE_BOXED)
get_device(&cdev->dev);
rc = ccw_device_register(cdev);
if (rc) {
/* Release online reference. */
put_device(&cdev->dev);
goto out_schedule;
}
return 0;
}
io_subchannel_init_fields(sch);
Expand Down Expand Up @@ -1581,10 +1574,6 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process)
}

#ifdef CONFIG_CCW_CONSOLE
static struct ccw_device console_cdev;
static struct ccw_device_private console_private;
static int console_cdev_in_use;

static int ccw_device_console_enable(struct ccw_device *cdev,
struct subchannel *sch)
{
Expand All @@ -1595,67 +1584,65 @@ static int ccw_device_console_enable(struct ccw_device *cdev,
if (rc)
return rc;
sch->driver = &io_subchannel_driver;
/* Initialize the ccw_device structure. */
cdev->dev.parent= &sch->dev;
sch_set_cdev(sch, cdev);
io_subchannel_recog(cdev, sch);
/* Now wait for the async. recognition to come to an end. */
spin_lock_irq(cdev->ccwlock);
while (!dev_fsm_final_state(cdev))
ccw_device_wait_idle(cdev);

rc = -EIO;
if (cdev->private->state != DEV_STATE_OFFLINE)
/* Hold on to an extra reference while device is online. */
get_device(&cdev->dev);
rc = ccw_device_online(cdev);
if (rc)
goto out_unlock;
ccw_device_online(cdev);

while (!dev_fsm_final_state(cdev))
ccw_device_wait_idle(cdev);

if (cdev->private->state != DEV_STATE_ONLINE)
goto out_unlock;
rc = 0;
if (cdev->private->state == DEV_STATE_ONLINE)
cdev->online = 1;
else
rc = -EIO;
out_unlock:
spin_unlock_irq(cdev->ccwlock);
if (rc) /* Give up online reference since onlining failed. */
put_device(&cdev->dev);
return rc;
}

struct ccw_device *
ccw_device_probe_console(void)
struct ccw_device *ccw_device_probe_console(void)
{
struct io_subchannel_private *io_priv;
struct ccw_device *cdev;
struct subchannel *sch;
int ret;

if (xchg(&console_cdev_in_use, 1) != 0)
return ERR_PTR(-EBUSY);
sch = cio_probe_console();
if (IS_ERR(sch)) {
console_cdev_in_use = 0;
return (void *) sch;
}
memset(&console_cdev, 0, sizeof(struct ccw_device));
memset(&console_private, 0, sizeof(struct ccw_device_private));
console_cdev.private = &console_private;
console_private.cdev = &console_cdev;
console_private.int_class = IRQIO_CIO;
if (IS_ERR(sch))
return ERR_CAST(sch);

io_priv = kzalloc(sizeof(*io_priv), GFP_KERNEL | GFP_DMA);
if (!io_priv) {
put_device(&sch->dev);
return ERR_PTR(-ENOMEM);
}
cdev = io_subchannel_create_ccwdev(sch);
if (IS_ERR(cdev)) {
put_device(&sch->dev);
kfree(io_priv);
return cdev;
}
set_io_private(sch, io_priv);

ret = ccw_device_console_enable(&console_cdev, sch);
ret = ccw_device_console_enable(cdev, sch);
if (ret) {
console_cdev_in_use = 0;
set_io_private(sch, NULL);
put_device(&sch->dev);
put_device(&cdev->dev);
kfree(io_priv);
return ERR_PTR(ret);
}
console_cdev.online = 1;
return &console_cdev;
return cdev;
}

/**
Expand Down

0 comments on commit 53e8ea3

Please sign in to comment.