Commit 7e485ee7 authored by matt mooney's avatar matt mooney Committed by Greg Kroah-Hartman

staging: usbip: userspace: change struct class_device to usbip_class_device

Rename class_device struct to avoid confusion and change member names.
Signed-off-by: default avatarmatt mooney <mfm@muteddisk.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5a285cf5
...@@ -20,10 +20,12 @@ static struct usbip_imported_device *imported_device_init(struct usbip_imported_ ...@@ -20,10 +20,12 @@ static struct usbip_imported_device *imported_device_init(struct usbip_imported_
sysfs_close_device(sudev); sysfs_close_device(sudev);
/* add class devices of this imported device */ /* add class devices of this imported device */
struct class_device *cdev; struct usbip_class_device *cdev;
dlist_for_each_data(vhci_driver->cdev_list, cdev, struct class_device) { dlist_for_each_data(vhci_driver->cdev_list, cdev,
if (!strncmp(cdev->devpath, idev->udev.path, strlen(idev->udev.path))) { struct usbip_class_device) {
struct class_device *new_cdev; if (!strncmp(cdev->dev_path, idev->udev.path,
strlen(idev->udev.path))) {
struct usbip_class_device *new_cdev;
/* alloc and copy because dlist is linked from only one list */ /* alloc and copy because dlist is linked from only one list */
new_cdev = calloc(1, sizeof(*new_cdev)); new_cdev = calloc(1, sizeof(*new_cdev));
...@@ -87,7 +89,7 @@ static int parse_status(char *value) ...@@ -87,7 +89,7 @@ static int parse_status(char *value)
idev->busnum = (devid >> 16); idev->busnum = (devid >> 16);
idev->devnum = (devid & 0x0000ffff); idev->devnum = (devid & 0x0000ffff);
idev->cdev_list = dlist_new(sizeof(struct class_device)); idev->cdev_list = dlist_new(sizeof(struct usbip_class_device));
if (!idev->cdev_list) { if (!idev->cdev_list) {
err("init new device"); err("init new device");
return -1; return -1;
...@@ -115,29 +117,29 @@ static int parse_status(char *value) ...@@ -115,29 +117,29 @@ static int parse_status(char *value)
static int check_usbip_device(struct sysfs_class_device *cdev) static int check_usbip_device(struct sysfs_class_device *cdev)
{ {
char clspath[SYSFS_PATH_MAX]; /* /sys/class/video4linux/video0/device */ char class_path[SYSFS_PATH_MAX]; /* /sys/class/video4linux/video0/device */
char devpath[SYSFS_PATH_MAX]; /* /sys/devices/platform/vhci_hcd/usb6/6-1:1.1 */ char dev_path[SYSFS_PATH_MAX]; /* /sys/devices/platform/vhci_hcd/usb6/6-1:1.1 */
int ret; int ret;
struct usbip_class_device *usbip_cdev;
snprintf(clspath, sizeof(clspath), "%s/device", cdev->path); snprintf(class_path, sizeof(class_path), "%s/device", cdev->path);
ret = sysfs_get_link(clspath, devpath, SYSFS_PATH_MAX); ret = sysfs_get_link(class_path, dev_path, sizeof(dev_path));
if (!ret) { if (ret == 0) {
if (!strncmp(devpath, vhci_driver->hc_device->path, if (!strncmp(dev_path, vhci_driver->hc_device->path,
strlen(vhci_driver->hc_device->path))) { strlen(vhci_driver->hc_device->path))) {
/* found usbip device */ /* found usbip device */
struct class_device *cdev; usbip_cdev = calloc(1, sizeof(*usbip_cdev));
cdev = calloc(1, sizeof(*cdev));
if (!cdev) { if (!cdev) {
err("calloc cdev"); err("calloc usbip_cdev");
return -1; return -1;
} }
dlist_unshift(vhci_driver->cdev_list, (void*) cdev); dlist_unshift(vhci_driver->cdev_list, usbip_cdev);
strncpy(cdev->clspath, clspath, sizeof(cdev->clspath)); strncpy(usbip_cdev->class_path, class_path,
strncpy(cdev->devpath, devpath, sizeof(cdev->clspath)); sizeof(usbip_cdev->class_path));
dbg(" found %s %s", clspath, devpath); strncpy(usbip_cdev->dev_path, dev_path,
sizeof(usbip_cdev->dev_path));
dbg(" found %s %s", class_path, dev_path);
} }
} }
...@@ -341,7 +343,7 @@ int usbip_vhci_driver_open(void) ...@@ -341,7 +343,7 @@ int usbip_vhci_driver_open(void)
info("%d ports available\n", vhci_driver->nports); info("%d ports available\n", vhci_driver->nports);
vhci_driver->cdev_list = dlist_new(sizeof(struct class_device)); vhci_driver->cdev_list = dlist_new(sizeof(struct usbip_class_device));
if (!vhci_driver->cdev_list) if (!vhci_driver->cdev_list)
goto err; goto err;
...@@ -400,7 +402,7 @@ int usbip_vhci_refresh_device_list(void) ...@@ -400,7 +402,7 @@ int usbip_vhci_refresh_device_list(void)
dlist_destroy(vhci_driver->idev[i].cdev_list); dlist_destroy(vhci_driver->idev[i].cdev_list);
} }
vhci_driver->cdev_list = dlist_new(sizeof(struct class_device)); vhci_driver->cdev_list = dlist_new(sizeof(struct usbip_class_device));
if (!vhci_driver->cdev_list) if (!vhci_driver->cdev_list)
goto err; goto err;
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#define MAXNPORT 128 #define MAXNPORT 128
struct class_device { struct usbip_class_device {
char clspath[SYSFS_PATH_MAX]; char class_path[SYSFS_PATH_MAX];
char devpath[SYSFS_PATH_MAX]; char dev_path[SYSFS_PATH_MAX];
}; };
struct usbip_imported_device { struct usbip_imported_device {
...@@ -25,16 +25,19 @@ struct usbip_imported_device { ...@@ -25,16 +25,19 @@ struct usbip_imported_device {
uint8_t busnum; uint8_t busnum;
uint8_t devnum; uint8_t devnum;
/* usbip_class_device list */
struct dlist *cdev_list; /* list of class device */ struct dlist *cdev_list;
struct usb_device udev; struct usb_device udev;
}; };
struct usbip_vhci_driver { struct usbip_vhci_driver {
char sysfs_mntpath[SYSFS_PATH_MAX]; char sysfs_mntpath[SYSFS_PATH_MAX];
struct sysfs_device *hc_device; /* /sys/devices/platform/vhci_hcd */
struct dlist *cdev_list; /* list of class device */ /* /sys/devices/platform/vhci_hcd */
struct sysfs_device *hc_device;
/* usbip_class_device list */
struct dlist *cdev_list;
int nports; int nports;
struct usbip_imported_device idev[MAXNPORT]; struct usbip_imported_device idev[MAXNPORT];
......
...@@ -174,12 +174,13 @@ int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev) ...@@ -174,12 +174,13 @@ int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev)
sysfs_close_device(suinf); sysfs_close_device(suinf);
/* show class device information */ /* show class device information */
struct class_device *cdev; struct usbip_class_device *cdev;
dlist_for_each_data(idev->cdev_list, cdev, struct class_device) { dlist_for_each_data(idev->cdev_list, cdev,
int ifnum = get_interface_number(cdev->devpath); struct usbip_class_device) {
int ifnum = get_interface_number(cdev->dev_path);
if (ifnum == i) { if (ifnum == i) {
info(" %s", cdev->clspath); info(" %s", cdev->class_path);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment