[SCSI] mpt: modify mptctl_exit() to call proper deregister functions
authorKei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Mon, 15 Mar 2010 05:48:43 +0000 (14:48 +0900)
committerJames Bottomley <James.Bottomley@suse.de>
Sun, 11 Apr 2010 14:23:45 +0000 (09:23 -0500)
commit65c054f235fda2d545ecd2a7948906a3cf0c1f39
treeb8782ce4208432df2336730a57dd427d620f2d1e
parentf018b73af6db4f330ad5da9ac53997a699c30c42
[SCSI] mpt: modify mptctl_exit() to call proper deregister functions

This patch fixes some issues of mptctl_exit().

  1) It doesn't call mpt_deregister() for mptctl_taskmgmt_id
     => Insmoding/rmmoding mptctl.ko repeadtedly (up to
        MPT_MAX_PROTOCOL_DRIVERS-1 at most) can eat up all cb_idx,
        and that would cause a lack of MptCallbacks[], MptDriverClass[],
        and MptEvHandlers[].

  2) It doesn't call mpt_event_deregister() for mptctl_id
     => Need to call it.

  3) It calls mpt_reset_deregister() for mptctl_taskmgmt_id
     => This could accidentally deregister an innocent reset handler
        that you don't want to.

This patch also adds a check for mptctl_taskmgmt_id.

Signed-off-by: Kei Tokunaga <tokunaga.keiich@jp.fujitsu.com>
Acked-by: "Desai, Kashyap" <Kashyap.Desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
drivers/message/fusion/mptctl.c