Re: composite: usb_string_id() doubts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- On Fri, 5/28/10, Michał Nazarewicz <m.nazarewicz@xxxxxxxxxxx> wrote:
1. The ID 255 will never be assigned.  Is it intended or a bug?

On Fri, 28 May 2010 19:17:42 +0200, David Brownell <david-b@xxxxxxxxxxx> wrote:
ISTR intentional ... isn't 255 reserved to indicate "no valid string ID"?
(Either in the USB spec or in Linux.)  I'd have to check the spec to verify.

I think it would be worth commenting since less experienced hackers (like
me) may get confused why 255 is omitted.


2. 'next_string_id' name is not really appropriate since it does not
    store an ID of a *next* string

I don't follow.  It's certainly the next ID returned by that function...

No, it is the value returned by the call to the function so the
next call will return a different value.  For me, the name is a bit
confusing.  For me the following two are intuitive:

int foo() {
	static int next;
	return next++;
}

int bar() {
	static int last;
	return ++last;
}

where with usb_string_id we have:

int usb_string_id(struct usb_composite_dev *cdev) {
	return ++cdev->next_string_id;
}

But maybe it's just me...

--
Best regards,                                        _     _
| Humble Liege of Serenely Enlightened Majesty of  o' \,=./ `o
| Computer Science,  Michał "mina86" Nazarewicz       (o o)
+----[mina86*mina86.com]---[mina86*jabber.org]----ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux