sysfs: create symlink "ddev" to device of span

Create a "ddev" symlink from span's sysfs node to the one of its dahdi
device.

Signed-off-by: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
Acked-by: Russ Meyerriecks <rmeyerriecks@digium.com>
This commit is contained in:
Oron Peled 2013-11-17 18:05:42 +02:00 committed by Tzafrir Cohen
parent be25fdb6fa
commit 007ff90025

View File

@ -306,6 +306,7 @@ void span_sysfs_remove(struct dahdi_span *span)
get_device(span_device);
span_uevent_send(span, KOBJ_OFFLINE);
device_unregister(span->span_device);
sysfs_remove_link(&span_device->kobj, "ddev");
dev_set_drvdata(span_device, NULL);
span_device->parent = NULL;
put_device(span_device);
@ -345,6 +346,15 @@ int span_sysfs_create(struct dahdi_span *span)
span->span_device = NULL;
goto cleanup;
}
res = sysfs_create_link(&span_device->kobj, &span_device->parent->kobj,
"ddev");
if (res) {
span_err(span, "%s: sysfs_create_link failed: %d\n", __func__,
res);
kfree(span->span_device);
span->span_device = NULL;
goto cleanup;
}
for (x = 0; x < span->channels; x++) {
res = chan_sysfs_create(span->chans[x]);