/* According to WHCI 0.95  the driver will only receive the RCEB of a SET IE command after the device sent the first beacon that includes the IEs specified in the SET IE command. So, after we start beaconing we check if there is anything in the IE cache and call the SET IE command if needed.  */
int uwb_rc_beacon(struct uwb_rc *rc, int channel, unsigned bpst_offset)
/* According to WHCI 0.95  the driver will only receive the RCEB of a SET IE command after the device sent the first beacon that includes the IEs specified in the SET IE command. So, after we start beaconing we check if there is anything in the IE cache and call the SET IE command if needed.  */
int uwb_rc_beacon(struct uwb_rc *rc, int channel, unsigned bpst_offset)
{
	int result;
	struct device *dev = &rc->uwb_dev.dev;
	if (channel < 0)
		channel = -1;
	if (channel == -1)
		result = uwb_rc_stop_beacon(rc);
	else {
		result = uwb_rc_start_beacon(rc, bpst_offset, channel);
		if (result < 0)
			return result;
		if (le16_to_cpu(rc->ies->wIELength) > 0) {
			result = uwb_rc_set_ie(rc, rc->ies);
			if (result < 0) {
				dev_err(dev, "Cannot set new IE on device: "
					"%d\n", result);
				result = uwb_rc_stop_beacon(rc);
				channel = -1;
				bpst_offset = 0;
			}
		}
	}
	if (result >= 0)
		rc->beaconing = channel;
	return result;
}