Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e11210d authored by John W. Linville's avatar John W. Linville
Browse files
Conflicts:
	drivers/net/wireless/ath/ath9k/init.c
parents 3bf63e59 c7c18060
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -3323,7 +3323,6 @@ F: drivers/net/wimax/i2400m/
F:	include/linux/wimax/i2400m.h

INTEL WIRELESS WIFI LINK (iwlwifi)
M:	Reinette Chatre <reinette.chatre@intel.com>
M:	Wey-Yi Guy <wey-yi.w.guy@intel.com>
M:	Intel Linux Wireless <ilw@linux.intel.com>
L:	linux-wireless@vger.kernel.org
+20 −55
Original line number Diff line number Diff line
@@ -47,46 +47,40 @@ MODULE_DEVICE_TABLE(usb, ath3k_table);
#define USB_REQ_DFU_DNLOAD	1
#define BULK_SIZE		4096

struct ath3k_data {
	struct usb_device *udev;
	u8 *fw_data;
	u32 fw_size;
	u32 fw_sent;
};

static int ath3k_load_firmware(struct ath3k_data *data,
				unsigned char *firmware,
				int count)
static int ath3k_load_firmware(struct usb_device *udev,
				const struct firmware *firmware)
{
	u8 *send_buf;
	int err, pipe, len, size, sent = 0;
	int count = firmware->size;

	BT_DBG("ath3k %p udev %p", data, data->udev);
	BT_DBG("udev %p", udev);

	pipe = usb_sndctrlpipe(data->udev, 0);
	pipe = usb_sndctrlpipe(udev, 0);

	if ((usb_control_msg(data->udev, pipe,
	send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC);
	if (!send_buf) {
		BT_ERR("Can't allocate memory chunk for firmware");
		return -ENOMEM;
	}

	memcpy(send_buf, firmware->data, 20);
	if ((err = usb_control_msg(udev, pipe,
				USB_REQ_DFU_DNLOAD,
				USB_TYPE_VENDOR, 0, 0,
				firmware, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
				send_buf, 20, USB_CTRL_SET_TIMEOUT)) < 0) {
		BT_ERR("Can't change to loading configuration err");
		return -EBUSY;
		goto error;
	}
	sent += 20;
	count -= 20;

	send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC);
	if (!send_buf) {
		BT_ERR("Can't allocate memory chunk for firmware");
		return -ENOMEM;
	}

	while (count) {
		size = min_t(uint, count, BULK_SIZE);
		pipe = usb_sndbulkpipe(data->udev, 0x02);
		memcpy(send_buf, firmware + sent, size);
		pipe = usb_sndbulkpipe(udev, 0x02);
		memcpy(send_buf, firmware->data + sent, size);

		err = usb_bulk_msg(data->udev, pipe, send_buf, size,
		err = usb_bulk_msg(udev, pipe, send_buf, size,
					&len, 3000);

		if (err || (len != size)) {
@@ -112,57 +106,28 @@ static int ath3k_probe(struct usb_interface *intf,
{
	const struct firmware *firmware;
	struct usb_device *udev = interface_to_usbdev(intf);
	struct ath3k_data *data;
	int size;

	BT_DBG("intf %p id %p", intf, id);

	if (intf->cur_altsetting->desc.bInterfaceNumber != 0)
		return -ENODEV;

	data = kzalloc(sizeof(*data), GFP_KERNEL);
	if (!data)
		return -ENOMEM;

	data->udev = udev;

	if (request_firmware(&firmware, "ath3k-1.fw", &udev->dev) < 0) {
		kfree(data);
		return -EIO;
	}

	size = max_t(uint, firmware->size, 4096);
	data->fw_data = kmalloc(size, GFP_KERNEL);
	if (!data->fw_data) {
	if (ath3k_load_firmware(udev, firmware)) {
		release_firmware(firmware);
		kfree(data);
		return -ENOMEM;
	}

	memcpy(data->fw_data, firmware->data, firmware->size);
	data->fw_size = firmware->size;
	data->fw_sent = 0;
	release_firmware(firmware);

	usb_set_intfdata(intf, data);
	if (ath3k_load_firmware(data, data->fw_data, data->fw_size)) {
		usb_set_intfdata(intf, NULL);
		kfree(data->fw_data);
		kfree(data);
		return -EIO;
	}
	release_firmware(firmware);

	return 0;
}

static void ath3k_disconnect(struct usb_interface *intf)
{
	struct ath3k_data *data = usb_get_intfdata(intf);

	BT_DBG("ath3k_disconnect intf %p", intf);

	kfree(data->fw_data);
	kfree(data);
}

static struct usb_driver ath3k_driver = {
+4 −0
Original line number Diff line number Diff line
@@ -2280,6 +2280,8 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
	int i;
	bool needreset = false;

	mutex_lock(&sc->lock);

	for (i = 0; i < ARRAY_SIZE(sc->txqs); i++) {
		if (sc->txqs[i].setup) {
			txq = &sc->txqs[i];
@@ -2307,6 +2309,8 @@ ath5k_tx_complete_poll_work(struct work_struct *work)
		ath5k_reset(sc, NULL, true);
	}

	mutex_unlock(&sc->lock);

	ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
		msecs_to_jiffies(ATH5K_TX_COMPLETE_POLL_INT));
}
+2 −2
Original line number Diff line number Diff line
@@ -838,9 +838,9 @@ int ath5k_hw_dma_stop(struct ath5k_hw *ah)
	for (i = 0; i < qmax; i++) {
		err = ath5k_hw_stop_tx_dma(ah, i);
		/* -EINVAL -> queue inactive */
		if (err != -EINVAL)
		if (err && err != -EINVAL)
			return err;
	}

	return err;
	return 0;
}
+1 −3
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ int ath5k_hw_get_frame_duration(struct ath5k_hw *ah,
	if (!ah->ah_bwmode) {
		dur = ieee80211_generic_frame_duration(sc->hw,
						NULL, len, rate);
		return dur;
		return le16_to_cpu(dur);
	}

	bitrate = rate->bitrate;
@@ -265,8 +265,6 @@ static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah)
		 * what rate we should choose to TX ACKs. */
		tx_time = ath5k_hw_get_frame_duration(ah, 10, rate);

		tx_time = le16_to_cpu(tx_time);

		ath5k_hw_reg_write(ah, tx_time, reg);

		if (!(rate->flags & IEEE80211_RATE_SHORT_PREAMBLE))
Loading