Skip to content

Commit bda1092

Browse files
committed
ipts: Clean up ipts.h to pass checkpatch
Signed-off-by: Dorian Stoll <dorian.stoll@tmsp.io>
1 parent a16bb16 commit bda1092

1 file changed

Lines changed: 81 additions & 89 deletions

File tree

drivers/misc/ipts/ipts.h

Lines changed: 81 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,85 @@
1+
/* SPDX-License-Identifier: GPL-2.0-or-later */
12
/*
23
*
3-
* Intel Management Engine Interface (Intel MEI) Client Driver for IPTS
4-
* Copyright (c) 2016, Intel Corporation.
5-
*
6-
* This program is free software; you can redistribute it and/or modify it
7-
* under the terms and conditions of the GNU General Public License,
8-
* version 2, as published by the Free Software Foundation.
9-
*
10-
* This program is distributed in the hope it will be useful, but WITHOUT
11-
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12-
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13-
* more details.
4+
* Intel Precise Touch & Stylus
5+
* Copyright (c) 2016 Intel Corporation
146
*
157
*/
168

179
#ifndef _IPTS_H_
1810
#define _IPTS_H_
1911

20-
#include <linux/types.h>
21-
#include <linux/mei_cl_bus.h>
2212
#include <linux/hid.h>
2313
#include <linux/ipts-binary.h>
2414
#include <linux/ipts-gfx.h>
15+
#include <linux/mei_cl_bus.h>
16+
#include <linux/types.h>
2517

2618
#include "ipts-mei-msgs.h"
2719
#include "ipts-state.h"
2820

29-
#define ENABLE_IPTS_DEBUG /* enable IPTS debug */
21+
// Enable IPTS debug
22+
#define ENABLE_IPTS_DEBUG
3023

3124
#ifdef ENABLE_IPTS_DEBUG
3225

33-
#define ipts_info(ipts, format, arg...) do {\
34-
dev_info(&ipts->cldev->dev, format, ##arg);\
35-
} while (0)
26+
#define ipts_info(ipts, format, arg...) \
27+
dev_info(&ipts->cldev->dev, format, ##arg)
3628

37-
#define ipts_dbg(ipts, format, arg...) do {\
38-
dev_info(&ipts->cldev->dev, format, ##arg);\
39-
} while (0)
29+
#define ipts_dbg(ipts, format, arg...) \
30+
dev_info(&ipts->cldev->dev, format, ##arg)
4031

41-
//#define RUN_DBG_THREAD
32+
// #define RUN_DBG_THREAD
4233

4334
#else
4435

45-
#define ipts_info(ipts, format, arg...) do {} while(0);
46-
#define ipts_dbg(ipts, format, arg...) do {} while(0);
36+
#define ipts_info(ipts, format, arg...) do {} while (0)
37+
#define ipts_dbg(ipts, format, arg...) do {} while (0)
4738

4839
#endif
4940

50-
#define ipts_err(ipts, format, arg...) do {\
51-
dev_err(&ipts->cldev->dev, format, ##arg);\
52-
} while (0)
41+
#define ipts_err(ipts, format, arg...) \
42+
dev_err(&ipts->cldev->dev, format, ##arg)
5343

54-
#define HID_PARALLEL_DATA_BUFFERS TOUCH_SENSOR_MAX_DATA_BUFFERS
44+
#define HID_PARALLEL_DATA_BUFFERS TOUCH_SENSOR_MAX_DATA_BUFFERS
5545

56-
#define IPTS_MAX_RETRY 3
46+
#define IPTS_MAX_RETRY 3
5747

58-
typedef struct ipts_buffer_info {
48+
struct ipts_buffer_info {
5949
char *addr;
6050
dma_addr_t dma_addr;
61-
} ipts_buffer_info_t;
62-
63-
typedef struct ipts_gfx_info {
64-
u64 gfx_handle;
65-
intel_ipts_ops_t ipts_ops;
66-
} ipts_gfx_info_t;
67-
68-
typedef struct ipts_resource {
69-
/* ME & Gfx resource */
70-
ipts_buffer_info_t touch_data_buffer_raw[HID_PARALLEL_DATA_BUFFERS];
71-
ipts_buffer_info_t touch_data_buffer_hid;
72-
73-
ipts_buffer_info_t feedback_buffer[HID_PARALLEL_DATA_BUFFERS];
74-
75-
ipts_buffer_info_t hid2me_buffer;
51+
};
52+
53+
struct ipts_gfx_info {
54+
u64 gfx_handle;
55+
struct ipts_ops ipts_ops;
56+
};
57+
58+
struct ipts_resource {
59+
// ME & GFX resource
60+
struct ipts_buffer_info touch_data_buffer_raw
61+
[HID_PARALLEL_DATA_BUFFERS];
62+
struct ipts_buffer_info touch_data_buffer_hid;
63+
struct ipts_buffer_info feedback_buffer[HID_PARALLEL_DATA_BUFFERS];
64+
struct ipts_buffer_info hid2me_buffer;
7665
u32 hid2me_buffer_size;
7766

7867
u8 wq_item_size;
79-
intel_ipts_wq_info_t wq_info;
68+
struct ipts_wq_info wq_info;
8069

81-
/* ME2HID buffer */
70+
// ME2HID buffer
8271
char *me2hid_buffer;
8372

84-
/* Gfx specific resource */
85-
ipts_buffer_info_t raw_data_mode_output_buffer
86-
[HID_PARALLEL_DATA_BUFFERS][MAX_NUM_OUTPUT_BUFFERS];
73+
// GFX specific resource
74+
struct ipts_buffer_info raw_data_mode_output_buffer
75+
[HID_PARALLEL_DATA_BUFFERS][MAX_NUM_OUTPUT_BUFFERS];
8776

8877
int num_of_outputs;
89-
9078
bool default_resource_ready;
9179
bool raw_data_resource_ready;
92-
} ipts_resource_t;
80+
};
9381

94-
typedef struct ipts_info {
82+
struct ipts_info {
9583
struct mei_cl_device *cldev;
9684
struct hid_device *hid;
9785

@@ -102,97 +90,101 @@ typedef struct ipts_info {
10290
struct task_struct *event_loop;
10391

10492
#if IS_ENABLED(CONFIG_DEBUG_FS)
105-
struct dentry *dbgfs_dir;
93+
struct dentry *dbgfs_dir;
10694
#endif
10795

108-
ipts_state_t state;
96+
enum ipts_state state;
10997

110-
touch_sensor_mode_t sensor_mode;
111-
touch_sensor_get_device_info_rsp_data_t device_info;
112-
ipts_resource_t resource;
113-
u8 hid_input_report[HID_MAX_BUFFER_SIZE];
114-
int num_of_parallel_data_buffers;
115-
bool hid_desc_ready;
98+
enum touch_sensor_mode sensor_mode;
99+
struct touch_sensor_get_device_info_rsp_data device_info;
100+
struct ipts_resource resource;
101+
u8 hid_input_report[HID_MAX_BUFFER_SIZE];
102+
int num_of_parallel_data_buffers;
103+
bool hid_desc_ready;
116104

117105
int current_buffer_index;
118106
int last_buffer_completed;
119107
int *last_submitted_id;
120108

121-
ipts_gfx_info_t gfx_info;
122-
u64 kernel_handle;
123-
int gfx_status;
124-
bool display_status;
109+
struct ipts_gfx_info gfx_info;
110+
u64 kernel_handle;
111+
int gfx_status;
112+
bool display_status;
125113

126-
bool switch_sensor_mode;
127-
touch_sensor_mode_t new_sensor_mode;
114+
bool switch_sensor_mode;
115+
enum touch_sensor_mode new_sensor_mode;
128116

129-
int retry;
130-
bool restart;
131-
} ipts_info_t;
117+
int retry;
118+
bool restart;
119+
};
132120

133121
#if IS_ENABLED(CONFIG_DEBUG_FS)
134-
int ipts_dbgfs_register(ipts_info_t *ipts, const char *name);
135-
void ipts_dbgfs_deregister(ipts_info_t *ipts);
122+
int ipts_dbgfs_register(struct ipts_info *ipts, const char *name);
123+
void ipts_dbgfs_deregister(struct ipts_info *ipts);
136124
#else
137-
static int ipts_dbgfs_register(ipts_info_t *ipts, const char *name);
138-
static void ipts_dbgfs_deregister(ipts_info_t *ipts);
139-
#endif /* CONFIG_DEBUG_FS */
125+
static int ipts_dbgfs_register(struct ipts_info *ipts, const char *name);
126+
static void ipts_dbgfs_deregister(struct ipts_info *ipts);
127+
#endif
140128

141-
/* inline functions */
142-
static inline void ipts_set_state(ipts_info_t *ipts, ipts_state_t state)
129+
/*
130+
* Inline functions
131+
*/
132+
static inline void ipts_set_state(struct ipts_info *ipts,
133+
enum ipts_state state)
143134
{
144135
ipts->state = state;
145136
}
146137

147-
static inline ipts_state_t ipts_get_state(const ipts_info_t *ipts)
138+
static inline enum ipts_state ipts_get_state(const struct ipts_info *ipts)
148139
{
149140
return ipts->state;
150141
}
151142

152-
static inline bool ipts_is_default_resource_ready(const ipts_info_t *ipts)
143+
static inline bool ipts_is_default_resource_ready(const struct ipts_info *ipts)
153144
{
154145
return ipts->resource.default_resource_ready;
155146
}
156147

157-
static inline bool ipts_is_raw_data_resource_ready(const ipts_info_t *ipts)
148+
static inline bool ipts_is_raw_data_resource_ready(const struct ipts_info *ipts)
158149
{
159150
return ipts->resource.raw_data_resource_ready;
160151
}
161152

162-
static inline ipts_buffer_info_t* ipts_get_feedback_buffer(ipts_info_t *ipts,
163-
int buffer_idx)
153+
static inline struct ipts_buffer_info *ipts_get_feedback_buffer(
154+
struct ipts_info *ipts, int buffer_idx)
164155
{
165156
return &ipts->resource.feedback_buffer[buffer_idx];
166157
}
167158

168-
static inline ipts_buffer_info_t* ipts_get_touch_data_buffer_hid(ipts_info_t *ipts)
159+
static inline struct ipts_buffer_info *ipts_get_touch_data_buffer_hid(
160+
struct ipts_info *ipts)
169161
{
170162
return &ipts->resource.touch_data_buffer_hid;
171163
}
172164

173-
static inline ipts_buffer_info_t* ipts_get_output_buffers_by_parallel_id(
174-
ipts_info_t *ipts,
175-
int parallel_idx)
165+
static inline struct ipts_buffer_info *ipts_get_output_buffers_by_parallel_id(
166+
struct ipts_info *ipts, int parallel_idx)
176167
{
177168
return &ipts->resource.raw_data_mode_output_buffer[parallel_idx][0];
178169
}
179170

180-
static inline ipts_buffer_info_t* ipts_get_hid2me_buffer(ipts_info_t *ipts)
171+
static inline struct ipts_buffer_info *ipts_get_hid2me_buffer(
172+
struct ipts_info *ipts)
181173
{
182174
return &ipts->resource.hid2me_buffer;
183175
}
184176

185-
static inline void ipts_set_wq_item_size(ipts_info_t *ipts, u8 size)
177+
static inline void ipts_set_wq_item_size(struct ipts_info *ipts, u8 size)
186178
{
187179
ipts->resource.wq_item_size = size;
188180
}
189181

190-
static inline u8 ipts_get_wq_item_size(const ipts_info_t *ipts)
182+
static inline u8 ipts_get_wq_item_size(const struct ipts_info *ipts)
191183
{
192184
return ipts->resource.wq_item_size;
193185
}
194186

195-
static inline int ipts_get_num_of_parallel_buffers(const ipts_info_t *ipts)
187+
static inline int ipts_get_num_of_parallel_buffers(const struct ipts_info *ipts)
196188
{
197189
return ipts->num_of_parallel_data_buffers;
198190
}

0 commit comments

Comments
 (0)