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:
   [<c105ab42>] warn_slowpath_common+0x72/0xa0
   [<c11a7992>] ? sysfs_hash_and_remove+0x92/0xa0
   [<c11a7992>] ? sysfs_hash_and_remove+0x92/0xa0
   [<c105ac13>] warn_slowpath_fmt+0x33/0x40
   [<c11a7992>] sysfs_hash_and_remove+0x92/0xa0
   [<c1385427>] ? device_del+0x127/0x150
   [<c11a9bd0>] sysfs_remove_link+0x20/0x30
   [<d8a03fa3>] span_sysfs_remove+0xa3/0x170 [dahdi]
   [<c1036a88>] ? default_spin_lock_flags+0x8/0x10
   [<d89f7e5e>] _dahdi_unassign_span+0xae/0x210 [dahdi]
   [<c1053f6b>] ? __cond_resched+0x1b/0x30
   [<c15a9859>] ? _cond_resched+0x29/0x30
   [<d89f80a3>] dahdi_unregister_device+0xe3/0x190 [dahdi]
   [<d8936464>] dahdi_dynamic_unregister_driver+0x84/0x130 [dahdi_dynamic]
   [<d89284ed>] dahdi_dynamic_local_exit+0xd/0xb20 [dahdi_dynamic_loc]
   [<c1095995>] sys_delete_module+0x135/0x230
   [<c1110063>] ? pagetypeinfo_show.part.8+0x33/0x100
   [<c15b295f>] sysenter_do_call+0x12/0x28
  ---[ end trace b818e326720c8385 ]---

Signed-off-by: Shaun Ruffell <sruffell@digium.com>
This commit is contained in:
Shaun Ruffell 2013-11-29 15:14:27 -06:00
parent c0d52a04cb
commit 4bfdd8bea5

View File

@ -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);