Re: [PATCH] staging: gdm724x: gdm_tty: replaced macro with an inline function

From: kernel test robot
Date: Tue Sep 01 2020 - 15:23:34 EST


Hi Antoni,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on staging/staging-testing]

url: https://github.com/0day-ci/linux/commits/Antoni-Przybylik/staging-gdm724x-gdm_tty-replaced-macro-with-an-inline-function/20200901-234632
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git cc34073c6248e9cec801bf690d1455f264d12357
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/staging/gdm724x/gdm_tty.c:37:26: error: unknown type name 'gdm'
37 | inline int gdm_tty_ready(gdm *gdm)
| ^~~
drivers/staging/gdm724x/gdm_tty.c: In function 'gdm_tty_recv_complete':
>> drivers/staging/gdm724x/gdm_tty.c:125:7: error: implicit declaration of function 'gdm_tty_ready' [-Werror=implicit-function-declaration]
125 | if (!gdm_tty_ready(gdm)) {
| ^~~~~~~~~~~~~
cc1: some warnings being treated as errors

# https://github.com/0day-ci/linux/commit/b5088fce047a55ac2021d1b82d39a39d2a5dbf4d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Antoni-Przybylik/staging-gdm724x-gdm_tty-replaced-macro-with-an-inline-function/20200901-234632
git checkout b5088fce047a55ac2021d1b82d39a39d2a5dbf4d
vim +/gdm +37 drivers/staging/gdm724x/gdm_tty.c

36
> 37 inline int gdm_tty_ready(gdm *gdm)
38 {
39 return (gdm && gdm->tty_dev && gdm->port.count);
40 }
41
42 static void gdm_port_destruct(struct tty_port *port)
43 {
44 struct gdm *gdm = container_of(port, struct gdm, port);
45
46 mutex_lock(&gdm_table_lock);
47 gdm_table[gdm->index][gdm->minor] = NULL;
48 mutex_unlock(&gdm_table_lock);
49
50 kfree(gdm);
51 }
52
53 static const struct tty_port_operations gdm_port_ops = {
54 .destruct = gdm_port_destruct,
55 };
56
57 static int gdm_tty_install(struct tty_driver *driver, struct tty_struct *tty)
58 {
59 struct gdm *gdm = NULL;
60 int ret;
61
62 ret = match_string(DRIVER_STRING, TTY_MAX_COUNT,
63 tty->driver->driver_name);
64 if (ret < 0)
65 return -ENODEV;
66
67 mutex_lock(&gdm_table_lock);
68 gdm = gdm_table[ret][tty->index];
69 if (!gdm) {
70 mutex_unlock(&gdm_table_lock);
71 return -ENODEV;
72 }
73
74 tty_port_get(&gdm->port);
75
76 ret = tty_standard_install(driver, tty);
77 if (ret) {
78 tty_port_put(&gdm->port);
79 mutex_unlock(&gdm_table_lock);
80 return ret;
81 }
82
83 tty->driver_data = gdm;
84 mutex_unlock(&gdm_table_lock);
85
86 return 0;
87 }
88
89 static int gdm_tty_open(struct tty_struct *tty, struct file *filp)
90 {
91 struct gdm *gdm = tty->driver_data;
92
93 return tty_port_open(&gdm->port, tty, filp);
94 }
95
96 static void gdm_tty_cleanup(struct tty_struct *tty)
97 {
98 struct gdm *gdm = tty->driver_data;
99
100 tty_port_put(&gdm->port);
101 }
102
103 static void gdm_tty_hangup(struct tty_struct *tty)
104 {
105 struct gdm *gdm = tty->driver_data;
106
107 tty_port_hangup(&gdm->port);
108 }
109
110 static void gdm_tty_close(struct tty_struct *tty, struct file *filp)
111 {
112 struct gdm *gdm = tty->driver_data;
113
114 tty_port_close(&gdm->port, tty, filp);
115 }
116
117 static int gdm_tty_recv_complete(void *data,
118 int len,
119 int index,
120 struct tty_dev *tty_dev,
121 int complete)
122 {
123 struct gdm *gdm = tty_dev->gdm[index];
124
> 125 if (!gdm_tty_ready(gdm)) {
126 if (complete == RECV_PACKET_PROCESS_COMPLETE)
127 gdm->tty_dev->recv_func(gdm->tty_dev->priv_dev,
128 gdm_tty_recv_complete);
129 return TO_HOST_PORT_CLOSE;
130 }
131
132 if (data && len) {
133 if (tty_buffer_request_room(&gdm->port, len) == len) {
134 tty_insert_flip_string(&gdm->port, data, len);
135 tty_flip_buffer_push(&gdm->port);
136 } else {
137 return TO_HOST_BUFFER_REQUEST_FAIL;
138 }
139 }
140
141 if (complete == RECV_PACKET_PROCESS_COMPLETE)
142 gdm->tty_dev->recv_func(gdm->tty_dev->priv_dev,
143 gdm_tty_recv_complete);
144
145 return 0;
146 }
147

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip