Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usbcore: rename struct dev_state to struct usb_dev_state

Since it is needed outside usbcore and exposed in include/linux/usb.h,
it conflicts with enum dev_state in rt2x00 wireless driver.

Mark it as usb specific to avoid conflicts in the future.

Signed-off-by: Valentina Manea <valentina.manea.m@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Valentina Manea and committed by
Greg Kroah-Hartman
9b6f0c4b 04f7bb9d

+70 -70
+2 -2
drivers/staging/usbip/stub_dev.c
··· 395 395 * (struct dev_state) as long as it is unique. 396 396 */ 397 397 rc = usb_hub_claim_port(udev->parent, udev->portnum, 398 - (struct dev_state *) udev); 398 + (struct usb_dev_state *) udev); 399 399 if (rc) { 400 400 dev_dbg(&udev->dev, "unable to claim port\n"); 401 401 return rc; ··· 464 464 465 465 /* release port */ 466 466 rc = usb_hub_release_port(udev->parent, udev->portnum, 467 - (struct dev_state *) udev); 467 + (struct usb_dev_state *) udev); 468 468 if (rc) { 469 469 dev_dbg(&udev->dev, "unable to release port\n"); 470 470 return;
+56 -56
drivers/usb/core/devio.c
··· 62 62 /* Mutual exclusion for removal, open, and release */ 63 63 DEFINE_MUTEX(usbfs_mutex); 64 64 65 - struct dev_state { 65 + struct usb_dev_state { 66 66 struct list_head list; /* state list */ 67 67 struct usb_device *dev; 68 68 struct file *file; ··· 81 81 82 82 struct async { 83 83 struct list_head asynclist; 84 - struct dev_state *ps; 84 + struct usb_dev_state *ps; 85 85 struct pid *pid; 86 86 const struct cred *cred; 87 87 unsigned int signr; ··· 151 151 atomic_sub(amount, &usbfs_memory_usage); 152 152 } 153 153 154 - static int connected(struct dev_state *ps) 154 + static int connected(struct usb_dev_state *ps) 155 155 { 156 156 return (!list_empty(&ps->list) && 157 157 ps->dev->state != USB_STATE_NOTATTACHED); ··· 184 184 static ssize_t usbdev_read(struct file *file, char __user *buf, size_t nbytes, 185 185 loff_t *ppos) 186 186 { 187 - struct dev_state *ps = file->private_data; 187 + struct usb_dev_state *ps = file->private_data; 188 188 struct usb_device *dev = ps->dev; 189 189 ssize_t ret = 0; 190 190 unsigned len; ··· 307 307 308 308 static void async_newpending(struct async *as) 309 309 { 310 - struct dev_state *ps = as->ps; 310 + struct usb_dev_state *ps = as->ps; 311 311 unsigned long flags; 312 312 313 313 spin_lock_irqsave(&ps->lock, flags); ··· 317 317 318 318 static void async_removepending(struct async *as) 319 319 { 320 - struct dev_state *ps = as->ps; 320 + struct usb_dev_state *ps = as->ps; 321 321 unsigned long flags; 322 322 323 323 spin_lock_irqsave(&ps->lock, flags); ··· 325 325 spin_unlock_irqrestore(&ps->lock, flags); 326 326 } 327 327 328 - static struct async *async_getcompleted(struct dev_state *ps) 328 + static struct async *async_getcompleted(struct usb_dev_state *ps) 329 329 { 330 330 unsigned long flags; 331 331 struct async *as = NULL; ··· 340 340 return as; 341 341 } 342 342 343 - static struct async *async_getpending(struct dev_state *ps, 343 + static struct async *async_getpending(struct usb_dev_state *ps, 344 344 void __user *userurb) 345 345 { 346 346 struct async *as; ··· 448 448 #define AS_CONTINUATION 1 449 449 #define AS_UNLINK 2 450 450 451 - static void cancel_bulk_urbs(struct dev_state *ps, unsigned bulk_addr) 451 + static void cancel_bulk_urbs(struct usb_dev_state *ps, unsigned bulk_addr) 452 452 __releases(ps->lock) 453 453 __acquires(ps->lock) 454 454 { ··· 489 489 static void async_completed(struct urb *urb) 490 490 { 491 491 struct async *as = urb->context; 492 - struct dev_state *ps = as->ps; 492 + struct usb_dev_state *ps = as->ps; 493 493 struct siginfo sinfo; 494 494 struct pid *pid = NULL; 495 495 u32 secid = 0; ··· 529 529 wake_up(&ps->wait); 530 530 } 531 531 532 - static void destroy_async(struct dev_state *ps, struct list_head *list) 532 + static void destroy_async(struct usb_dev_state *ps, struct list_head *list) 533 533 { 534 534 struct urb *urb; 535 535 struct async *as; ··· 551 551 spin_unlock_irqrestore(&ps->lock, flags); 552 552 } 553 553 554 - static void destroy_async_on_interface(struct dev_state *ps, 554 + static void destroy_async_on_interface(struct usb_dev_state *ps, 555 555 unsigned int ifnum) 556 556 { 557 557 struct list_head *p, *q, hitlist; ··· 566 566 destroy_async(ps, &hitlist); 567 567 } 568 568 569 - static void destroy_all_async(struct dev_state *ps) 569 + static void destroy_all_async(struct usb_dev_state *ps) 570 570 { 571 571 destroy_async(ps, &ps->async_pending); 572 572 } ··· 585 585 586 586 static void driver_disconnect(struct usb_interface *intf) 587 587 { 588 - struct dev_state *ps = usb_get_intfdata(intf); 588 + struct usb_dev_state *ps = usb_get_intfdata(intf); 589 589 unsigned int ifnum = intf->altsetting->desc.bInterfaceNumber; 590 590 591 591 if (!ps) ··· 628 628 .resume = driver_resume, 629 629 }; 630 630 631 - static int claimintf(struct dev_state *ps, unsigned int ifnum) 631 + static int claimintf(struct usb_dev_state *ps, unsigned int ifnum) 632 632 { 633 633 struct usb_device *dev = ps->dev; 634 634 struct usb_interface *intf; ··· 650 650 return err; 651 651 } 652 652 653 - static int releaseintf(struct dev_state *ps, unsigned int ifnum) 653 + static int releaseintf(struct usb_dev_state *ps, unsigned int ifnum) 654 654 { 655 655 struct usb_device *dev; 656 656 struct usb_interface *intf; ··· 670 670 return err; 671 671 } 672 672 673 - static int checkintf(struct dev_state *ps, unsigned int ifnum) 673 + static int checkintf(struct usb_dev_state *ps, unsigned int ifnum) 674 674 { 675 675 if (ps->dev->state != USB_STATE_CONFIGURED) 676 676 return -EHOSTUNREACH; ··· 710 710 return -ENOENT; 711 711 } 712 712 713 - static int check_ctrlrecip(struct dev_state *ps, unsigned int requesttype, 713 + static int check_ctrlrecip(struct usb_dev_state *ps, unsigned int requesttype, 714 714 unsigned int request, unsigned int index) 715 715 { 716 716 int ret = 0; ··· 791 791 static int usbdev_open(struct inode *inode, struct file *file) 792 792 { 793 793 struct usb_device *dev = NULL; 794 - struct dev_state *ps; 794 + struct usb_dev_state *ps; 795 795 int ret; 796 796 797 797 ret = -ENOMEM; 798 - ps = kmalloc(sizeof(struct dev_state), GFP_KERNEL); 798 + ps = kmalloc(sizeof(struct usb_dev_state), GFP_KERNEL); 799 799 if (!ps) 800 800 goto out_free_ps; 801 801 ··· 852 852 853 853 static int usbdev_release(struct inode *inode, struct file *file) 854 854 { 855 - struct dev_state *ps = file->private_data; 855 + struct usb_dev_state *ps = file->private_data; 856 856 struct usb_device *dev = ps->dev; 857 857 unsigned int ifnum; 858 858 struct async *as; ··· 883 883 return 0; 884 884 } 885 885 886 - static int proc_control(struct dev_state *ps, void __user *arg) 886 + static int proc_control(struct usb_dev_state *ps, void __user *arg) 887 887 { 888 888 struct usb_device *dev = ps->dev; 889 889 struct usbdevfs_ctrltransfer ctrl; ··· 970 970 return ret; 971 971 } 972 972 973 - static int proc_bulk(struct dev_state *ps, void __user *arg) 973 + static int proc_bulk(struct usb_dev_state *ps, void __user *arg) 974 974 { 975 975 struct usb_device *dev = ps->dev; 976 976 struct usbdevfs_bulktransfer bulk; ··· 1043 1043 return ret; 1044 1044 } 1045 1045 1046 - static int proc_resetep(struct dev_state *ps, void __user *arg) 1046 + static int proc_resetep(struct usb_dev_state *ps, void __user *arg) 1047 1047 { 1048 1048 unsigned int ep; 1049 1049 int ret; ··· 1060 1060 return 0; 1061 1061 } 1062 1062 1063 - static int proc_clearhalt(struct dev_state *ps, void __user *arg) 1063 + static int proc_clearhalt(struct usb_dev_state *ps, void __user *arg) 1064 1064 { 1065 1065 unsigned int ep; 1066 1066 int pipe; ··· 1082 1082 return usb_clear_halt(ps->dev, pipe); 1083 1083 } 1084 1084 1085 - static int proc_getdriver(struct dev_state *ps, void __user *arg) 1085 + static int proc_getdriver(struct usb_dev_state *ps, void __user *arg) 1086 1086 { 1087 1087 struct usbdevfs_getdriver gd; 1088 1088 struct usb_interface *intf; ··· 1101 1101 return ret; 1102 1102 } 1103 1103 1104 - static int proc_connectinfo(struct dev_state *ps, void __user *arg) 1104 + static int proc_connectinfo(struct usb_dev_state *ps, void __user *arg) 1105 1105 { 1106 1106 struct usbdevfs_connectinfo ci = { 1107 1107 .devnum = ps->dev->devnum, ··· 1113 1113 return 0; 1114 1114 } 1115 1115 1116 - static int proc_resetdevice(struct dev_state *ps) 1116 + static int proc_resetdevice(struct usb_dev_state *ps) 1117 1117 { 1118 1118 return usb_reset_device(ps->dev); 1119 1119 } 1120 1120 1121 - static int proc_setintf(struct dev_state *ps, void __user *arg) 1121 + static int proc_setintf(struct usb_dev_state *ps, void __user *arg) 1122 1122 { 1123 1123 struct usbdevfs_setinterface setintf; 1124 1124 int ret; ··· 1131 1131 setintf.altsetting); 1132 1132 } 1133 1133 1134 - static int proc_setconfig(struct dev_state *ps, void __user *arg) 1134 + static int proc_setconfig(struct usb_dev_state *ps, void __user *arg) 1135 1135 { 1136 1136 int u; 1137 1137 int status = 0; ··· 1179 1179 return status; 1180 1180 } 1181 1181 1182 - static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, 1182 + static int proc_do_submiturb(struct usb_dev_state *ps, struct usbdevfs_urb *uurb, 1183 1183 struct usbdevfs_iso_packet_desc __user *iso_frame_desc, 1184 1184 void __user *arg) 1185 1185 { ··· 1508 1508 return ret; 1509 1509 } 1510 1510 1511 - static int proc_submiturb(struct dev_state *ps, void __user *arg) 1511 + static int proc_submiturb(struct usb_dev_state *ps, void __user *arg) 1512 1512 { 1513 1513 struct usbdevfs_urb uurb; 1514 1514 ··· 1520 1520 arg); 1521 1521 } 1522 1522 1523 - static int proc_unlinkurb(struct dev_state *ps, void __user *arg) 1523 + static int proc_unlinkurb(struct usb_dev_state *ps, void __user *arg) 1524 1524 { 1525 1525 struct urb *urb; 1526 1526 struct async *as; ··· 1580 1580 return -EFAULT; 1581 1581 } 1582 1582 1583 - static struct async *reap_as(struct dev_state *ps) 1583 + static struct async *reap_as(struct usb_dev_state *ps) 1584 1584 { 1585 1585 DECLARE_WAITQUEUE(wait, current); 1586 1586 struct async *as = NULL; ··· 1603 1603 return as; 1604 1604 } 1605 1605 1606 - static int proc_reapurb(struct dev_state *ps, void __user *arg) 1606 + static int proc_reapurb(struct usb_dev_state *ps, void __user *arg) 1607 1607 { 1608 1608 struct async *as = reap_as(ps); 1609 1609 if (as) { ··· 1616 1616 return -EIO; 1617 1617 } 1618 1618 1619 - static int proc_reapurbnonblock(struct dev_state *ps, void __user *arg) 1619 + static int proc_reapurbnonblock(struct usb_dev_state *ps, void __user *arg) 1620 1620 { 1621 1621 int retval; 1622 1622 struct async *as; ··· 1631 1631 } 1632 1632 1633 1633 #ifdef CONFIG_COMPAT 1634 - static int proc_control_compat(struct dev_state *ps, 1634 + static int proc_control_compat(struct usb_dev_state *ps, 1635 1635 struct usbdevfs_ctrltransfer32 __user *p32) 1636 1636 { 1637 1637 struct usbdevfs_ctrltransfer __user *p; ··· 1644 1644 return proc_control(ps, p); 1645 1645 } 1646 1646 1647 - static int proc_bulk_compat(struct dev_state *ps, 1647 + static int proc_bulk_compat(struct usb_dev_state *ps, 1648 1648 struct usbdevfs_bulktransfer32 __user *p32) 1649 1649 { 1650 1650 struct usbdevfs_bulktransfer __user *p; ··· 1661 1661 1662 1662 return proc_bulk(ps, p); 1663 1663 } 1664 - static int proc_disconnectsignal_compat(struct dev_state *ps, void __user *arg) 1664 + static int proc_disconnectsignal_compat(struct usb_dev_state *ps, void __user *arg) 1665 1665 { 1666 1666 struct usbdevfs_disconnectsignal32 ds; 1667 1667 ··· 1699 1699 return 0; 1700 1700 } 1701 1701 1702 - static int proc_submiturb_compat(struct dev_state *ps, void __user *arg) 1702 + static int proc_submiturb_compat(struct usb_dev_state *ps, void __user *arg) 1703 1703 { 1704 1704 struct usbdevfs_urb uurb; 1705 1705 ··· 1745 1745 return 0; 1746 1746 } 1747 1747 1748 - static int proc_reapurb_compat(struct dev_state *ps, void __user *arg) 1748 + static int proc_reapurb_compat(struct usb_dev_state *ps, void __user *arg) 1749 1749 { 1750 1750 struct async *as = reap_as(ps); 1751 1751 if (as) { ··· 1758 1758 return -EIO; 1759 1759 } 1760 1760 1761 - static int proc_reapurbnonblock_compat(struct dev_state *ps, void __user *arg) 1761 + static int proc_reapurbnonblock_compat(struct usb_dev_state *ps, void __user *arg) 1762 1762 { 1763 1763 int retval; 1764 1764 struct async *as; ··· 1775 1775 1776 1776 #endif 1777 1777 1778 - static int proc_disconnectsignal(struct dev_state *ps, void __user *arg) 1778 + static int proc_disconnectsignal(struct usb_dev_state *ps, void __user *arg) 1779 1779 { 1780 1780 struct usbdevfs_disconnectsignal ds; 1781 1781 ··· 1786 1786 return 0; 1787 1787 } 1788 1788 1789 - static int proc_claiminterface(struct dev_state *ps, void __user *arg) 1789 + static int proc_claiminterface(struct usb_dev_state *ps, void __user *arg) 1790 1790 { 1791 1791 unsigned int ifnum; 1792 1792 ··· 1795 1795 return claimintf(ps, ifnum); 1796 1796 } 1797 1797 1798 - static int proc_releaseinterface(struct dev_state *ps, void __user *arg) 1798 + static int proc_releaseinterface(struct usb_dev_state *ps, void __user *arg) 1799 1799 { 1800 1800 unsigned int ifnum; 1801 1801 int ret; ··· 1808 1808 return 0; 1809 1809 } 1810 1810 1811 - static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl) 1811 + static int proc_ioctl(struct usb_dev_state *ps, struct usbdevfs_ioctl *ctl) 1812 1812 { 1813 1813 int size; 1814 1814 void *buf = NULL; ··· 1884 1884 return retval; 1885 1885 } 1886 1886 1887 - static int proc_ioctl_default(struct dev_state *ps, void __user *arg) 1887 + static int proc_ioctl_default(struct usb_dev_state *ps, void __user *arg) 1888 1888 { 1889 1889 struct usbdevfs_ioctl ctrl; 1890 1890 ··· 1894 1894 } 1895 1895 1896 1896 #ifdef CONFIG_COMPAT 1897 - static int proc_ioctl_compat(struct dev_state *ps, compat_uptr_t arg) 1897 + static int proc_ioctl_compat(struct usb_dev_state *ps, compat_uptr_t arg) 1898 1898 { 1899 1899 struct usbdevfs_ioctl32 __user *uioc; 1900 1900 struct usbdevfs_ioctl ctrl; ··· 1912 1912 } 1913 1913 #endif 1914 1914 1915 - static int proc_claim_port(struct dev_state *ps, void __user *arg) 1915 + static int proc_claim_port(struct usb_dev_state *ps, void __user *arg) 1916 1916 { 1917 1917 unsigned portnum; 1918 1918 int rc; ··· 1926 1926 return rc; 1927 1927 } 1928 1928 1929 - static int proc_release_port(struct dev_state *ps, void __user *arg) 1929 + static int proc_release_port(struct usb_dev_state *ps, void __user *arg) 1930 1930 { 1931 1931 unsigned portnum; 1932 1932 ··· 1935 1935 return usb_hub_release_port(ps->dev, portnum, ps); 1936 1936 } 1937 1937 1938 - static int proc_get_capabilities(struct dev_state *ps, void __user *arg) 1938 + static int proc_get_capabilities(struct usb_dev_state *ps, void __user *arg) 1939 1939 { 1940 1940 __u32 caps; 1941 1941 ··· 1951 1951 return 0; 1952 1952 } 1953 1953 1954 - static int proc_disconnect_claim(struct dev_state *ps, void __user *arg) 1954 + static int proc_disconnect_claim(struct usb_dev_state *ps, void __user *arg) 1955 1955 { 1956 1956 struct usbdevfs_disconnect_claim dc; 1957 1957 struct usb_interface *intf; ··· 1991 1991 static long usbdev_do_ioctl(struct file *file, unsigned int cmd, 1992 1992 void __user *p) 1993 1993 { 1994 - struct dev_state *ps = file->private_data; 1994 + struct usb_dev_state *ps = file->private_data; 1995 1995 struct inode *inode = file_inode(file); 1996 1996 struct usb_device *dev = ps->dev; 1997 1997 int ret = -ENOTTY; ··· 2192 2192 static unsigned int usbdev_poll(struct file *file, 2193 2193 struct poll_table_struct *wait) 2194 2194 { 2195 - struct dev_state *ps = file->private_data; 2195 + struct usb_dev_state *ps = file->private_data; 2196 2196 unsigned int mask = 0; 2197 2197 2198 2198 poll_wait(file, &ps->wait, wait); ··· 2218 2218 2219 2219 static void usbdev_remove(struct usb_device *udev) 2220 2220 { 2221 - struct dev_state *ps; 2221 + struct usb_dev_state *ps; 2222 2222 struct siginfo sinfo; 2223 2223 2224 2224 while (!list_empty(&udev->filelist)) { 2225 - ps = list_entry(udev->filelist.next, struct dev_state, list); 2225 + ps = list_entry(udev->filelist.next, struct usb_dev_state, list); 2226 2226 destroy_all_async(ps); 2227 2227 wake_up_all(&ps->wait); 2228 2228 list_del_init(&ps->list);
+6 -6
drivers/usb/core/hub.c
··· 1788 1788 * to one of these "claimed" ports, the program will "own" the device. 1789 1789 */ 1790 1790 static int find_port_owner(struct usb_device *hdev, unsigned port1, 1791 - struct dev_state ***ppowner) 1791 + struct usb_dev_state ***ppowner) 1792 1792 { 1793 1793 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); 1794 1794 ··· 1806 1806 1807 1807 /* In the following three functions, the caller must hold hdev's lock */ 1808 1808 int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, 1809 - struct dev_state *owner) 1809 + struct usb_dev_state *owner) 1810 1810 { 1811 1811 int rc; 1812 - struct dev_state **powner; 1812 + struct usb_dev_state **powner; 1813 1813 1814 1814 rc = find_port_owner(hdev, port1, &powner); 1815 1815 if (rc) ··· 1822 1822 EXPORT_SYMBOL_GPL(usb_hub_claim_port); 1823 1823 1824 1824 int usb_hub_release_port(struct usb_device *hdev, unsigned port1, 1825 - struct dev_state *owner) 1825 + struct usb_dev_state *owner) 1826 1826 { 1827 1827 int rc; 1828 - struct dev_state **powner; 1828 + struct usb_dev_state **powner; 1829 1829 1830 1830 rc = find_port_owner(hdev, port1, &powner); 1831 1831 if (rc) ··· 1837 1837 } 1838 1838 EXPORT_SYMBOL_GPL(usb_hub_release_port); 1839 1839 1840 - void usb_hub_release_all_ports(struct usb_device *hdev, struct dev_state *owner) 1840 + void usb_hub_release_all_ports(struct usb_device *hdev, struct usb_dev_state *owner) 1841 1841 { 1842 1842 struct usb_hub *hub = usb_hub_to_struct_hub(hdev); 1843 1843 int n;
+1 -1
drivers/usb/core/hub.h
··· 89 89 struct usb_port { 90 90 struct usb_device *child; 91 91 struct device dev; 92 - struct dev_state *port_owner; 92 + struct usb_dev_state *port_owner; 93 93 enum usb_port_connect_type connect_type; 94 94 u8 portnum; 95 95 unsigned power_is_on:1;
+2 -2
drivers/usb/core/usb.h
··· 2 2 #include <linux/acpi.h> 3 3 4 4 struct usb_hub_descriptor; 5 - struct dev_state; 5 + struct usb_dev_state; 6 6 7 7 /* Functions local to drivers/usb/core/ */ 8 8 ··· 58 58 extern void usb_rebind_intf(struct usb_interface *intf); 59 59 60 60 extern void usb_hub_release_all_ports(struct usb_device *hdev, 61 - struct dev_state *owner); 61 + struct usb_dev_state *owner); 62 62 extern bool usb_device_is_owned(struct usb_device *udev); 63 63 64 64 extern int usb_hub_init(void);
+3 -3
include/linux/usb.h
··· 366 366 #endif 367 367 }; 368 368 369 - struct dev_state; 369 + struct usb_dev_state; 370 370 371 371 /* ----------------------------------------------------------------------- */ 372 372 ··· 753 753 754 754 /* port claiming functions */ 755 755 int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, 756 - struct dev_state *owner); 756 + struct usb_dev_state *owner); 757 757 int usb_hub_release_port(struct usb_device *hdev, unsigned port1, 758 - struct dev_state *owner); 758 + struct usb_dev_state *owner); 759 759 760 760 /** 761 761 * usb_make_path - returns stable device path in the usb tree