USB: HWA: fix device probe failure

This patch fixes a race condition that caused the HWA_HC interface probe
function to occasionally fail.  The HWA_HC would attempt to register
itself with the HWA_RC by searching for a uwb_rc class device with the
same parent device ptr.  If the probe function for the HWA_RC interface
had yet to run, the uwb_rc class device would not have been created
causing the look up to fail and the HWA_HC probe function to return an
error causing the device to be unusable.

The fix is for the HWA to delay registering with the HWA_RC until
receiving the command from userspace to start the wireless channel.  It
is the responsibility of userspace to ensure that the uwb_rc class
device has been created before starting the HWA channel.

Signed-off-by: Thomas Pugliese <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Thomas Pugliese 2013-06-24 14:26:35 -05:00 • committed by Greg Kroah-Hartman
commit a899575191
7 changed files with 42 additions and 18 deletions

View file

@ -44,10 +44,12 @@ int uwb_pal_register(struct uwb_pal *pal)
int ret;
if (pal->device) {
/* create a link to the uwb_rc in the PAL device's directory. */
ret = sysfs_create_link(&pal->device->kobj,
&rc->uwb_dev.dev.kobj, "uwb_rc");
if (ret < 0)
return ret;
/* create a link to the PAL in the UWB device's directory. */
ret = sysfs_create_link(&rc->uwb_dev.dev.kobj,
&pal->device->kobj, pal->name);
if (ret < 0) {

View file

@ -55,7 +55,8 @@ static inline struct uwb_rc *__uwb_rc_get(struct uwb_rc *rc)
static inline void __uwb_rc_put(struct uwb_rc *rc)
{
uwb_dev_put(&rc->uwb_dev);
if (rc)
uwb_dev_put(&rc->uwb_dev);
}
extern int uwb_rc_reset(struct uwb_rc *rc);