Commit 92bf435f authored by Michael Holzheu's avatar Michael Holzheu Committed by Heiko Carstens

[S390] tape: duplicate sysfs filename when setting tape device online

When a tape device is set online, offline and online again, the following
error message is printed on the console: "sysfs: duplicate filename
'non-rewinding' can not be created". The reason is that when setting a
device online, the tape driver creates a sysfs symlink from the tape device
to the tape class device. Unfortunately the symlink is not removed
correctly, when the device is set offline. Instead of passing the
tape device object to sysfs_remove_link, the class device object is used.
This patch fixes this problem and uses the correct tape device object now.
Signed-off-by: default avatarMichael Holzheu <holzheu@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
parent 00966c0a
...@@ -83,9 +83,9 @@ tapechar_setup_device(struct tape_device * device) ...@@ -83,9 +83,9 @@ tapechar_setup_device(struct tape_device * device)
void void
tapechar_cleanup_device(struct tape_device *device) tapechar_cleanup_device(struct tape_device *device)
{ {
unregister_tape_dev(device->rt); unregister_tape_dev(&device->cdev->dev, device->rt);
device->rt = NULL; device->rt = NULL;
unregister_tape_dev(device->nt); unregister_tape_dev(&device->cdev->dev, device->nt);
device->nt = NULL; device->nt = NULL;
} }
......
...@@ -99,11 +99,10 @@ fail_with_tcd: ...@@ -99,11 +99,10 @@ fail_with_tcd:
} }
EXPORT_SYMBOL(register_tape_dev); EXPORT_SYMBOL(register_tape_dev);
void unregister_tape_dev(struct tape_class_device *tcd) void unregister_tape_dev(struct device *device, struct tape_class_device *tcd)
{ {
if (tcd != NULL && !IS_ERR(tcd)) { if (tcd != NULL && !IS_ERR(tcd)) {
sysfs_remove_link(&tcd->class_device->kobj, sysfs_remove_link(&device->kobj, tcd->mode_name);
tcd->mode_name);
device_destroy(tape_class, tcd->char_device->dev); device_destroy(tape_class, tcd->char_device->dev);
cdev_del(tcd->char_device); cdev_del(tcd->char_device);
kfree(tcd); kfree(tcd);
......
...@@ -56,6 +56,6 @@ struct tape_class_device *register_tape_dev( ...@@ -56,6 +56,6 @@ struct tape_class_device *register_tape_dev(
char * device_name, char * device_name,
char * node_name char * node_name
); );
void unregister_tape_dev(struct tape_class_device *tcd); void unregister_tape_dev(struct device *device, struct tape_class_device *tcd);
#endif /* __TAPE_CLASS_H__ */ #endif /* __TAPE_CLASS_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment