From: Greg KH <greg@kroah.com>
To: linux-usb-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [BK PATCH] More USB changes for 2.5.38
Date: Fri, 27 Sep 2002 12:40:25 -0700 [thread overview]
Message-ID: <20020927194025.GC12909@kroah.com> (raw)
In-Reply-To: <20020927193855.GB12909@kroah.com>
# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.611.1.1 -> 1.611.1.2
# drivers/usb/usb-skeleton.c 1.15 -> 1.16
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/26 greg@kroah.com 1.611.1.2
# USB: convert the usb-skeleton.c driver to work with the latest USB core changes.
# --------------------------------------------
#
diff -Nru a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
--- a/drivers/usb/usb-skeleton.c Fri Sep 27 12:30:25 2002
+++ b/drivers/usb/usb-skeleton.c Fri Sep 27 12:30:25 2002
@@ -1,12 +1,11 @@
/*
- * USB Skeleton driver - 0.7
+ * USB Skeleton driver - 0.8
*
- * Copyright (c) 2001 Greg Kroah-Hartman (greg@kroah.com)
+ * Copyright (c) 2001-2002 Greg Kroah-Hartman (greg@kroah.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
+ * published by the Free Software Foundation, version 2.
*
*
* This driver is to be used as a skeleton driver to be able to create a
@@ -22,6 +21,8 @@
*
* History:
*
+ * 2002_09_26 - 0.8 - changes due to USB core conversion to struct device
+ * driver.
* 2002_02_12 - 0.7 - zero out dev in probe function for devices that do
* not have both a bulk in and bulk out endpoint.
* Thanks to Holger Waechtler for the fix.
@@ -133,8 +134,8 @@
static int skel_open (struct inode *inode, struct file *file);
static int skel_release (struct inode *inode, struct file *file);
-static void * skel_probe (struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id);
-static void skel_disconnect (struct usb_device *dev, void *ptr);
+static int skel_probe (struct usb_interface *intf, const struct usb_device_id *id);
+static void skel_disconnect (struct usb_interface *intf);
static void skel_write_bulk_callback (struct urb *urb);
@@ -509,10 +510,10 @@
* Called by the usb core when a new device is connected that it thinks
* this driver might be interested in.
*/
-static void * skel_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
+static int skel_probe(struct usb_interface *interface, const struct usb_device_id *id)
{
+ struct usb_device *udev = interface_to_usbdev(interface);
struct usb_skel *dev = NULL;
- struct usb_interface *interface;
struct usb_interface_descriptor *iface_desc;
struct usb_endpoint_descriptor *endpoint;
int minor;
@@ -525,7 +526,7 @@
/* See if the device offered us matches what we can accept */
if ((udev->descriptor.idVendor != USB_SKEL_VENDOR_ID) ||
(udev->descriptor.idProduct != USB_SKEL_PRODUCT_ID)) {
- return NULL;
+ return -ENODEV;
}
down (&minor_table_mutex);
@@ -545,8 +546,6 @@
memset (dev, 0x00, sizeof (*dev));
minor_table[minor] = dev;
- interface = &udev->actconfig->interface[ifnum];
-
init_MUTEX (&dev->sem);
dev->udev = udev;
dev->interface = interface;
@@ -619,7 +618,11 @@
exit:
up (&minor_table_mutex);
- return dev;
+ if (dev) {
+ dev_set_drvdata (&interface->dev, dev);
+ return 0;
+ }
+ return -ENODEV;
}
@@ -628,13 +631,17 @@
*
* Called by the usb core when the device is removed from the system.
*/
-static void skel_disconnect(struct usb_device *udev, void *ptr)
+static void skel_disconnect(struct usb_interface *interface)
{
struct usb_skel *dev;
int minor;
- dev = (struct usb_skel *)ptr;
-
+ dev = dev_get_drvdata (&interface->dev);
+ dev_set_drvdata (&interface->dev, NULL);
+
+ if (!dev)
+ return;
+
down (&minor_table_mutex);
down (&dev->sem);
next prev parent reply other threads:[~2002-09-27 19:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-09-27 19:37 [BK PATCH] More USB changes for 2.5.38 Greg KH
2002-09-27 19:38 ` Greg KH
2002-09-27 19:40 ` Greg KH [this message]
2002-09-27 19:40 ` Greg KH
2002-09-27 19:42 ` Greg KH
2002-09-27 19:42 ` Greg KH
2002-09-27 19:43 ` Greg KH
2002-09-27 19:43 ` Greg KH
2002-09-27 19:43 ` Greg KH
2002-09-27 19:44 ` Greg KH
2002-09-27 19:48 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020927194025.GC12909@kroah.com \
--to=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.