Commit 36e56a34 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

usbcore: move code among source files

This revised patch (as713b) moves a few routines among source files in
usbcore.  Some driver-related code in usb.c (claiming interfaces and
matching IDs) is moved to driver.c, where it belongs.  Also the
usb_generic stuff in driver.c is moved to a new source file: generic.c.
(That's the reason for revising the patch.)  Although not very big now,
it will get bigger in a later patch.

None of the code has been changed; it has only been re-arranged.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 140d8f68
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
usbcore-objs := usb.o hub.o hcd.o urb.o message.o driver.o \ usbcore-objs := usb.o hub.o hcd.o urb.o message.o driver.o \
config.o file.o buffer.o sysfs.o endpoint.o \ config.o file.o buffer.o sysfs.o endpoint.o \
devio.o notify.o devio.o notify.o generic.o
ifeq ($(CONFIG_PCI),y) ifeq ($(CONFIG_PCI),y)
usbcore-objs += hcd-pci.o usbcore-objs += hcd-pci.o
......
This diff is collapsed.
/*
* drivers/usb/generic.c - generic driver for USB devices (not interfaces)
*
* (C) Copyright 2005 Greg Kroah-Hartman <gregkh@suse.de>
*
* based on drivers/usb/usb.c which had the following copyrights:
* (C) Copyright Linus Torvalds 1999
* (C) Copyright Johannes Erdfelt 1999-2001
* (C) Copyright Andreas Gal 1999
* (C) Copyright Gregory P. Smith 1999
* (C) Copyright Deti Fliegl 1999 (new USB architecture)
* (C) Copyright Randy Dunlap 2000
* (C) Copyright David Brownell 2000-2004
* (C) Copyright Yggdrasil Computing, Inc. 2000
* (usb_device_id matching changes by Adam J. Richter)
* (C) Copyright Greg Kroah-Hartman 2002-2003
*
*/
#include <linux/config.h>
#include <linux/usb.h>
#include "usb.h"
static int generic_probe(struct device *dev)
{
return 0;
}
static int generic_remove(struct device *dev)
{
struct usb_device *udev = to_usb_device(dev);
/* if this is only an unbind, not a physical disconnect, then
* unconfigure the device */
if (udev->state == USB_STATE_CONFIGURED)
usb_set_configuration(udev, 0);
/* in case the call failed or the device was suspended */
if (udev->state >= USB_STATE_CONFIGURED)
usb_disable_device(udev, 0);
return 0;
}
struct device_driver usb_generic_driver = {
.owner = THIS_MODULE,
.name = "usb",
.bus = &usb_bus_type,
.probe = generic_probe,
.remove = generic_remove,
};
/* Fun hack to determine if the struct device is a
* usb device or a usb interface. */
int usb_generic_driver_data;
This diff is collapsed.
...@@ -33,9 +33,9 @@ extern void usb_host_cleanup(void); ...@@ -33,9 +33,9 @@ extern void usb_host_cleanup(void);
extern int usb_port_suspend(struct usb_device *dev); extern int usb_port_suspend(struct usb_device *dev);
extern int usb_port_resume(struct usb_device *dev); extern int usb_port_resume(struct usb_device *dev);
extern struct bus_type usb_bus_type;
extern struct device_driver usb_generic_driver; extern struct device_driver usb_generic_driver;
extern int usb_generic_driver_data; extern int usb_generic_driver_data;
extern int usb_device_match(struct device *dev, struct device_driver *drv);
/* Interfaces and their "power state" are owned by usbcore */ /* Interfaces and their "power state" are owned by usbcore */
......
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