Skip to contentSkip to conversation

Add usb_endpoint_descriptor to be part of the struct usb_ep

PATCH Alan Stern 5 participants 5 messages Oct 3, 2010 – Nov 11, 2010 1 message not in the archive

lore
Share & tools
lore

Alan Stern

author
#1 lore raw
In reply to a message not in the archive
Quoted 13 lines · tlinder

From: Tatyana Linder <[email protected]>

Change ep_choose() and usb_ep_enable() prototypes to use endpoint descriptor from usb_ep. This optimization prevents the FDs from handling the endpoint chosen descriptor.
This optimization is not full though. To fully exploit this change one needs to update all the UDCs as well since in the current implementation each of them saves the endpoint descriptor in it's internal (and extended) endpoint structure.
This patch is a preparation for adding SuperSpeed support to the gadget framework.

...

drivers/usb/gadget/file_storage.c line 9

Quoted 12 lines
drivers/usb/gadget/file_storage.c +1 -0
index a857b7a..6264fba 100644
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2003-2008 Alan Stern
  * All rights reserved.
+ * Copyright (C) 2010 Code Aurora Forum. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Speaking for myself only, I don't think people should add their own copyright notices in files to which they have not made substantial changes. A little code motion and a small API adjustment don't seem like large enough changes to justify this. Some of the other files in this patch have even smaller changes!

Quoted 22 lines
drivers/usb/gadget/storage_common.c +2 -5
index 484acfb..d5612ed 100644
@@ -2,7 +2,8 @@
  * storage_common.c -- Common definitions for mass storage functionality
  *
  * Copyright (C) 2003-2008 Alan Stern
- * Copyeight (C) 2009 Samsung Electronics
+ * Copyright (C) 2009 Samsung Electronics
+ * Copyright (C) 2010 Code Aurora Forum. All rights reserved.
  * Author: Michal Nazarewicz ([email protected])
  *
  * This program is free software; you can redistribute it and/or modify
@@ -536,17 +537,6 @@ static struct usb_descriptor_header *fsg_hs_function[] = {
 	NULL,
 };
 
-/* Maxpacket and other transfer characteristics vary by speed. */
-static struct usb_endpoint_descriptor *
-fsg_ep_desc(struct usb_gadget *g, struct usb_endpoint_descriptor *fs,
-		struct usb_endpoint_descriptor *hs)

