HID: roccat: fix build failure if built as module
[sfrench/cifs-2.6.git] / drivers / staging / dream / smd / rpc_server_time_remote.c
1 /* arch/arm/mach-msm/rpc_server_time_remote.c
2  *
3  * Copyright (C) 2007 Google, Inc.
4  * Author: Iliyan Malchev <ibm@android.com>
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16
17 #include <linux/module.h>
18 #include <linux/kernel.h>
19 #include <mach/msm_rpcrouter.h>
20
21 /* time_remote_mtoa server definitions. */
22
23 #define TIME_REMOTE_MTOA_PROG 0x3000005d
24 #if CONFIG_MSM_AMSS_VERSION==6210
25 #define TIME_REMOTE_MTOA_VERS 0
26 #elif (CONFIG_MSM_AMSS_VERSION==6220) || (CONFIG_MSM_AMSS_VERSION==6225)
27 #define TIME_REMOTE_MTOA_VERS 0x9202a8e4
28 #elif CONFIG_MSM_AMSS_VERSION==6350
29 #define TIME_REMOTE_MTOA_VERS 0x00010000
30 #else
31 #error "Unknown AMSS version"
32 #endif
33 #define RPC_TIME_REMOTE_MTOA_NULL   0
34 #define RPC_TIME_TOD_SET_APPS_BASES 2
35
36 struct rpc_time_tod_set_apps_bases_args {
37         uint32_t tick;
38         uint64_t stamp;
39 };
40
41 static int handle_rpc_call(struct msm_rpc_server *server,
42                            struct rpc_request_hdr *req, unsigned len)
43 {
44         switch (req->procedure) {
45         case RPC_TIME_REMOTE_MTOA_NULL:
46                 return 0;
47
48         case RPC_TIME_TOD_SET_APPS_BASES: {
49                 struct rpc_time_tod_set_apps_bases_args *args;
50                 args = (struct rpc_time_tod_set_apps_bases_args *)(req + 1);
51                 args->tick = be32_to_cpu(args->tick);
52                 args->stamp = be64_to_cpu(args->stamp);
53                 printk(KERN_INFO "RPC_TIME_TOD_SET_APPS_BASES:\n"
54                        "\ttick = %d\n"
55                        "\tstamp = %lld\n",
56                        args->tick, args->stamp);
57                 return 0;
58         }
59         default:
60                 return -ENODEV;
61         }
62 }
63
64 static struct msm_rpc_server rpc_server = {
65         .prog = TIME_REMOTE_MTOA_PROG,
66         .vers = TIME_REMOTE_MTOA_VERS,
67         .rpc_call = handle_rpc_call,
68 };
69
70 static int __init rpc_server_init(void)
71 {
72         /* Dual server registration to support backwards compatibility vers */
73         return msm_rpc_create_server(&rpc_server);
74 }
75
76
77 module_init(rpc_server_init);