vxlan: check return value of gro_cells_init()
[linux/fpc-iii.git] / tools / usb / usbip / libsrc / usbip_host_driver.c
blob4de6edc54d35d6147d6d907e712855021274e63c
1 /*
2 * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
3 * 2005-2007 Takahiro Hirofuchi
4 * Copyright (C) 2015-2016 Samsung Electronics
5 * Igor Kotrasinski <i.kotrasinsk@samsung.com>
6 * Krzysztof Opasiak <k.opasiak@samsung.com>
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include <unistd.h>
23 #include <libudev.h>
25 #include "usbip_host_common.h"
26 #include "usbip_host_driver.h"
28 #undef PROGNAME
29 #define PROGNAME "libusbip"
31 static int is_my_device(struct udev_device *dev)
33 const char *driver;
35 driver = udev_device_get_driver(dev);
36 return driver != NULL && !strcmp(driver, USBIP_HOST_DRV_NAME);
39 static int usbip_host_driver_open(struct usbip_host_driver *hdriver)
41 int ret;
43 hdriver->ndevs = 0;
44 INIT_LIST_HEAD(&hdriver->edev_list);
46 ret = usbip_generic_driver_open(hdriver);
47 if (ret)
48 err("please load " USBIP_CORE_MOD_NAME ".ko and "
49 USBIP_HOST_DRV_NAME ".ko!");
50 return ret;
53 struct usbip_host_driver host_driver = {
54 .edev_list = LIST_HEAD_INIT(host_driver.edev_list),
55 .udev_subsystem = "usb",
56 .ops = {
57 .open = usbip_host_driver_open,
58 .close = usbip_generic_driver_close,
59 .refresh_device_list = usbip_generic_refresh_device_list,
60 .get_device = usbip_generic_get_device,
61 .read_device = read_usb_device,
62 .read_interface = read_usb_interface,
63 .is_my_device = is_my_device,