drivers/usb/gadget/storage_common.c static struct usb_descriptor_header *fsg_hs_function[] = { · line 542

Quoted 10 lines
drivers/usb/gadget/storage_common.c +0 -7
-{
-	if (gadget_is_dualspeed(g) && g->speed == USB_SPEED_HIGH)
-		return hs;
-	return fs;
-}
-
-
 /* Static strings, in UTF-8 (for simplicity we use only ASCII characters) */
 static struct usb_string		fsg_strings[] = {
 #ifndef FSG_NO_DEVICE_STRINGS

This is a good example. You have contributed _nothing_ to this file -- all you did was _move_ some code to a different file. This hardly seems to justify adding a copyright notice.

Quoted 13 lines
include/linux/usb/gadget.h +1 -0
index d3ef42d..bf7dc0b 100644
@@ -7,6 +7,7 @@
  *
  *
  * (C) Copyright 2002-2004 by David Brownell
+ * (C) Copyright 2010 Code Aurora Forum.
  * All Rights Reserved.
  *
  * This software is licensed under the GNU GPL version 2.

include/linux/usb/gadget.h struct usb_ep_ops { · line 138

Quoted 5 lines
include/linux/usb/gadget.h +2 -0
@@ -133,18 +134,25 @@ struct usb_ep_ops {
  *      the endpoint descriptor used to configure the endpoint.
  * @driver_data:for use by the gadget driver.  all other fields are
  *	read-only to gadget drivers.
+ * @bEndpointAddress: used to identify ep when finding descriptor that matches
+ *	connection speed

This comment isn't very good. Don't say what bEndpointAddress is _used_ for, say what it _is_.

include/linux/usb/gadget.h struct usb_ep_ops { · line 142

Quoted 4 lines
include/linux/usb/gadget.h +3 -0
+ * @desc:endpoint descriptor.  this pointer set before endpoint is enabled and
+ *	remains valid until the endpoint is disabled; the data byte order
+ *	is little-endian (usb-standard).
  *

In addition, you need to point out in the kerneldoc for usb_ep_enable, that the gadget driver must set these two fields before calling usb_ep_enable, and you need to change the comment immediately above, which states that these fields are read-only to gadget drivers!

Alan Stern

#2 lore raw
Quoted 4 lines · Alan Stern

Speaking for myself only,

... and me too, for that matter.

I don't think people should add

Quoted 8 lines

their own
copyright notices in files to which they have not made substantial
changes.  A little code motion and a small API adjustment don't seem
like large enough changes to justify this.  Some of the other files in
this patch have even smaller changes!

It's pretty routine that very small patches
get merged without attribution, for that matter,
beyond GIT history.

- Dave

Quoted 1 line
#3 lore raw
In reply to Alan Stern
Quoted 28 lines · Alan Stern
Quoted 13 lines · tlinder

From: Tatyana Linder <[email protected]>

Change ep_choose() and usb_ep_enable() prototypes to use endpoint descriptor from usb_ep. This optimization prevents the FDs from handling the endpoint chosen descriptor.
This optimization is not full though. To fully exploit this change one needs to update all the UDCs as well since in the current implementation each of them saves the endpoint descriptor in it's internal (and extended) endpoint structure.
This patch is a preparation for adding SuperSpeed support to the gadget framework.

...

Quoted 10 lines
drivers/usb/gadget/file_storage.c +1 -0
index a857b7a..6264fba 100644
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2003-2008 Alan Stern
  * All rights reserved.
+ * Copyright (C) 2010 Code Aurora Forum. All rights reserved.
  *
Quoted 8 lines

drivers/usb/gadget/file_storage.c line 9

Quoted 2 lines
drivers/usb/gadget/file_storage.c +0 -0
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Speaking for myself only, I don't think people should add their own copyright notices in files to which they have not made substantial changes. A little code motion and a small API adjustment don't seem like large enough changes to justify this. Some of the other files in this patch have even smaller changes!

I agree. Tatyana, please work with your company's lawyers to properly learn how to add this type of mark to a file in a manner that is correct.

Hint, this way is not correct :)

thanks,

greg k-h

#4 lore raw
In reply to Alan Stern
Quoted 13 lines · Alan Stern
Quoted 1 line

...

Quoted 10 lines
drivers/usb/gadget/file_storage.c +1 -0
index a857b7a..6264fba 100644
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2003-2008 Alan Stern
  * All rights reserved.
+ * Copyright (C) 2010 Code Aurora Forum. All rights reserved.
  *
Quoted 8 lines

drivers/usb/gadget/file_storage.c line 9

Quoted 2 lines
drivers/usb/gadget/file_storage.c +0 -0
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Speaking for myself only, I don't think people should add their own copyright notices in files to which they have not made substantial changes. A little code motion and a small API adjustment don't seem like large enough changes to justify this. Some of the other files in this patch have even smaller changes!

BTW, we agree on this. People aren't supposed to be putting these copyrights in, but they've gotten used to it up until now.

Tatyana, please be careful to not insert a Code Aurora Forum copyright unless you change a significant portion of the file.

David

#5 lore raw

-----Original Message-----
From: David Brown [mailto:[email protected]]
Sent: Thursday, November 11, 2010 1:41 AM
To: Alan Stern
Cc: tlinder; USB list; David Brownell; Greg Kroah-Hartman; Michal Nazarewicz; Andrew Morton; Kernel development list
Subject: Re: [RFC/PATCH 1/2] Add usb_endpoint_descriptor to be part of the struct usb_ep

Quoted 4 lines · Alan Stern
Quoted 1 line

...

Review

Quoted 1 line
(quoted diff) +0 -0

b/drivers/usb/gadget/file_storage.c

Quoted 9 lines
Quoted 9 lines

index a857b7a..6264fba 100644

drivers/usb/gadget/file_storage.c +1 -0
@@ -3,6 +3,7 @@
  *
  * Copyright (C) 2003-2008 Alan Stern
  * All rights reserved.
+ * Copyright (C) 2010 Code Aurora Forum. All rights reserved.
  *
Quoted 8 lines

drivers/usb/gadget/file_storage.c line 9

Quoted 2 lines
drivers/usb/gadget/file_storage.c +0 -0
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions

Speaking for myself only, I don't think people should add their own copyright notices in files to which they have not made substantial changes. A little code motion and a small API adjustment don't seem like large enough changes to justify this. Some of the other files in this patch have even smaller changes!

BTW, we agree on this. People aren't supposed to be putting these copyrights in, but they've gotten used to it up until now.

Tatyana, please be careful to not insert a Code Aurora Forum copyright unless you change a significant portion of the file.

[Brokhman, Tanya] - Yes, this was already removed in the latest version of the patch. Thanks!

David