Avoid beyond bounds copy while caching ACL
[zen-stable.git] / drivers / staging / android / switch / switch.h
blob4fcb3109875af65f71beebdbce3d424caf2f691c
1 /*
2 * Switch class driver
4 * Copyright (C) 2008 Google, Inc.
5 * Author: Mike Lockwood <lockwood@android.com>
7 * This software is licensed under the terms of the GNU General Public
8 * License version 2, as published by the Free Software Foundation, and
9 * may be copied, distributed, and modified under those terms.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
18 #ifndef __LINUX_SWITCH_H__
19 #define __LINUX_SWITCH_H__
21 struct switch_dev {
22 const char *name;
23 struct device *dev;
24 int index;
25 int state;
27 ssize_t (*print_name)(struct switch_dev *sdev, char *buf);
28 ssize_t (*print_state)(struct switch_dev *sdev, char *buf);
31 struct gpio_switch_platform_data {
32 const char *name;
33 unsigned gpio;
35 /* if NULL, switch_dev.name will be printed */
36 const char *name_on;
37 const char *name_off;
38 /* if NULL, "0" or "1" will be printed */
39 const char *state_on;
40 const char *state_off;
43 extern int switch_dev_register(struct switch_dev *sdev);
44 extern void switch_dev_unregister(struct switch_dev *sdev);
46 static inline int switch_get_state(struct switch_dev *sdev)
48 return sdev->state;
51 extern void switch_set_state(struct switch_dev *sdev, int state);
53 #endif /* __LINUX_SWITCH_H__ */