.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * (c) 2017 Stefano Stabellini <stefano@aporeto.com> |
---|
3 | | - * |
---|
4 | | - * This program is free software; you can redistribute it and/or modify |
---|
5 | | - * it under the terms of the GNU General Public License as published by |
---|
6 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
7 | | - * (at your option) any later version. |
---|
8 | | - * |
---|
9 | | - * This program is distributed in the hope that it will be useful, |
---|
10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | | - * GNU General Public License for more details. |
---|
13 | 4 | */ |
---|
14 | 5 | |
---|
15 | 6 | #include <linux/module.h> |
---|
.. | .. |
---|
346 | 337 | if (!map->active.ring) |
---|
347 | 338 | return; |
---|
348 | 339 | |
---|
349 | | - free_pages((unsigned long)map->active.data.in, |
---|
350 | | - map->active.ring->ring_order); |
---|
| 340 | + free_pages_exact(map->active.data.in, |
---|
| 341 | + PAGE_SIZE << map->active.ring->ring_order); |
---|
351 | 342 | free_page((unsigned long)map->active.ring); |
---|
352 | 343 | } |
---|
353 | 344 | |
---|
.. | .. |
---|
361 | 352 | goto out; |
---|
362 | 353 | |
---|
363 | 354 | map->active.ring->ring_order = PVCALLS_RING_ORDER; |
---|
364 | | - bytes = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, |
---|
365 | | - PVCALLS_RING_ORDER); |
---|
| 355 | + bytes = alloc_pages_exact(PAGE_SIZE << PVCALLS_RING_ORDER, |
---|
| 356 | + GFP_KERNEL | __GFP_ZERO); |
---|
366 | 357 | if (!bytes) |
---|
367 | 358 | goto out; |
---|
368 | 359 | |
---|
.. | .. |
---|
377 | 368 | return -ENOMEM; |
---|
378 | 369 | } |
---|
379 | 370 | |
---|
380 | | -static int create_active(struct sock_mapping *map, int *evtchn) |
---|
| 371 | +static int create_active(struct sock_mapping *map, evtchn_port_t *evtchn) |
---|
381 | 372 | { |
---|
382 | 373 | void *bytes; |
---|
383 | | - int ret = -ENOMEM, irq = -1, i; |
---|
| 374 | + int ret, irq = -1, i; |
---|
384 | 375 | |
---|
385 | | - *evtchn = -1; |
---|
| 376 | + *evtchn = 0; |
---|
386 | 377 | init_waitqueue_head(&map->active.inflight_conn_req); |
---|
387 | 378 | |
---|
388 | 379 | bytes = map->active.data.in; |
---|
.. | .. |
---|
413 | 404 | return 0; |
---|
414 | 405 | |
---|
415 | 406 | out_error: |
---|
416 | | - if (*evtchn >= 0) |
---|
| 407 | + if (*evtchn > 0) |
---|
417 | 408 | xenbus_free_evtchn(pvcalls_front_dev, *evtchn); |
---|
418 | 409 | return ret; |
---|
419 | 410 | } |
---|
.. | .. |
---|
424 | 415 | struct pvcalls_bedata *bedata; |
---|
425 | 416 | struct sock_mapping *map = NULL; |
---|
426 | 417 | struct xen_pvcalls_request *req; |
---|
427 | | - int notify, req_id, ret, evtchn; |
---|
| 418 | + int notify, req_id, ret; |
---|
| 419 | + evtchn_port_t evtchn; |
---|
428 | 420 | |
---|
429 | 421 | if (addr->sa_family != AF_INET || sock->type != SOCK_STREAM) |
---|
430 | 422 | return -EOPNOTSUPP; |
---|
.. | .. |
---|
774 | 766 | struct sock_mapping *map; |
---|
775 | 767 | struct sock_mapping *map2 = NULL; |
---|
776 | 768 | struct xen_pvcalls_request *req; |
---|
777 | | - int notify, req_id, ret, evtchn, nonblock; |
---|
| 769 | + int notify, req_id, ret, nonblock; |
---|
| 770 | + evtchn_port_t evtchn; |
---|
778 | 771 | |
---|
779 | 772 | map = pvcalls_enter_sock(sock); |
---|
780 | 773 | if (IS_ERR(map)) |
---|
.. | .. |
---|
1134 | 1127 | static int pvcalls_front_probe(struct xenbus_device *dev, |
---|
1135 | 1128 | const struct xenbus_device_id *id) |
---|
1136 | 1129 | { |
---|
1137 | | - int ret = -ENOMEM, evtchn, i; |
---|
| 1130 | + int ret = -ENOMEM, i; |
---|
| 1131 | + evtchn_port_t evtchn; |
---|
1138 | 1132 | unsigned int max_page_order, function_calls, len; |
---|
1139 | 1133 | char *versions; |
---|
1140 | 1134 | grant_ref_t gref_head = 0; |
---|
.. | .. |
---|
1269 | 1263 | if (dev->state == XenbusStateClosed) |
---|
1270 | 1264 | break; |
---|
1271 | 1265 | /* Missed the backend's CLOSING state */ |
---|
1272 | | - /* fall through */ |
---|
| 1266 | + fallthrough; |
---|
1273 | 1267 | case XenbusStateClosing: |
---|
1274 | 1268 | xenbus_frontend_closed(dev); |
---|
1275 | 1269 | break; |
---|