Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 151115
b: refs/heads/master
c: 3ef32e6
h: refs/heads/master
i:
  151113: 4601ab0
  151111: 9f8300d
v: v3
  • Loading branch information
Frank Munzert authored and Martin Schwidefsky committed Jun 16, 2009
1 parent b105ae7 commit 7489e31
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 5 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: 9f62fa1618987e9fadb2eef86d35ef168ddf5a1f
refs/heads/master: 3ef32e62cb55785f6f1b5ad7290744f74bdadaf0
3 changes: 2 additions & 1 deletion trunk/drivers/s390/char/tape.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* tape device driver for 3480/3490E/3590 tapes.
*
* S390 and zSeries version
* Copyright IBM Corp. 2001,2006
* Copyright IBM Corp. 2001, 2009
* Author(s): Carsten Otte <cotte@de.ibm.com>
* Tuan Ngo-Anh <ngoanh@de.ibm.com>
* Martin Schwidefsky <schwidefsky@de.ibm.com>
Expand Down Expand Up @@ -286,6 +286,7 @@ extern void tape_state_set(struct tape_device *, enum tape_state);

extern int tape_generic_online(struct tape_device *, struct tape_discipline *);
extern int tape_generic_offline(struct ccw_device *);
extern int tape_generic_pm_suspend(struct ccw_device *);

/* Externals from tape_devmap.c */
extern int tape_generic_probe(struct ccw_device *);
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/s390/char/tape_34xx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* drivers/s390/char/tape_34xx.c
* tape device discipline for 3480/3490 tapes.
*
* Copyright (C) IBM Corp. 2001,2006
* Copyright IBM Corp. 2001, 2009
* Author(s): Carsten Otte <cotte@de.ibm.com>
* Tuan Ngo-Anh <ngoanh@de.ibm.com>
* Martin Schwidefsky <schwidefsky@de.ibm.com>
Expand Down Expand Up @@ -1302,6 +1302,7 @@ static struct ccw_driver tape_34xx_driver = {
.remove = tape_generic_remove,
.set_online = tape_34xx_online,
.set_offline = tape_generic_offline,
.freeze = tape_generic_pm_suspend,
};

static int
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/s390/char/tape_3590.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* drivers/s390/char/tape_3590.c
* tape device discipline for 3590 tapes.
*
* Copyright IBM Corp. 2001,2006
* Copyright IBM Corp. 2001, 2009
* Author(s): Stefan Bader <shbader@de.ibm.com>
* Michael Holzheu <holzheu@de.ibm.com>
* Martin Schwidefsky <schwidefsky@de.ibm.com>
Expand Down Expand Up @@ -1715,6 +1715,7 @@ static struct ccw_driver tape_3590_driver = {
.remove = tape_generic_remove,
.set_offline = tape_generic_offline,
.set_online = tape_3590_online,
.freeze = tape_generic_pm_suspend,
};

/*
Expand Down
52 changes: 51 additions & 1 deletion trunk/drivers/s390/char/tape_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* basic function of the tape device driver
*
* S390 and zSeries version
* Copyright IBM Corp. 2001,2006
* Copyright IBM Corp. 2001, 2009
* Author(s): Carsten Otte <cotte@de.ibm.com>
* Michael Holzheu <holzheu@de.ibm.com>
* Tuan Ngo-Anh <ngoanh@de.ibm.com>
Expand Down Expand Up @@ -379,6 +379,55 @@ tape_cleanup_device(struct tape_device *device)
tape_med_state_set(device, MS_UNKNOWN);
}

/*
* Suspend device.
*
* Called by the common I/O layer if the drive should be suspended on user
* request. We refuse to suspend if the device is loaded or in use for the
* following reason:
* While the Linux guest is suspended, it might be logged off which causes
* devices to be detached. Tape devices are automatically rewound and unloaded
* during DETACH processing (unless the tape device was attached with the
* NOASSIGN or MULTIUSER option). After rewind/unload, there is no way to
* resume the original state of the tape device, since we would need to
* manually re-load the cartridge which was active at suspend time.
*/
int tape_generic_pm_suspend(struct ccw_device *cdev)
{
struct tape_device *device;

device = cdev->dev.driver_data;
if (!device) {
return -ENODEV;
}

DBF_LH(3, "(%08x): tape_generic_pm_suspend(%p)\n",
device->cdev_id, device);

if (device->medium_state != MS_UNLOADED) {
pr_err("A cartridge is loaded in tape device %s, "
"refusing to suspend\n", dev_name(&cdev->dev));
return -EBUSY;
}

spin_lock_irq(get_ccwdev_lock(device->cdev));
switch (device->tape_state) {
case TS_INIT:
case TS_NOT_OPER:
case TS_UNUSED:
spin_unlock_irq(get_ccwdev_lock(device->cdev));
break;
default:
pr_err("Tape device %s is busy, refusing to "
"suspend\n", dev_name(&cdev->dev));
spin_unlock_irq(get_ccwdev_lock(device->cdev));
return -EBUSY;
}

DBF_LH(3, "(%08x): Drive suspended.\n", device->cdev_id);
return 0;
}

/*
* Set device offline.
*
Expand Down Expand Up @@ -1273,6 +1322,7 @@ EXPORT_SYMBOL(tape_generic_remove);
EXPORT_SYMBOL(tape_generic_probe);
EXPORT_SYMBOL(tape_generic_online);
EXPORT_SYMBOL(tape_generic_offline);
EXPORT_SYMBOL(tape_generic_pm_suspend);
EXPORT_SYMBOL(tape_put_device);
EXPORT_SYMBOL(tape_get_device_reference);
EXPORT_SYMBOL(tape_state_verbose);
Expand Down

0 comments on commit 7489e31

Please sign in to comment.