blob: d67d664eaf83a63010e8553766bfe0e9c73166bc [file] [log] [blame]
Shalabh Jainb0037c02013-01-18 12:47:40 -08001/* Copyright (c) 2011, 2013, The Linux Foundation. All rights reserved.
Jack Phame32cf322011-09-26 10:20:17 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
Jack Phame32cf322011-09-26 10:20:17 -070013#ifndef __LINUX_USB_DIAG_BRIDGE_H__
14#define __LINUX_USB_DIAG_BRIDGE_H__
15
16struct diag_bridge_ops {
17 void *ctxt;
18 void (*read_complete_cb)(void *ctxt, char *buf,
Dixon Peterson32e70bb2011-12-16 13:26:45 -080019 int buf_size, int actual);
Jack Phame32cf322011-09-26 10:20:17 -070020 void (*write_complete_cb)(void *ctxt, char *buf,
Dixon Peterson32e70bb2011-12-16 13:26:45 -080021 int buf_size, int actual);
Jack Phamb60775a2012-02-14 17:57:41 -080022 int (*suspend)(void *ctxt);
23 void (*resume)(void *ctxt);
Jack Phame32cf322011-09-26 10:20:17 -070024};
25
Shalabh Jainb0037c02013-01-18 12:47:40 -080026#if IS_ENABLED(CONFIG_USB_QCOM_DIAG_BRIDGE)
Jack Phamf6ed5582011-11-02 16:08:31 -070027
Shalabh Jainb0037c02013-01-18 12:47:40 -080028extern int diag_bridge_read(int id, char *data, int size);
29extern int diag_bridge_write(int id, char *data, int size);
30extern int diag_bridge_open(int id, struct diag_bridge_ops *ops);
31extern void diag_bridge_close(int id);
Jack Phamf6ed5582011-11-02 16:08:31 -070032
33#else
34
Shalabh Jainb0037c02013-01-18 12:47:40 -080035static int __maybe_unused diag_bridge_read(int id, char *data, int size)
Jack Phamf6ed5582011-11-02 16:08:31 -070036{
37 return -ENODEV;
38}
39
Shalabh Jainb0037c02013-01-18 12:47:40 -080040static int __maybe_unused diag_bridge_write(int id, char *data, int size)
Jack Phamf6ed5582011-11-02 16:08:31 -070041{
42 return -ENODEV;
43}
44
Shalabh Jainb0037c02013-01-18 12:47:40 -080045static int __maybe_unused diag_bridge_open(int id, struct diag_bridge_ops *ops)
Jack Phamf6ed5582011-11-02 16:08:31 -070046{
47 return -ENODEV;
48}
49
Shalabh Jainb0037c02013-01-18 12:47:40 -080050static void __maybe_unused diag_bridge_close(int id) { }
Jack Phamf6ed5582011-11-02 16:08:31 -070051
52#endif
Jack Phame32cf322011-09-26 10:20:17 -070053
54#endif