From 007ff900251b1e29afc3fea09dda6e4cd617a455 Mon Sep 17 00:00:00 2001 From: Oron Peled Date: Sun, 17 Nov 2013 18:05:42 +0200 Subject: [PATCH] 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 Acked-by: Russ Meyerriecks --- drivers/dahdi/dahdi-sysfs.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c index bca6821..3de37d5 100644 --- a/drivers/dahdi/dahdi-sysfs.c +++ b/drivers/dahdi/dahdi-sysfs.c @@ -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]);