From 4bfdd8bea5f2f7b85a9cce3818e4d59fc7bde263 Mon Sep 17 00:00:00 2001 From: Shaun Ruffell Date: Fri, 29 Nov 2013 15:14:27 -0600 Subject: [PATCH] dahdi: Remove "ddev" symlink before unregistering the span device. This makes the order of operations for device removal symmetrical with those for device addition. This change also eliminates the following warning when unloading dahdi after dynamic spans have been created: ------------[ cut here ]------------ WARNING: at /build/buildd/linux-3.2.0/fs/sysfs/inode.c:324 sysfs_hash_and_remove+0x92/0xa0() Hardware name: VirtualBox sysfs: can not remove 'ddev', no directory Modules linked in: dahdi_dynamic_loc(O-) dahdi_dynamic(O) dahdi(O) crc_ccitt hdlc_cisco hdlc vboxvideo(O) drm vboxsf(O) vesafb ppdev psmouse parport_pc serio_raw mac_hid vboxguest(O) nfsd nfs i2c_piix4 lockd fscache auth_rpcgss nfs_acl sunrpc ext2 lp parport e1000 [last unloaded: dahdi] Pid: 3533, comm: rmmod Tainted: G W O 3.2.0-56-generic-pae #86-Ubuntu Call Trace: [] warn_slowpath_common+0x72/0xa0 [] ? sysfs_hash_and_remove+0x92/0xa0 [] ? sysfs_hash_and_remove+0x92/0xa0 [] warn_slowpath_fmt+0x33/0x40 [] sysfs_hash_and_remove+0x92/0xa0 [] ? device_del+0x127/0x150 [] sysfs_remove_link+0x20/0x30 [] span_sysfs_remove+0xa3/0x170 [dahdi] [] ? default_spin_lock_flags+0x8/0x10 [] _dahdi_unassign_span+0xae/0x210 [dahdi] [] ? __cond_resched+0x1b/0x30 [] ? _cond_resched+0x29/0x30 [] dahdi_unregister_device+0xe3/0x190 [dahdi] [] dahdi_dynamic_unregister_driver+0x84/0x130 [dahdi_dynamic] [] dahdi_dynamic_local_exit+0xd/0xb20 [dahdi_dynamic_loc] [] sys_delete_module+0x135/0x230 [] ? pagetypeinfo_show.part.8+0x33/0x100 [] sysenter_do_call+0x12/0x28 ---[ end trace b818e326720c8385 ]--- Signed-off-by: Shaun Ruffell --- drivers/dahdi/dahdi-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dahdi/dahdi-sysfs.c b/drivers/dahdi/dahdi-sysfs.c index 6b1962c..9583e63 100644 --- a/drivers/dahdi/dahdi-sysfs.c +++ b/drivers/dahdi/dahdi-sysfs.c @@ -328,8 +328,8 @@ 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"); + device_unregister(span->span_device); dev_set_drvdata(span_device, NULL); span_device->parent = NULL; put_device(span_device);