Re: My vision of usbmon

From: Greg KH
Date: Wed Dec 22 2004 - 00:14:16 EST


On Tue, Dec 21, 2004 at 09:06:24PM -0800, Greg KH wrote:
> On Tue, Dec 21, 2004 at 05:29:06PM -0800, Pete Zaitcev wrote:
> > On Tue, 21 Dec 2004 16:57:26 -0800, Greg KH <greg@xxxxxxxxx> wrote:
> >
> > > It looks great, thanks for doing this work. Let me know when you want
> > > it added to the kernel tree.
> >
> > Thanks, Greg. There's a little tidbit in usbmon about which I wish you to
> > make a pronouncement explicitly:
> >
> > + /* XXX Is this how I pin struct bus? Ask linux-usb-devel */
> > + kobject_get(&ubus->class_dev.kobj);
> > + mbus->u_bus = ubus;
> > + ubus->mon_bus = mbus;
>
> Use usb_bus_get() instead. Ick, that function's implementation sucks,
> I'll go clean it up and export it for you to be able to use from your
> code.

Does this patch work for you?

thanks,

greg k-h

-----

USB: export usb_bus_get() and usb_bus_put()

Signed-off-by: Greg Kroah-Hartman <greg@xxxxxxxxx>

--- 1.176/drivers/usb/core/hcd.c 2004-12-20 17:14:32 -08:00
+++ edited/hcd.c 2004-12-21 21:09:01 -08:00
@@ -608,27 +608,20 @@ static int usb_rh_urb_dequeue (struct us

/*-------------------------------------------------------------------------*/

-/* exported only within usbcore */
-struct usb_bus *usb_bus_get (struct usb_bus *bus)
+struct usb_bus *usb_bus_get(struct usb_bus *bus)
{
- struct class_device *tmp;
-
- if (!bus)
- return NULL;
-
- tmp = class_device_get(&bus->class_dev);
- if (tmp)
- return to_usb_bus(tmp);
- else
- return NULL;
+ if (bus)
+ class_device_get(&bus->class_dev);
+ return bus;
}
+EXPORT_SYMBOL_GPL(usb_bus_get);

-/* exported only within usbcore */
-void usb_bus_put (struct usb_bus *bus)
+void usb_bus_put(struct usb_bus *bus)
{
if (bus)
class_device_put(&bus->class_dev);
}
+EXPORT_SYMBOL_GPL(usb_bus_put);

/*-------------------------------------------------------------------------*/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/