diff options
Diffstat (limited to 'drivers/uwb/beacon.c')
-rw-r--r-- | drivers/uwb/beacon.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/uwb/beacon.c b/drivers/uwb/beacon.c index d9f2a8acc593..247956098afa 100644 --- a/drivers/uwb/beacon.c +++ b/drivers/uwb/beacon.c | |||
@@ -119,7 +119,6 @@ int uwb_rc_beacon(struct uwb_rc *rc, int channel, unsigned bpst_offset) | |||
119 | int result; | 119 | int result; |
120 | struct device *dev = &rc->uwb_dev.dev; | 120 | struct device *dev = &rc->uwb_dev.dev; |
121 | 121 | ||
122 | mutex_lock(&rc->uwb_dev.mutex); | ||
123 | if (channel < 0) | 122 | if (channel < 0) |
124 | channel = -1; | 123 | channel = -1; |
125 | if (channel == -1) | 124 | if (channel == -1) |
@@ -128,7 +127,7 @@ int uwb_rc_beacon(struct uwb_rc *rc, int channel, unsigned bpst_offset) | |||
128 | /* channel >= 0...dah */ | 127 | /* channel >= 0...dah */ |
129 | result = uwb_rc_start_beacon(rc, bpst_offset, channel); | 128 | result = uwb_rc_start_beacon(rc, bpst_offset, channel); |
130 | if (result < 0) | 129 | if (result < 0) |
131 | goto out_up; | 130 | return result; |
132 | if (le16_to_cpu(rc->ies->wIELength) > 0) { | 131 | if (le16_to_cpu(rc->ies->wIELength) > 0) { |
133 | result = uwb_rc_set_ie(rc, rc->ies); | 132 | result = uwb_rc_set_ie(rc, rc->ies); |
134 | if (result < 0) { | 133 | if (result < 0) { |
@@ -137,19 +136,14 @@ int uwb_rc_beacon(struct uwb_rc *rc, int channel, unsigned bpst_offset) | |||
137 | result = uwb_rc_stop_beacon(rc); | 136 | result = uwb_rc_stop_beacon(rc); |
138 | channel = -1; | 137 | channel = -1; |
139 | bpst_offset = 0; | 138 | bpst_offset = 0; |
140 | } else | 139 | } |
141 | result = 0; | ||
142 | } | 140 | } |
143 | } | 141 | } |
144 | 142 | ||
145 | if (result < 0) | 143 | if (result >= 0) { |
146 | goto out_up; | 144 | rc->beaconing = channel; |
147 | rc->beaconing = channel; | 145 | uwb_notify(rc, NULL, uwb_bg_joined(rc) ? UWB_NOTIF_BG_JOIN : UWB_NOTIF_BG_LEAVE); |
148 | 146 | } | |
149 | uwb_notify(rc, NULL, uwb_bg_joined(rc) ? UWB_NOTIF_BG_JOIN : UWB_NOTIF_BG_LEAVE); | ||
150 | |||
151 | out_up: | ||
152 | mutex_unlock(&rc->uwb_dev.mutex); | ||
153 | return result; | 147 | return result; |
154 | } | 148 | } |
155 | 149 | ||
@@ -618,9 +612,6 @@ static ssize_t uwb_rc_beacon_show(struct device *dev, | |||
618 | 612 | ||
619 | /* | 613 | /* |
620 | * Start beaconing on the specified channel, or stop beaconing. | 614 | * Start beaconing on the specified channel, or stop beaconing. |
621 | * | ||
622 | * The BPST offset of when to start searching for a beacon group to | ||
623 | * join may be specified. | ||
624 | */ | 615 | */ |
625 | static ssize_t uwb_rc_beacon_store(struct device *dev, | 616 | static ssize_t uwb_rc_beacon_store(struct device *dev, |
626 | struct device_attribute *attr, | 617 | struct device_attribute *attr, |
@@ -629,12 +620,11 @@ static ssize_t uwb_rc_beacon_store(struct device *dev, | |||
629 | struct uwb_dev *uwb_dev = to_uwb_dev(dev); | 620 | struct uwb_dev *uwb_dev = to_uwb_dev(dev); |
630 | struct uwb_rc *rc = uwb_dev->rc; | 621 | struct uwb_rc *rc = uwb_dev->rc; |
631 | int channel; | 622 | int channel; |
632 | unsigned bpst_offset = 0; | ||
633 | ssize_t result = -EINVAL; | 623 | ssize_t result = -EINVAL; |
634 | 624 | ||
635 | result = sscanf(buf, "%d %u\n", &channel, &bpst_offset); | 625 | result = sscanf(buf, "%d", &channel); |
636 | if (result >= 1) | 626 | if (result >= 1) |
637 | result = uwb_rc_beacon(rc, channel, bpst_offset); | 627 | result = uwb_radio_force_channel(rc, channel); |
638 | 628 | ||
639 | return result < 0 ? result : size; | 629 | return result < 0 ? result : size; |
640 | } | 630 | } |