RE: [PATCH 06/30] usb/gadget: add some infracture to register/unregister functions

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

 



On Tuesday, January 15, 2013 1:03 PM Sebastian Andrzej Siewior wrote:

<snip>

> >usb_function_driver.
> >
> >I would call the structure in question "usb_function_module".
> >Or even better: "usb_function_pool" - you get usb_functions from it.
> >Please see inline for what it looks like.
> 
> Not sure I can agree here. It is not what we use "usb_function" for.
> That thing that comes out of "try_get_usb_function_instance", the
> usb_function_instance, is an instance which matches what I read here [0].
> Yes, it is a specific USB function, with the same "configuration".

So it looks like the "usb_function_instance" is in fact a usb function's
_configuration_ instance?

> "usb_function" is something we use in "usb_configuration" and those two
> are not the same.

Yet, the first thing that comes to my mind after I think of a "usb function
instance" (no underscores here intentionally) is an instance
of a struct usb_function. This is confusing me. It took me a long while
until I understood what is going on here. Would you mind finding a
better name for it?

In order not to confuse those two I just picked
> something else. try_get_usb_function_instance() returnes severel kinds of
> objects so it does not match "pool" in OO language. If you look at
> skb_pool you expect a skb and always a skb and each skb has the same
> capabilities. This is simple not true here.
> I think in OO language try_get_usb_function_instance() would match a
> "fabric" and usb_get_function() would match the "pool".
> 

I meant to call the _struct_ usb_function_instance a usb_function_pool.
This in fact is consistent with what you say above: in OO language
you could call a factory method on behalf of some object (or perhaps,
a class). In C we pass this object explicitly as there is no "this"
pointer. So to the usb_get_function() factory method is called on
behalf of some object which is passed as an argument. And I suggest
calling this argument a usb_function_pool:

/* pool below is the "this" */
struct usb_function *usb_get_function(struct usb_function_pool *pool);

so the "usb_get_function" method is called on behalf of some pool.

I am not insisting on "pool". But for the reasons given above I
would like the struct usb_function_instance (and its dependent
names) to be called differently.

AP


--
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