staging: tidspbridge: remove msg_mod_init() and msg_exit()
[deliverable/linux.git] / drivers / staging / tidspbridge / pmgr / msg.c
CommitLineData
c4ca3d5a
ORL
1/*
2 * msg.c
3 *
4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
5 *
6 * DSP/BIOS Bridge msg_ctrl Module.
7 *
8 * Copyright (C) 2005-2006 Texas Instruments, Inc.
9 *
10 * This package is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 */
2094f12d 18#include <linux/types.h>
c4ca3d5a
ORL
19
20/* ----------------------------------- Host OS */
21#include <dspbridge/host_os.h>
22
23/* ----------------------------------- DSP/BIOS Bridge */
c4ca3d5a
ORL
24#include <dspbridge/dbdefs.h>
25
c4ca3d5a
ORL
26/* ----------------------------------- Bridge Driver */
27#include <dspbridge/dspdefs.h>
28
29/* ----------------------------------- Platform Manager */
30#include <dspbridge/dev.h>
31
32/* ----------------------------------- This */
33#include <msgobj.h>
34#include <dspbridge/msg.h>
35
c4ca3d5a
ORL
36/*
37 * ======== msg_create ========
38 * Purpose:
39 * Create an object to manage message queues. Only one of these objects
40 * can exist per device object.
41 */
e6bf74f0 42int msg_create(struct msg_mgr **msg_man,
95870a88 43 struct dev_object *hdev_obj, msg_onexit msg_callback)
c4ca3d5a
ORL
44{
45 struct bridge_drv_interface *intf_fxns;
46 struct msg_mgr_ *msg_mgr_obj;
47 struct msg_mgr *hmsg_mgr;
48 int status = 0;
49
e436d07d 50 *msg_man = NULL;
c4ca3d5a
ORL
51
52 dev_get_intf_fxns(hdev_obj, &intf_fxns);
53
54 /* Let Bridge message module finish the create: */
55 status =
09f13304 56 (*intf_fxns->msg_create) (&hmsg_mgr, hdev_obj, msg_callback);
c4ca3d5a 57
157990f0 58 if (!status) {
c4ca3d5a
ORL
59 /* Fill in DSP API message module's fields of the msg_mgr
60 * structure */
61 msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr;
62 msg_mgr_obj->intf_fxns = intf_fxns;
63
64 /* Finally, return the new message manager handle: */
e436d07d 65 *msg_man = hmsg_mgr;
c4ca3d5a
ORL
66 } else {
67 status = -EPERM;
68 }
69 return status;
70}
71
72/*
73 * ======== msg_delete ========
74 * Purpose:
75 * Delete a msg_ctrl manager allocated in msg_create().
76 */
77void msg_delete(struct msg_mgr *hmsg_mgr)
78{
79 struct msg_mgr_ *msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr;
80 struct bridge_drv_interface *intf_fxns;
81
c4ca3d5a
ORL
82 if (msg_mgr_obj) {
83 intf_fxns = msg_mgr_obj->intf_fxns;
84
85 /* Let Bridge message module destroy the msg_mgr: */
09f13304 86 (*intf_fxns->msg_delete) (hmsg_mgr);
c4ca3d5a
ORL
87 } else {
88 dev_dbg(bridge, "%s: Error hmsg_mgr handle: %p\n",
89 __func__, hmsg_mgr);
90 }
91}
This page took 0.273337 seconds and 5 git commands to generate.