Shalabh Jain | b0037c0 | 2013-01-18 12:47:40 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2011, 2013, The Linux Foundation. All rights reserved. |
Jack Pham | e32cf32 | 2011-09-26 10:20:17 -0700 | [diff] [blame] | 2 | * |
| 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 Pham | e32cf32 | 2011-09-26 10:20:17 -0700 | [diff] [blame] | 13 | #ifndef __LINUX_USB_DIAG_BRIDGE_H__ |
| 14 | #define __LINUX_USB_DIAG_BRIDGE_H__ |
| 15 | |
| 16 | struct diag_bridge_ops { |
| 17 | void *ctxt; |
| 18 | void (*read_complete_cb)(void *ctxt, char *buf, |
Dixon Peterson | 32e70bb | 2011-12-16 13:26:45 -0800 | [diff] [blame] | 19 | int buf_size, int actual); |
Jack Pham | e32cf32 | 2011-09-26 10:20:17 -0700 | [diff] [blame] | 20 | void (*write_complete_cb)(void *ctxt, char *buf, |
Dixon Peterson | 32e70bb | 2011-12-16 13:26:45 -0800 | [diff] [blame] | 21 | int buf_size, int actual); |
Jack Pham | b60775a | 2012-02-14 17:57:41 -0800 | [diff] [blame] | 22 | int (*suspend)(void *ctxt); |
| 23 | void (*resume)(void *ctxt); |
Jack Pham | e32cf32 | 2011-09-26 10:20:17 -0700 | [diff] [blame] | 24 | }; |
| 25 | |
Shalabh Jain | b0037c0 | 2013-01-18 12:47:40 -0800 | [diff] [blame] | 26 | #if IS_ENABLED(CONFIG_USB_QCOM_DIAG_BRIDGE) |
Jack Pham | f6ed558 | 2011-11-02 16:08:31 -0700 | [diff] [blame] | 27 | |
Shalabh Jain | b0037c0 | 2013-01-18 12:47:40 -0800 | [diff] [blame] | 28 | extern int diag_bridge_read(int id, char *data, int size); |
| 29 | extern int diag_bridge_write(int id, char *data, int size); |
| 30 | extern int diag_bridge_open(int id, struct diag_bridge_ops *ops); |
| 31 | extern void diag_bridge_close(int id); |
Jack Pham | f6ed558 | 2011-11-02 16:08:31 -0700 | [diff] [blame] | 32 | |
| 33 | #else |
| 34 | |
Shalabh Jain | b0037c0 | 2013-01-18 12:47:40 -0800 | [diff] [blame] | 35 | static int __maybe_unused diag_bridge_read(int id, char *data, int size) |
Jack Pham | f6ed558 | 2011-11-02 16:08:31 -0700 | [diff] [blame] | 36 | { |
| 37 | return -ENODEV; |
| 38 | } |
| 39 | |
Shalabh Jain | b0037c0 | 2013-01-18 12:47:40 -0800 | [diff] [blame] | 40 | static int __maybe_unused diag_bridge_write(int id, char *data, int size) |
Jack Pham | f6ed558 | 2011-11-02 16:08:31 -0700 | [diff] [blame] | 41 | { |
| 42 | return -ENODEV; |
| 43 | } |
| 44 | |
Shalabh Jain | b0037c0 | 2013-01-18 12:47:40 -0800 | [diff] [blame] | 45 | static int __maybe_unused diag_bridge_open(int id, struct diag_bridge_ops *ops) |
Jack Pham | f6ed558 | 2011-11-02 16:08:31 -0700 | [diff] [blame] | 46 | { |
| 47 | return -ENODEV; |
| 48 | } |
| 49 | |
Shalabh Jain | b0037c0 | 2013-01-18 12:47:40 -0800 | [diff] [blame] | 50 | static void __maybe_unused diag_bridge_close(int id) { } |
Jack Pham | f6ed558 | 2011-11-02 16:08:31 -0700 | [diff] [blame] | 51 | |
| 52 | #endif |
Jack Pham | e32cf32 | 2011-09-26 10:20:17 -0700 | [diff] [blame] | 53 | |
| 54 | #endif |