Re: composite.c: module parameters

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

 



On Wed, Apr 14, 2010 at 07:16:35PM +0200, Micha?? Nazarewicz wrote:
Still, since with FunctionFS the composite device may be registered
and deregistered several times while the module is running would it
make sense to create a macro for changing the perm? I'm thinking of

#v+
#ifndef USB_COMPOSITE_PARAM_PERM
#  define USB_COMPOSITE_PARAM_PERM 0
#endif

static ushort idVendor;
module_param(idVendor, ushort, USB_COMPOSITE_PARAM_PERM);
MODULE_PARM_DESC(idVendor, "USB Vendor ID");

/* ... */
#v-

#v+
#define USB_COMPOSITE_PARAM_PERM 0644
#include "composite.c"
#v-

Or is it too ugly?

On Wed, 14 Apr 2010 19:57:17 +0200, Greg KH <greg@xxxxxxxxx> wrote:
Ick, that's ugly :)

;)

And it keeps anyone from building a kernel that works on multiple types
of systems, which is a strong goal right now for a large number of
people, even for ARM systems.

Well, no.  It would only affect composite gadgets and since the default
value for the macro is zero it would only affect gadgets that want to
be affected (that is those that define the macro prior to including
composite.c).  Everything else would work the way it have before the
change.

For me, the other solution would be duplicating similar functionality
in the g_ffs (see my patches last week) which I would like to avoid.

Well, you can get a notification in your code when these options are
written to from userspace, so perhaps if you just properly handle things
it should be fine.  Maybe you need to fail the write if the device is
connected and you can't change the values at that time.

Actually, adding those parameters to the module is not that complicated
especially that personally I would accept a situation where the value in
the sysfs files are invalid (ie. changed after the composite driver has
been registered).  What I'm wondering is whether using the composite.c's
parameters would make sense here.

--
Best regards,                                           _     _
 .o. | Liege of Serenely Enlightened Majesty of       o' \,=./ `o
 ..o | Computer Science,  Michał "mina86" Nazarewicz     (o o)
 ooo +---[mina86@xxxxxxxxxx]---[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