tree:
https://chromium.googlesource.com/chromiumos/third_party/kernel chromeos-4.4
head: d178215c9879389cd3e237ce1fefe53843e7bbff
commit: 508a1ea263fffcdc299e9c4bee34c5f91aacb6e1 [18/36] FROMLIST: usb: mausb_host: MA-USB
PAL events processing
config: arc-randconfig-m031-20200723 (attached as .config)
compiler: arc-elf-gcc (GCC) 7.5.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
git checkout 508a1ea263fffcdc299e9c4bee34c5f91aacb6e1
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-7.5.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from include/uapi/linux/stddef.h:1:0,
from include/linux/stddef.h:4,
from include/uapi/linux/posix_types.h:4,
from include/uapi/linux/types.h:13,
from include/linux/types.h:5,
from include/linux/list.h:4,
from include/linux/miscdevice.h:4,
from drivers/usb/host/mausb/hpal.h:8,
from drivers/usb/host/mausb/utils.h:8,
from drivers/usb/host/mausb/utils.c:5:
drivers/usb/host/mausb/utils.c: In function 'mausb_host_dev_read':
> drivers/usb/host/mausb/utils.c:92:7: error: implicit declaration
of function 'copy_to_user'; did you mean 'copy_to_iter'?
[-Werror=implicit-function-declaration]
if (copy_to_user(user_buffer,
&fail_ret_val,
^
include/linux/compiler.h:163:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
drivers/usb/host/mausb/utils.c:92:3: note: in expansion of macro 'if'
if (copy_to_user(user_buffer, &fail_ret_val,
^~
drivers/usb/host/mausb/utils.c: In function 'mausb_host_dev_write':
> drivers/usb/host/mausb/utils.c:186:6: error: implicit declaration
of function 'copy_from_user'; did you mean 'copy_from_iter'?
[-Werror=implicit-function-declaration]
if (copy_from_user(¬ification,
buffer, size))
^
include/linux/compiler.h:163:30: note: in definition of macro '__trace_if'
if (__builtin_constant_p(!!(cond)) ? !!(cond) : \
^~~~
drivers/usb/host/mausb/utils.c:186:2: note: in expansion of macro 'if'
if (copy_from_user(¬ification, buffer, size))
^~
cc1: some warnings being treated as errors
vim +92 drivers/usb/host/mausb/utils.c
67
68 static ssize_t mausb_host_dev_read(struct file *filp, char __user *user_buffer,
69 size_t size, loff_t *offset)
70 {
71 ssize_t num_of_bytes_to_read = MAUSB_MAX_NUM_OF_MA_DEVS *
72 sizeof(struct mausb_events_notification);
73 unsigned long num_of_bytes_not_copied;
74 int completed_events;
75 int ring_events;
76 struct mausb_ring_buffer *ring_buffer;
77 struct mausb_device *dev;
78 struct completion *ring_has_events;
79 u8 current_device = 0;
80 s8 fail_ret_val;
81 unsigned long flags;
82 unsigned long timeout;
83 long status;
84
85 /* Reset heartbeat timer events */
86 mausb_reset_heartbeat_cnt();
87
88 if ((ssize_t)size != num_of_bytes_to_read) {
89 dev_alert(mausb_host_dev.this_device, "The actual size differs from the
expected number of bytes");
90
91 fail_ret_val = MAUSB_DRIVER_BAD_READ_BUFFER_SIZE;
92 if (copy_to_user(user_buffer, &fail_ret_val,
93 sizeof(fail_ret_val)) != 0) {
94 dev_warn(mausb_host_dev.this_device, "Failed to set error code.");
95 }
96 return MAUSB_DRIVER_READ_ERROR;
97 }
98
99 /* If suspend/hibernate happened delete all devices */
100 if (atomic_xchg(&mss.num_of_transitions_to_sleep, 0)) {
101 dev_alert(mausb_host_dev.this_device, "Suspend system event
detected");
102 fail_ret_val = MAUSB_DRIVER_SYSTEM_SUSPENDED;
103 if (copy_to_user(user_buffer, &fail_ret_val,
104 sizeof(fail_ret_val)) != 0) {
105 dev_warn(mausb_host_dev.this_device, "Failed to set error code.");
106 }
107 return MAUSB_DRIVER_READ_ERROR;
108 }
109
110 ring_has_events = &mss.rings_events.mausb_ring_has_events;
111 timeout = msecs_to_jiffies(MAUSB_READ_DEVICE_TIMEOUT_MS);
112 status = wait_for_completion_interruptible_timeout(ring_has_events,
113 timeout);
114 reinit_completion(ring_has_events);
115
116 if (atomic_read(&mss.rings_events.mausb_stop_reading_ring_events)) {
117 dev_alert(mausb_host_dev.this_device, "Ring events stopped");
118 fail_ret_val = MAUSB_DRIVER_RING_EVENTS_STOPPED;
119 if (copy_to_user(user_buffer, &fail_ret_val,
120 sizeof(fail_ret_val)) != 0) {
121 dev_warn(mausb_host_dev.this_device, "Failed to set error code.");
122 }
123 return MAUSB_DRIVER_READ_ERROR;
124 }
125
126 /* There are no new events - waiting for events hit timeout */
127 if (status == 0)
128 return MAUSB_DRIVER_READ_TIMEOUT;
129
130 spin_lock_irqsave(&mss.lock, flags);
131
132 list_for_each_entry(dev, &mss.madev_list, list_entry) {
133 mss.events[current_device].madev_addr = dev->madev_addr;
134 ring_buffer = dev->ring_buffer;
135 ring_events = atomic_xchg(&ring_buffer->mausb_ring_events, 0);
136 completed_events =
137 atomic_xchg(&ring_buffer->mausb_completed_user_events,
138 0);
139 mss.events[current_device].num_of_events = (u16)ring_events;
140 mss.events[current_device].num_of_completed_events =
141 (u16)completed_events;
142 if (++current_device == MAUSB_MAX_NUM_OF_MA_DEVS)
143 break;
144 }
145
146 spin_unlock_irqrestore(&mss.lock, flags);
147
148 num_of_bytes_to_read =
149 (ssize_t)(current_device *
150 sizeof(struct mausb_events_notification));
151 num_of_bytes_not_copied =
152 copy_to_user(user_buffer, &mss.events,
153 (unsigned long)num_of_bytes_to_read);
154
155 dev_vdbg(mausb_host_dev.this_device, "num_of_bytes_not_copied %lu,
num_of_bytes_to_read %zd",
156 num_of_bytes_not_copied, num_of_bytes_to_read);
157
158 if (num_of_bytes_not_copied) {
159 fail_ret_val = MAUSB_DRIVER_COPY_TO_BUFFER_FAILED;
160 if (copy_to_user(user_buffer, &fail_ret_val,
161 sizeof(fail_ret_val)) != 0) {
162 dev_warn(mausb_host_dev.this_device, "Failed to set error code.");
163 }
164 return MAUSB_DRIVER_READ_ERROR;
165 }
166
167 return num_of_bytes_to_read;
168 }
169
170 static ssize_t mausb_host_dev_write(struct file *filp,
171 const char __user *buffer, size_t size,
172 loff_t *offset)
173 {
174 ssize_t num_of_bytes_to_write =
175 sizeof(struct mausb_events_notification);
176 struct mausb_events_notification notification;
177 unsigned long flags;
178 struct mausb_device *dev;
179
180 if (size != (size_t)num_of_bytes_to_write) {
181 dev_alert(mausb_host_dev.this_device, "The actual size differs from the
expected number of bytes");
182
183 return MAUSB_DRIVER_WRITE_ERROR;
184 }
185
186 if (copy_from_user(¬ification, buffer, size))
187 return MAUSB_DRIVER_WRITE_ERROR;
188
189 spin_lock_irqsave(&mss.lock, flags);
190 dev = mausb_get_dev_from_addr_unsafe(notification.madev_addr);
191
192 if (!dev) {
193 spin_unlock_irqrestore(&mss.lock, flags);
194 return 0;
195 }
196
197 spin_lock(&dev->num_of_user_events_lock);
198 dev->num_of_user_events += notification.num_of_events;
199 dev->num_of_completed_events += notification.num_of_completed_events;
200 spin_unlock(&dev->num_of_user_events_lock);
201
202 queue_work(dev->workq, &dev->work);
203 spin_unlock_irqrestore(&mss.lock, flags);
204
205 return num_of_bytes_to_write;
206 }
207
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org