hwa-hc needs a module reference for hwa-rc, simple and dirty repair included. [was: usb deferred probing]

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

 



Hi Alan,

I figured out the problem.

I knew already that the hwa-hc module did not directly call symbols
from the hwa-rc module (its uwb_rc is occasionally provided as private
driver data upon probe/create and therefore does not directly call any
of the symbols exported by hwa-rc), but I didn't actually realize how
much of a problem this was until I accidentally ran 'rmmod hwa-rc'
while hwa-hc was loaded. The effect... lots of dangling pointers to
things that no longer existed in memory.

Hwa-hc needs to get a module reference on hwa-rc (i.e. it should show
up under "Used by" with lsmod). The current method breaks module
dependencies (which is why the hwahc_create function usually dies).

The quickest and dirtiest solution is:

--- hwa-rc.c ---
void hwarc_dummy_func(void) {}
EXPORT_SYMBOL_GPL(hwarc_dummy_func);

--- hwa-hc.c ---
extern void hwarc_dummy_func(void);
static int __init hwahc_driver_init(void)
{
+	hwarc_dummy_func();
	return usb_register(&hwahc_driver);
}
module_init(hwahc_driver_init);

This loads the modules in the correct order at least. One small
problem down... getting the Wisair HWA to do something useful will
require a bit more work.


C

On Mon, Aug 23, 2010 at 5:09 PM, Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, 23 Aug 2010, Christopher Friedt wrote:
>
>> here's a question for the usb core people;
>>
>> how does one defer the probing of one usb interface until another usb
>> interface on the same device has already been probed/
>
> There is no way to defer probing.  You'll have to accomplish an
> equivalent result by different means.
>
>> as an example, take a look at the wireless usb / uwb code. in
>> drivers/usb/host/hwa-hc.c . hwahc-create [called from hwahc-probe]
>> dies if it cannot find an uwb-rc structure in its grandparent.
>
> What do you mean by "its grandparent"?  What is the "grandparent" of
> hwahc-create?
>
>> this
>> uwb-rc structure is created in drivers/uwb/ the problem is, that the
>> uwb-rc structure should always be created before the hwa-hc is probed.
>> in reality, in almost never is [with my hardware in any case] so
>> module autoloading always fails. the uwb-rc structure is created in
>> drivers/uwb/hwa-rc.c [hwarc-probe].
>>
>> so far i've tried relinquishing control in hwahc-create [using
>> schedule] and waiting for some number of tried, but that does not
>> work. i also tried inserting and exporting a dummy function in
>> hwa-rc.ko, which would be called from probe in hwa-hc.ko, which would
>> correct the module dependency, but that did not work either.
>
> Without knowing the details of how this all works, it's hard to give a
> good answer.  For example, why is the uwb-rc structure created so late?
> What is the relation between the devices passed to hwarc-probe and
> hwahc-probe?  Why does the second probe routine get called before the
> first has finished?
>
>> does this have anything to do with the 'needs_binding' or
>> 'needs_altsetting0' flags/
>
> No.
>
> Alan Stern
>
>
--
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