Staging driver updates for 7.0-rc1

Here is the big set of staging driver updates for 7.0-rc1.  Well, not
 that big, just lots of tiny coding style cleanups primarily in one
 driver as everyone seems to have glomed onto it for some reason that
 escapes me (is there a tutorial out there somewhere pointing people at
 this?)
 
 Not much overall, the changes can be summarized as:
   - cleanups for the rtl8723bs driver, so many cleanups...
   - vme_user driver cleanups
   - sm750fb driver cleanups
   - tiny greybus driver cleanups
   - other really small staging driver cleanups
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCaZR38w8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymwhwCeOZSbZtOU7Atkuyq/0TIhrgDPeMEAn1ce/gcM
 dTsXY6rV7e6gJdhOPa6e
 =3WgI
 -----END PGP SIGNATURE-----

Merge tag 'staging-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
 "Here is the big set of staging driver updates for 7.0-rc1. Well, not
  that big, just lots of tiny coding style cleanups primarily in one
  driver as everyone seems to have glomed onto it for some reason that
  escapes me (is there a tutorial out there somewhere pointing people at
  this?)

  Not much overall, the changes can be summarized as:

   - cleanups for the rtl8723bs driver, so many cleanups...

   - vme_user driver cleanups

   - sm750fb driver cleanups

   - tiny greybus driver cleanups

   - other really small staging driver cleanups

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-7.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (119 commits)
  staging: rtl8723bs: refactor ODM_SetIQCbyRFpath to reduce duplication
  staging: rtl8723bs: rename CamelCase function Set_MSR to set_msr
  staging: rtl8723bs: remove unnecessary blank lines in rtw_io.c
  staging: rtl8723bs: remove stale TODO item regarding %pM
  staging: rtl8723bs: remove unused allocation wrapper functions
  staging: rtl8723bs: use standard skb allocation APIs
  staging: rtl8723bs: replace rtw_zmalloc() with kzalloc()
  staging: rtl8723bs: replace rtw_malloc() with kmalloc()
  staging: rtl8723bs: introduce kmemdup() where applicable
  staging: sm750fb: Clean up variable names
  staging: rtl8723bs: fix null dereference in find_network
  staging: rtl8723bs: use unaligned access macros in rtw_security.c
  staging: rtl8723bs: fix potential race in expire_timeout_chk
  staging: rtl8723bs: remove dead debugging code in rtw_mlme_ext.c
  staging: rtl8723bs: modernize hex output in rtw_report_sec_ie
  staging: rtl8723bs: fix spacing around operators
  staging: rtl8723bs: rename u1bTmp to val
  staging: rtl8723bs: remove unused private debug counters
  staging: rtl8723bs: remove thread wraper functions and add IS_ERR() check
  staging: rtl8723bs: fix firmware memory leak on error
  ...
This commit is contained in:
Linus Torvalds 2026-02-17 09:20:58 -08:00
commit a5f22b9b13
63 changed files with 1133 additions and 1531 deletions

View file

@ -9,11 +9,6 @@
* See Xilinx PG080 document for IP details
*/
/* ----------------------------
* includes
* ----------------------------
*/
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/platform_device.h>
@ -25,20 +20,14 @@
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/moduleparam.h>
#include <linux/interrupt.h>
#include <linux/param.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/uaccess.h>
#include <linux/jiffies.h>
#include <linux/miscdevice.h>
#include <linux/debugfs.h>
/* ----------------------------
* driver parameters
* ----------------------------
*/
#include <linux/poll.h>
#define DRIVER_NAME "axis_fifo"
@ -46,90 +35,51 @@
#define AXIS_FIFO_DEBUG_REG_NAME_MAX_LEN 4
/* ----------------------------
* IP register offsets
* ----------------------------
*/
#define XLLF_ISR_OFFSET 0x00 /* Interrupt Status */
#define XLLF_IER_OFFSET 0x04 /* Interrupt Enable */
#define XLLF_TDFR_OFFSET 0x08 /* Transmit Reset */
#define XLLF_TDFV_OFFSET 0x0c /* Transmit Vacancy */
#define XLLF_TDFD_OFFSET 0x10 /* Transmit Data */
#define XLLF_TLR_OFFSET 0x14 /* Transmit Length */
#define XLLF_RDFR_OFFSET 0x18 /* Receive Reset */
#define XLLF_RDFO_OFFSET 0x1c /* Receive Occupancy */
#define XLLF_RDFD_OFFSET 0x20 /* Receive Data */
#define XLLF_RLR_OFFSET 0x24 /* Receive Length */
#define XLLF_SRR_OFFSET 0x28 /* Local Link Reset */
#define XLLF_TDR_OFFSET 0x2C /* Transmit Destination */
#define XLLF_RDR_OFFSET 0x30 /* Receive Destination */
#define XLLF_ISR_OFFSET 0x00000000 /* Interrupt Status */
#define XLLF_IER_OFFSET 0x00000004 /* Interrupt Enable */
#define XLLF_RDFR_RESET_MASK 0xa5 /* Receive reset value */
#define XLLF_TDFR_RESET_MASK 0xa5 /* Transmit reset value */
#define XLLF_SRR_RESET_MASK 0xa5 /* Local Link reset value */
#define XLLF_TDFR_OFFSET 0x00000008 /* Transmit Reset */
#define XLLF_TDFV_OFFSET 0x0000000c /* Transmit Vacancy */
#define XLLF_TDFD_OFFSET 0x00000010 /* Transmit Data */
#define XLLF_TLR_OFFSET 0x00000014 /* Transmit Length */
#define XLLF_RDFR_OFFSET 0x00000018 /* Receive Reset */
#define XLLF_RDFO_OFFSET 0x0000001c /* Receive Occupancy */
#define XLLF_RDFD_OFFSET 0x00000020 /* Receive Data */
#define XLLF_RLR_OFFSET 0x00000024 /* Receive Length */
#define XLLF_SRR_OFFSET 0x00000028 /* Local Link Reset */
#define XLLF_TDR_OFFSET 0x0000002C /* Transmit Destination */
#define XLLF_RDR_OFFSET 0x00000030 /* Receive Destination */
/* ----------------------------
* reset register masks
* ----------------------------
*/
#define XLLF_RDFR_RESET_MASK 0x000000a5 /* receive reset value */
#define XLLF_TDFR_RESET_MASK 0x000000a5 /* Transmit reset value */
#define XLLF_SRR_RESET_MASK 0x000000a5 /* Local Link reset value */
/* ----------------------------
* interrupt masks
* ----------------------------
*/
#define XLLF_INT_RPURE_MASK 0x80000000 /* Receive under-read */
#define XLLF_INT_RPORE_MASK 0x40000000 /* Receive over-read */
#define XLLF_INT_RPUE_MASK 0x20000000 /* Receive underrun (empty) */
#define XLLF_INT_TPOE_MASK 0x10000000 /* Transmit overrun */
#define XLLF_INT_TC_MASK 0x08000000 /* Transmit complete */
#define XLLF_INT_RC_MASK 0x04000000 /* Receive complete */
#define XLLF_INT_TSE_MASK 0x02000000 /* Transmit length mismatch */
#define XLLF_INT_RPURE_MASK BIT(31) /* Receive under-read */
#define XLLF_INT_RPORE_MASK BIT(30) /* Receive over-read */
#define XLLF_INT_RPUE_MASK BIT(29) /* Receive underrun (empty) */
#define XLLF_INT_TPOE_MASK BIT(28) /* Transmit overrun */
#define XLLF_INT_TC_MASK BIT(27) /* Transmit complete */
#define XLLF_INT_RC_MASK BIT(26) /* Receive complete */
#define XLLF_INT_TSE_MASK BIT(25) /* Transmit length mismatch */
#define XLLF_INT_CLEAR_ALL GENMASK(31, 0)
/* ----------------------------
* globals
* ----------------------------
*/
static long read_timeout = 1000; /* ms to wait before read() times out */
static long write_timeout = 1000; /* ms to wait before write() times out */
static DEFINE_IDA(axis_fifo_ida);
/* ----------------------------
* module command-line arguments
* ----------------------------
*/
module_param(read_timeout, long, 0444);
MODULE_PARM_DESC(read_timeout, "ms to wait before blocking read() timing out; set to -1 for no timeout");
module_param(write_timeout, long, 0444);
MODULE_PARM_DESC(write_timeout, "ms to wait before blocking write() timing out; set to -1 for no timeout");
/* ----------------------------
* types
* ----------------------------
*/
struct axis_fifo {
int id;
void __iomem *base_addr; /* kernel space memory */
void __iomem *base_addr;
unsigned int rx_fifo_depth; /* max words in the receive fifo */
unsigned int tx_fifo_depth; /* max words in the transmit fifo */
int has_rx_fifo; /* whether the IP has the rx fifo enabled */
int has_tx_fifo; /* whether the IP has the tx fifo enabled */
unsigned int rx_fifo_depth;
unsigned int tx_fifo_depth;
int has_rx_fifo;
int has_tx_fifo;
wait_queue_head_t read_queue; /* wait queue for asynchronos read */
wait_queue_head_t read_queue;
struct mutex read_lock; /* lock for reading */
wait_queue_head_t write_queue; /* wait queue for asynchronos write */
wait_queue_head_t write_queue;
struct mutex write_lock; /* lock for writing */
struct device *dt_device; /* device created from the device tree */
struct device *dt_device;
struct miscdevice miscdev;
struct dentry *debugfs_dir;
@ -140,11 +90,6 @@ struct axis_fifo_debug_reg {
unsigned int offset;
};
/* ----------------------------
* implementation
* ----------------------------
*/
static void reset_ip_core(struct axis_fifo *fifo)
{
iowrite32(XLLF_SRR_RESET_MASK, fifo->base_addr + XLLF_SRR_OFFSET);
@ -175,7 +120,7 @@ static void reset_ip_core(struct axis_fifo *fifo)
static ssize_t axis_fifo_read(struct file *f, char __user *buf,
size_t len, loff_t *off)
{
struct axis_fifo *fifo = (struct axis_fifo *)f->private_data;
struct axis_fifo *fifo = f->private_data;
size_t bytes_available;
unsigned int words_available;
unsigned int copied;
@ -185,10 +130,6 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,
u32 tmp_buf[READ_BUF_SIZE];
if (f->f_flags & O_NONBLOCK) {
/*
* Device opened in non-blocking mode. Try to lock it and then
* check if any packet is available.
*/
if (!mutex_trylock(&fifo->read_lock))
return -EAGAIN;
@ -197,38 +138,18 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,
goto end_unlock;
}
} else {
/* opened in blocking mode
* wait for a packet available interrupt (or timeout)
* if nothing is currently available
*/
mutex_lock(&fifo->read_lock);
ret = wait_event_interruptible_timeout(fifo->read_queue,
ioread32(fifo->base_addr + XLLF_RDFO_OFFSET),
read_timeout);
if (ret <= 0) {
if (ret == 0) {
ret = -EAGAIN;
} else if (ret != -ERESTARTSYS) {
dev_err(fifo->dt_device, "wait_event_interruptible_timeout() error in read (ret=%i)\n",
ret);
}
ret = wait_event_interruptible(fifo->read_queue,
ioread32(fifo->base_addr + XLLF_RDFO_OFFSET));
if (ret)
goto end_unlock;
}
}
bytes_available = ioread32(fifo->base_addr + XLLF_RLR_OFFSET);
words_available = bytes_available / sizeof(u32);
if (!bytes_available) {
dev_err(fifo->dt_device, "received a packet of length 0\n");
ret = -EIO;
goto end_unlock;
}
if (bytes_available > len) {
dev_err(fifo->dt_device, "user read buffer too small (available bytes=%zu user buffer bytes=%zu)\n",
bytes_available, len);
ret = -EINVAL;
goto err_flush_rx;
}
@ -242,9 +163,6 @@ static ssize_t axis_fifo_read(struct file *f, char __user *buf,
goto err_flush_rx;
}
/* read data into an intermediate buffer, copying the contents
* to userspace when the buffer is full
*/
copied = 0;
while (words_available > 0) {
copy = min(words_available, READ_BUF_SIZE);
@ -295,25 +213,13 @@ end_unlock:
static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
size_t len, loff_t *off)
{
struct axis_fifo *fifo = (struct axis_fifo *)f->private_data;
struct axis_fifo *fifo = f->private_data;
unsigned int words_to_write;
u32 *txbuf;
int ret;
if (len % sizeof(u32)) {
dev_err(fifo->dt_device,
"tried to send a packet that isn't word-aligned\n");
return -EINVAL;
}
words_to_write = len / sizeof(u32);
if (!words_to_write) {
dev_err(fifo->dt_device,
"tried to send a packet of length 0\n");
return -EINVAL;
}
/*
* In 'Store-and-Forward' mode, the maximum packet that can be
* transmitted is limited by the size of the FIFO, which is
@ -323,14 +229,11 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
* otherwise a 'Transmit Packet Overrun Error' interrupt will be
* raised, which requires a reset of the TX circuit to recover.
*/
if (words_to_write > (fifo->tx_fifo_depth - 4))
if (!words_to_write || (len % sizeof(u32)) ||
(words_to_write > (fifo->tx_fifo_depth - 4)))
return -EINVAL;
if (f->f_flags & O_NONBLOCK) {
/*
* Device opened in non-blocking mode. Try to lock it and then
* check if there is any room to write the given buffer.
*/
if (!mutex_trylock(&fifo->write_lock))
return -EAGAIN;
@ -340,27 +243,12 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
goto end_unlock;
}
} else {
/* opened in blocking mode */
/* wait for an interrupt (or timeout) if there isn't
* currently enough room in the fifo
*/
mutex_lock(&fifo->write_lock);
ret = wait_event_interruptible_timeout(fifo->write_queue,
ioread32(fifo->base_addr + XLLF_TDFV_OFFSET)
>= words_to_write,
write_timeout);
if (ret <= 0) {
if (ret == 0) {
ret = -EAGAIN;
} else if (ret != -ERESTARTSYS) {
dev_err(fifo->dt_device, "wait_event_interruptible_timeout() error in write (ret=%i)\n",
ret);
}
ret = wait_event_interruptible(fifo->write_queue,
ioread32(fifo->base_addr + XLLF_TDFV_OFFSET) >= words_to_write);
if (ret)
goto end_unlock;
}
}
txbuf = vmemdup_user(buf, len);
@ -372,7 +260,6 @@ static ssize_t axis_fifo_write(struct file *f, const char __user *buf,
for (int i = 0; i < words_to_write; ++i)
iowrite32(txbuf[i], fifo->base_addr + XLLF_TDFD_OFFSET);
/* write packet size to fifo */
iowrite32(len, fifo->base_addr + XLLF_TLR_OFFSET);
ret = len;
@ -383,6 +270,28 @@ end_unlock:
return ret;
}
static __poll_t axis_fifo_poll(struct file *f, poll_table *wait)
{
struct axis_fifo *fifo = f->private_data;
__poll_t mask = 0;
if (fifo->has_rx_fifo) {
poll_wait(f, &fifo->read_queue, wait);
if (ioread32(fifo->base_addr + XLLF_RDFO_OFFSET))
mask |= EPOLLIN | EPOLLRDNORM;
}
if (fifo->has_tx_fifo) {
poll_wait(f, &fifo->write_queue, wait);
if (ioread32(fifo->base_addr + XLLF_TDFV_OFFSET))
mask |= EPOLLOUT | EPOLLWRNORM;
}
return mask;
}
static irqreturn_t axis_fifo_irq(int irq, void *dw)
{
struct axis_fifo *fifo = dw;
@ -436,19 +345,12 @@ static int axis_fifo_open(struct inode *inod, struct file *f)
return 0;
}
static int axis_fifo_close(struct inode *inod, struct file *f)
{
f->private_data = NULL;
return 0;
}
static const struct file_operations fops = {
.owner = THIS_MODULE,
.open = axis_fifo_open,
.release = axis_fifo_close,
.read = axis_fifo_read,
.write = axis_fifo_write
.write = axis_fifo_write,
.poll = axis_fifo_poll,
};
static int axis_fifo_debugfs_regs_show(struct seq_file *m, void *p)
@ -548,23 +450,12 @@ end:
static int axis_fifo_probe(struct platform_device *pdev)
{
struct resource *r_mem; /* IO mem resources */
struct device *dev = &pdev->dev; /* OS device (from device tree) */
struct resource *r_mem;
struct device *dev = &pdev->dev;
struct axis_fifo *fifo = NULL;
char *device_name;
int rc = 0; /* error return value */
int irq;
/* ----------------------------
* init wrapper device
* ----------------------------
*/
device_name = devm_kzalloc(dev, 32, GFP_KERNEL);
if (!device_name)
return -ENOMEM;
/* allocate device wrapper memory */
fifo = devm_kzalloc(dev, sizeof(*fifo), GFP_KERNEL);
if (!fifo)
return -ENOMEM;
@ -578,38 +469,20 @@ static int axis_fifo_probe(struct platform_device *pdev)
mutex_init(&fifo->read_lock);
mutex_init(&fifo->write_lock);
/* ----------------------------
* init device memory space
* ----------------------------
*/
/* get iospace for the device and request physical memory */
fifo->base_addr = devm_platform_get_and_ioremap_resource(pdev, 0, &r_mem);
if (IS_ERR(fifo->base_addr))
return PTR_ERR(fifo->base_addr);
/* ----------------------------
* init IP
* ----------------------------
*/
rc = axis_fifo_parse_dt(fifo);
if (rc)
return rc;
reset_ip_core(fifo);
/* ----------------------------
* init device interrupts
* ----------------------------
*/
/* get IRQ resource */
irq = platform_get_irq(pdev, 0);
if (irq < 0)
return irq;
/* request IRQ */
rc = devm_request_irq(fifo->dt_device, irq, &axis_fifo_irq, 0,
DRIVER_NAME, fifo);
if (rc) {
@ -618,21 +491,20 @@ static int axis_fifo_probe(struct platform_device *pdev)
return rc;
}
/* ----------------------------
* init char device
* ----------------------------
*/
fifo->id = ida_alloc(&axis_fifo_ida, GFP_KERNEL);
if (fifo->id < 0)
return fifo->id;
snprintf(device_name, 32, "%s%d", DRIVER_NAME, fifo->id);
/* create character device */
fifo->miscdev.fops = &fops;
fifo->miscdev.minor = MISC_DYNAMIC_MINOR;
fifo->miscdev.name = device_name;
fifo->miscdev.parent = dev;
fifo->miscdev.name = devm_kasprintf(dev, GFP_KERNEL, "%s%d",
DRIVER_NAME, fifo->id);
if (!fifo->miscdev.name) {
ida_free(&axis_fifo_ida, fifo->id);
return -ENOMEM;
}
rc = misc_register(&fifo->miscdev);
if (rc < 0) {
ida_free(&axis_fifo_ida, fifo->id);
@ -673,18 +545,6 @@ static struct platform_driver axis_fifo_driver = {
static int __init axis_fifo_init(void)
{
if (read_timeout >= 0)
read_timeout = msecs_to_jiffies(read_timeout);
else
read_timeout = MAX_SCHEDULE_TIMEOUT;
if (write_timeout >= 0)
write_timeout = msecs_to_jiffies(write_timeout);
else
write_timeout = MAX_SCHEDULE_TIMEOUT;
pr_info("axis-fifo driver loaded with parameters read_timeout = %li, write_timeout = %li\n",
read_timeout, write_timeout);
return platform_driver_register(&axis_fifo_driver);
}

View file

@ -1,5 +0,0 @@
* Convert all uses of the old GPIO API from <linux/gpio.h> to the
GPIO descriptor API in <linux/gpio/consumer.h> and look up GPIO
lines from device tree or ACPI.
* Make pwm.c use the struct pwm_ops::apply instead of ::config, ::set_polarity,
::enable and ::disable.

View file

@ -10,13 +10,14 @@
#include <linux/delay.h>
#include <linux/gpio/consumer.h>
#include <linux/interrupt.h>
#include <linux/of_irq.h>
#include <linux/module.h>
#include <linux/pinctrl/consumer.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>
#include <linux/spinlock.h>
#include <linux/mod_devicetable.h>
#include "arche_platform.h"
static void apb_bootret_deassert(struct device *dev);
@ -314,8 +315,8 @@ static ssize_t state_show(struct device *dev,
static DEVICE_ATTR_RW(state);
static int apb_ctrl_get_devtree_data(struct platform_device *pdev,
struct arche_apb_ctrl_drvdata *apb)
static int apb_ctrl_get_fw_data(struct platform_device *pdev,
struct arche_apb_ctrl_drvdata *apb)
{
struct device *dev = &pdev->dev;
int ret;
@ -378,7 +379,7 @@ static int apb_ctrl_get_devtree_data(struct platform_device *pdev,
}
/* Only applicable for platform >= V2 */
if (of_property_read_bool(pdev->dev.of_node, "gb,spi-en-active-high"))
if (device_property_read_bool(&pdev->dev, "gb,spi-en-active-high"))
apb->spi_en_polarity_high = true;
return 0;
@ -394,7 +395,7 @@ static int arche_apb_ctrl_probe(struct platform_device *pdev)
if (!apb)
return -ENOMEM;
ret = apb_ctrl_get_devtree_data(pdev, apb);
ret = apb_ctrl_get_fw_data(pdev, apb);
if (ret) {
dev_err(dev, "failed to get apb devicetree data %d\n", ret);
return ret;
@ -403,7 +404,7 @@ static int arche_apb_ctrl_probe(struct platform_device *pdev)
/* Initially set APB to OFF state */
apb->state = ARCHE_PLATFORM_STATE_OFF;
/* Check whether device needs to be enabled on boot */
if (of_property_read_bool(pdev->dev.of_node, "arche,init-disable"))
if (device_property_read_bool(&pdev->dev, "arche,init-disable"))
apb->init_disabled = true;
platform_set_drvdata(pdev, apb);

View file

@ -523,10 +523,9 @@ static int arche_platform_probe(struct platform_device *pdev)
arche_pdata->pm_notifier.notifier_call = arche_platform_pm_notifier;
ret = register_pm_notifier(&arche_pdata->pm_notifier);
if (ret) {
dev_err(dev, "failed to register pm notifier %d\n", ret);
goto err_device_remove;
goto err_depopulate;
}
/* Explicitly power off if requested */
@ -534,8 +533,9 @@ static int arche_platform_probe(struct platform_device *pdev)
mutex_lock(&arche_pdata->platform_state_mutex);
ret = arche_platform_coldboot_seq(arche_pdata);
if (ret) {
mutex_unlock(&arche_pdata->platform_state_mutex);
dev_err(dev, "Failed to cold boot svc %d\n", ret);
goto err_coldboot;
goto err_unregister_pm_notifier;
}
arche_platform_wd_irq_en(arche_pdata);
mutex_unlock(&arche_pdata->platform_state_mutex);
@ -544,29 +544,22 @@ static int arche_platform_probe(struct platform_device *pdev)
dev_info(dev, "Device registered successfully\n");
return 0;
err_coldboot:
mutex_unlock(&arche_pdata->platform_state_mutex);
err_unregister_pm_notifier:
unregister_pm_notifier(&arche_pdata->pm_notifier);
err_depopulate:
of_platform_depopulate(dev);
err_device_remove:
device_remove_file(&pdev->dev, &dev_attr_state);
return ret;
}
static int arche_remove_child(struct device *dev, void *unused)
{
struct platform_device *pdev = to_platform_device(dev);
platform_device_unregister(pdev);
return 0;
}
static void arche_platform_remove(struct platform_device *pdev)
{
struct arche_platform_drvdata *arche_pdata = platform_get_drvdata(pdev);
unregister_pm_notifier(&arche_pdata->pm_notifier);
device_remove_file(&pdev->dev, &dev_attr_state);
device_for_each_child(&pdev->dev, NULL, arche_remove_child);
of_platform_depopulate(&pdev->dev);
arche_platform_poweroff_seq(arche_pdata);
if (usb3613_hub_mode_ctrl(false))
@ -576,10 +569,10 @@ static void arche_platform_remove(struct platform_device *pdev)
static __maybe_unused int arche_platform_suspend(struct device *dev)
{
/*
* If timing profile premits, we may shutdown bridge
* If timing profile permits, we may shutdown bridge
* completely
*
* TODO: sequence ??
* TODO: define shutdown sequence
*
* Also, need to make sure we meet precondition for unipro suspend
* Precondition: Definition ???

View file

@ -10,9 +10,9 @@
#include <linux/v4l2-mediabus.h>
/* Input flags need to be set from the caller */
#define GB_CAMERA_IN_FLAG_TEST (1 << 0)
#define GB_CAMERA_IN_FLAG_TEST BIT(0)
/* Output flags returned */
#define GB_CAMERA_OUT_FLAG_ADJUSTED (1 << 0)
#define GB_CAMERA_OUT_FLAG_ADJUSTED BIT(0)
/**
* struct gb_camera_stream - Represents greybus camera stream.
@ -89,8 +89,9 @@ struct gb_camera_csi_params {
struct gb_camera_ops {
ssize_t (*capabilities)(void *priv, char *buf, size_t len);
int (*configure_streams)(void *priv, unsigned int *nstreams,
unsigned int *flags, struct gb_camera_stream *streams,
struct gb_camera_csi_params *csi_params);
unsigned int *flags,
struct gb_camera_stream *streams,
struct gb_camera_csi_params *csi_params);
int (*capture)(void *priv, u32 request_id,
unsigned int streams, unsigned int num_frames,
size_t settings_size, const void *settings);

View file

@ -1008,14 +1008,18 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id)
if (!strlen(conf.name))
return -EINVAL;
light->channels_count = conf.channel_count;
light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL);
if (!light->name)
return -ENOMEM;
light->channels = kcalloc(light->channels_count,
light->channels = kcalloc(conf.channel_count,
sizeof(struct gb_channel), GFP_KERNEL);
if (!light->channels)
return -ENOMEM;
/*
* Publish channels_count only after channels allocation so cleanup
* doesn't walk a NULL channels pointer on allocation failure.
*/
light->channels_count = conf.channel_count;
/* First we collect all the configurations for all channels */
for (i = 0; i < light->channels_count; i++) {

View file

@ -806,7 +806,7 @@ static int gb_sdio_probe(struct gbphy_device *gbphy_dev,
mutex_init(&host->lock);
spin_lock_init(&host->xfer);
host->mrq_workqueue = alloc_workqueue("mmc-%s", 0, 1,
host->mrq_workqueue = alloc_workqueue("mmc-%s", WQ_PERCPU, 1,
dev_name(&gbphy_dev->dev));
if (!host->mrq_workqueue) {
ret = -ENOMEM;

View file

@ -113,10 +113,12 @@ static inline struct dim2_hdm *iface_to_hdm(struct most_interface *iface)
return container_of(iface, struct dim2_hdm, most_iface);
}
/* Macro to identify a network status message */
#define PACKET_IS_NET_INFO(p) \
(((p)[1] == 0x18) && ((p)[2] == 0x05) && ((p)[3] == 0x0C) && \
((p)[13] == 0x3C) && ((p)[14] == 0x00) && ((p)[15] == 0x0A))
/* Identify a network status message */
static bool packet_is_net_info(const u8 *p)
{
return p[1] == 0x18 && p[2] == 0x05 && p[3] == 0x0C &&
p[13] == 0x3C && p[14] == 0x00 && p[15] == 0x0A;
}
static ssize_t state_show(struct device *dev, struct device_attribute *attr,
char *buf)
@ -304,7 +306,7 @@ static void service_done_flag(struct dim2_hdm *dev, int ch_idx)
if (hdm_ch->data_type == MOST_CH_ASYNC &&
hdm_ch->direction == MOST_CH_RX &&
PACKET_IS_NET_INFO(data)) {
packet_is_net_info(data)) {
retrieve_netinfo(dev, mbo);
spin_lock_irqsave(&dim_lock, flags);

View file

@ -121,6 +121,7 @@ static int comp_vdev_close(struct file *filp)
struct comp_fh *fh = to_comp_fh(filp);
struct most_video_dev *mdev = fh->mdev;
struct mbo *mbo, *tmp;
LIST_HEAD(free_list);
/*
* We need to put MBOs back before we call most_stop_channel()
@ -133,13 +134,14 @@ static int comp_vdev_close(struct file *filp)
spin_lock_irq(&mdev->list_lock);
mdev->mute = true;
list_for_each_entry_safe(mbo, tmp, &mdev->pending_mbos, list) {
list_del(&mbo->list);
spin_unlock_irq(&mdev->list_lock);
most_put_mbo(mbo);
spin_lock_irq(&mdev->list_lock);
}
list_replace_init(&mdev->pending_mbos, &free_list);
spin_unlock_irq(&mdev->list_lock);
list_for_each_entry_safe(mbo, tmp, &free_list, list) {
list_del_init(&mbo->list);
most_put_mbo(mbo);
}
most_stop_channel(mdev->iface, mdev->ch_idx, &comp);
mdev->mute = false;
@ -554,6 +556,7 @@ static int __init comp_init(void)
static void __exit comp_exit(void)
{
struct most_video_dev *mdev, *tmp;
LIST_HEAD(free_list);
/*
* As the mostcore currently doesn't call disconnect_channel()
@ -562,16 +565,15 @@ static void __exit comp_exit(void)
* This must be fixed in core.
*/
spin_lock_irq(&list_lock);
list_for_each_entry_safe(mdev, tmp, &video_devices, list) {
list_del(&mdev->list);
spin_unlock_irq(&list_lock);
list_replace_init(&video_devices, &free_list);
spin_unlock_irq(&list_lock);
list_for_each_entry_safe(mdev, tmp, &free_list, list) {
list_del_init(&mdev->list);
comp_unregister_videodev(mdev);
v4l2_device_disconnect(&mdev->v4l2_dev);
v4l2_device_put(&mdev->v4l2_dev);
spin_lock_irq(&list_lock);
}
spin_unlock_irq(&list_lock);
most_deregister_configfs_subsys(&comp);
most_deregister_component(&comp);

View file

@ -648,7 +648,6 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
break;
case 2: /* first byte after command */
if (status == (I2C_SL_IRQ | RNW | RCVD)) {
udelay(33);
if (nvec->rx->data[0] != 0x01) {
dev_err(nvec->dev,
"Read without prior read command\n");
@ -660,6 +659,9 @@ static irqreturn_t nvec_interrupt(int irq, void *dev)
nvec_tx_set(nvec);
to_send = nvec->tx->data[0];
nvec->tx->pos = 1;
/* delay ACK due to AP20 HW Bug
do not replace by usleep_range */
udelay(33);
} else if (status == (I2C_SL_IRQ)) {
nvec->rx->data[1] = received;
nvec->rx->pos = 2;

View file

@ -3,9 +3,9 @@ config RTL8723BS
tristate "Realtek RTL8723BS SDIO Wireless LAN NIC driver"
depends on WLAN && MMC && CFG80211
depends on m
select CRYPTO
select CRYPTO_LIB_AES
select CRYPTO_LIB_ARC4
select CRYPTO_LIB_UTILS
help
This option enables support for RTL8723BS SDIO drivers, such as
the wifi found on the 1st gen Intel Compute Stick, the CHIP

View file

@ -1,7 +1,6 @@
TODO:
- find and remove any code for other chips that is left over
- convert any remaining unusual variable types
- find codes that can use %pM and %Nph formatting
- checkpatch.pl fixes - most of the remaining ones are lines too long. Many
of them will require refactoring
- merge Realtek's bugfixes and new features into the driver

View file

@ -114,11 +114,8 @@ static void update_BCNTIM(struct adapter *padapter)
dst_ie = pie + offset;
}
if (remainder_ielen > 0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
}
if (premainder_ie && remainder_ielen)
pbackup_remainder_ie = kmemdup(premainder_ie, remainder_ielen, GFP_ATOMIC);
*dst_ie++ = WLAN_EID_TIM;
@ -178,6 +175,8 @@ void expire_timeout_chk(struct adapter *padapter)
struct sta_priv *pstapriv = &padapter->stapriv;
u8 chk_alive_num = 0;
char chk_alive_list[NUM_STA];
struct sta_info *psta_tmp;
LIST_HEAD(free_list);
int i;
spin_lock_bh(&pstapriv->auth_list_lock);
@ -190,19 +189,19 @@ void expire_timeout_chk(struct adapter *padapter)
if (psta->expire_to > 0) {
psta->expire_to--;
if (psta->expire_to == 0) {
list_del_init(&psta->auth_list);
list_move(&psta->auth_list, &free_list);
pstapriv->auth_list_cnt--;
spin_unlock_bh(&pstapriv->auth_list_lock);
rtw_free_stainfo(padapter, psta);
spin_lock_bh(&pstapriv->auth_list_lock);
}
}
}
spin_unlock_bh(&pstapriv->auth_list_lock);
list_for_each_entry_safe(psta, psta_tmp, &free_list, auth_list) {
list_del_init(&psta->auth_list);
rtw_free_stainfo(padapter, psta);
}
psta = NULL;
spin_lock_bh(&pstapriv->asoc_list_lock);
@ -318,9 +317,9 @@ void expire_timeout_chk(struct adapter *padapter)
associated_clients_update(padapter, updated);
}
void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
void add_ratid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
{
unsigned char sta_band = 0, shortGIrate = false;
unsigned char sta_band = 0, short_gi_rate = false;
unsigned int tx_ra_bitmap = 0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex
@ -335,7 +334,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
rtw_hal_update_sta_rate_mask(padapter, psta);
tx_ra_bitmap = psta->ra_mask;
shortGIrate = query_ra_short_GI(psta);
short_gi_rate = query_ra_short_GI(psta);
if (pcur_network->configuration.ds_config > 14) {
sta_band |= WIRELESS_INVALID;
@ -358,7 +357,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
arg[0] = psta->mac_id;
arg[1] = psta->raid;
arg[2] = shortGIrate;
arg[2] = short_gi_rate;
arg[3] = psta->init_rate;
rtw_hal_add_ra_tid(padapter, tx_ra_bitmap, arg, rssi_level);
@ -368,7 +367,7 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level)
void update_bmc_sta(struct adapter *padapter)
{
unsigned char network_type;
int supportRateNum = 0;
int support_rate_num = 0;
unsigned int tx_ra_bitmap = 0;
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
@ -391,10 +390,10 @@ void update_bmc_sta(struct adapter *padapter)
memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
/* prepare for add_RATid */
supportRateNum = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
/* prepare for add_ratid */
support_rate_num = rtw_get_rateset_len((u8 *)&pcur_network->supported_rates);
network_type = rtw_check_network_type((u8 *)&pcur_network->supported_rates,
supportRateNum,
support_rate_num,
pcur_network->configuration.ds_config
);
if (is_supported_tx_cck(network_type)) {
@ -549,7 +548,7 @@ void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
memset((void *)&psta->sta_stats, 0, sizeof(struct stainfo_stats));
/* add ratid */
/* add_RATid(padapter, psta);//move to ap_sta_info_defer_update() */
/* add_ratid(padapter, psta); move to ap_sta_info_defer_update() */
spin_lock_bh(&psta->lock);
psta->state |= _FW_LINKED;
@ -688,7 +687,7 @@ void start_bss_network(struct adapter *padapter)
}
/* set MSR to AP_Mode */
Set_MSR(padapter, _HW_STATE_AP_);
set_msr(padapter, _HW_STATE_AP_);
/* Set BSSID REG */
rtw_hal_set_hwreg(padapter, HW_VAR_BSSID, pnetwork->mac_address);
@ -807,8 +806,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
u16 cap, ht_cap = false;
uint ie_len = 0;
int group_cipher, pairwise_cipher;
u8 channel, network_type, supportRate[NDIS_802_11_LENGTH_RATES_EX];
int supportRateNum = 0;
u8 channel, network_type, support_rate[NDIS_802_11_LENGTH_RATES_EX];
int support_rate_num = 0;
u8 OUI1[] = {0x00, 0x50, 0xf2, 0x01};
u8 WMM_PARA_IE[] = {0x00, 0x50, 0xf2, 0x02, 0x01, 0x01};
struct registry_priv *pregistrypriv = &padapter->registrypriv;
@ -870,15 +869,15 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
pbss_network->configuration.ds_config = channel;
memset(supportRate, 0, NDIS_802_11_LENGTH_RATES_EX);
memset(support_rate, 0, NDIS_802_11_LENGTH_RATES_EX);
/* get supported rates */
p = rtw_get_ie(ie + _BEACON_IE_OFFSET_,
WLAN_EID_SUPP_RATES,
&ie_len,
(pbss_network->ie_length - _BEACON_IE_OFFSET_));
if (p) {
memcpy(supportRate, p + 2, ie_len);
supportRateNum = ie_len;
memcpy(support_rate, p + 2, ie_len);
support_rate_num = ie_len;
}
/* get ext_supported rates */
@ -887,11 +886,11 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len)
&ie_len,
pbss_network->ie_length - _BEACON_IE_OFFSET_);
if (p) {
memcpy(supportRate + supportRateNum, p + 2, ie_len);
supportRateNum += ie_len;
memcpy(support_rate + support_rate_num, p + 2, ie_len);
support_rate_num += ie_len;
}
network_type = rtw_check_network_type(supportRate, supportRateNum, channel);
network_type = rtw_check_network_type(support_rate, support_rate_num, channel);
rtw_set_supported_rate(pbss_network->supported_rates, network_type);
@ -1230,13 +1229,13 @@ u8 rtw_ap_set_pairwise_key(struct adapter *padapter, struct sta_info *psta)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
if (!ph2c) {
res = _FAIL;
goto exit;
}
psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
psetstakey_para = kzalloc(sizeof(*psetstakey_para), GFP_KERNEL);
if (!psetstakey_para) {
kfree(ph2c);
res = _FAIL;
@ -1270,12 +1269,12 @@ static int rtw_ap_set_key(struct adapter *padapter,
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
int res = _SUCCESS;
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL);
if (!pcmd) {
res = _FAIL;
goto exit;
}
psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm));
psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_KERNEL);
if (!psetkeyparm) {
kfree(pcmd);
res = _FAIL;
@ -1440,11 +1439,8 @@ static void update_bcn_wps_ie(struct adapter *padapter)
remainder_ielen = ielen - wps_offset - wps_ielen;
if (remainder_ielen > 0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie)
memcpy(pbackup_remainder_ie, premainder_ie, remainder_ielen);
}
if (premainder_ie && remainder_ielen)
pbackup_remainder_ie = kmemdup(premainder_ie, remainder_ielen, GFP_ATOMIC);
wps_ielen = (uint)pwps_ie_src[1];/* to get ie data len */
if ((wps_offset + wps_ielen + 2 + remainder_ielen) <= MAX_IE_SZ) {
@ -1947,7 +1943,7 @@ void ap_sta_info_defer_update(struct adapter *padapter, struct sta_info *psta)
pmlmeinfo->FW_sta_info[psta->mac_id].psta = psta;
/* add ratid */
add_RATid(padapter, psta, 0);/* DM_RATR_STA_INIT */
add_ratid(padapter, psta, 0);/* DM_RATR_STA_INIT */
}
}

View file

@ -7,6 +7,7 @@
#include <drv_types.h>
#include <hal_btcoex.h>
#include <linux/jiffies.h>
#include <linux/align.h>
static struct _cmd_callback rtw_cmd_callback[] = {
{GEN_CMD_CODE(_Read_MACREG), NULL}, /*0*/
@ -170,21 +171,19 @@ int rtw_init_cmd_priv(struct cmd_priv *pcmdpriv)
pcmdpriv->cmd_seq = 1;
pcmdpriv->cmd_allocated_buf = rtw_zmalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ);
pcmdpriv->cmd_allocated_buf = kzalloc(MAX_CMDSZ + CMDBUFF_ALIGN_SZ, GFP_ATOMIC);
if (!pcmdpriv->cmd_allocated_buf)
return -ENOMEM;
pcmdpriv->cmd_buf = pcmdpriv->cmd_allocated_buf + CMDBUFF_ALIGN_SZ - ((SIZE_PTR)(pcmdpriv->cmd_allocated_buf) & (CMDBUFF_ALIGN_SZ-1));
pcmdpriv->rsp_allocated_buf = rtw_zmalloc(MAX_RSPSZ + 4);
pcmdpriv->cmd_buf = PTR_ALIGN(pcmdpriv->cmd_allocated_buf, CMDBUFF_ALIGN_SZ);
pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_ATOMIC);
if (!pcmdpriv->rsp_allocated_buf) {
kfree(pcmdpriv->cmd_allocated_buf);
return -ENOMEM;
}
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
pcmdpriv->rsp_buf = pcmdpriv->rsp_allocated_buf + 4 - ((SIZE_PTR)(pcmdpriv->rsp_allocated_buf) & 3);
pcmdpriv->cmd_issued_cnt = 0;
pcmdpriv->cmd_done_cnt = 0;
@ -204,7 +203,7 @@ int rtw_init_evt_priv(struct evt_priv *pevtpriv)
_init_workitem(&pevtpriv->c2h_wk, c2h_wk_callback, NULL);
pevtpriv->c2h_wk_alive = false;
pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN+1);
pevtpriv->c2h_queue = rtw_cbuf_alloc(C2H_QUEUE_MAX_LEN + 1);
if (!pevtpriv->c2h_queue)
return -ENOMEM;
@ -305,7 +304,7 @@ int rtw_cmd_filter(struct cmd_priv *pcmdpriv, struct cmd_obj *cmd_obj)
bAllow = true;
if ((!pcmdpriv->padapter->hw_init_completed && !bAllow) ||
!atomic_read(&pcmdpriv->cmdthd_running)) /* com_thread not running */
!atomic_read(&pcmdpriv->cmdthd_running)) /* com_thread not running */
return _FAIL;
return _SUCCESS;
@ -363,7 +362,7 @@ void rtw_free_cmd_obj(struct cmd_obj *pcmd)
void rtw_stop_cmd_thread(struct adapter *adapter)
{
if (adapter->cmdThread &&
atomic_read(&adapter->cmdpriv.cmdthd_running) &&
atomic_read(&adapter->cmdpriv.cmdthd_running) &&
adapter->cmdpriv.stop_req == 0) {
adapter->cmdpriv.stop_req = 1;
complete(&adapter->cmdpriv.cmd_queue_comp);
@ -523,7 +522,7 @@ post_process:
*/
u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid, int ssid_num,
struct rtw_ieee80211_channel *ch, int ch_num)
struct rtw_ieee80211_channel *ch, int ch_num)
{
u8 res = _FAIL;
struct cmd_obj *ph2c;
@ -534,11 +533,11 @@ u8 rtw_sitesurvey_cmd(struct adapter *padapter, struct ndis_802_11_ssid *ssid,
if (check_fwstate(pmlmepriv, _FW_LINKED))
rtw_lps_ctrl_wk_cmd(padapter, LPS_CTRL_SCAN, 1);
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c)
return _FAIL;
psurveyPara = rtw_zmalloc(sizeof(struct sitesurvey_parm));
psurveyPara = kzalloc(sizeof(*psurveyPara), GFP_ATOMIC);
if (!psurveyPara) {
kfree(ph2c);
return _FAIL;
@ -602,7 +601,7 @@ u8 rtw_createbss_cmd(struct adapter *padapter)
struct wlan_bssid_ex *pdev_network = &padapter->registrypriv.dev_network;
u8 res = _SUCCESS;
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
pcmd = kzalloc(sizeof(*pcmd), GFP_ATOMIC);
if (!pcmd) {
res = _FAIL;
goto exit;
@ -635,7 +634,7 @@ int rtw_startbss_cmd(struct adapter *padapter, int flags)
start_bss_network(padapter);
} else {
/* need enqueue, prepare cmd_obj and enqueue */
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL);
if (!pcmd) {
res = _FAIL;
goto exit;
@ -687,7 +686,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
u32 tmp_len;
u8 *ptmp = NULL;
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL);
if (!pcmd) {
res = _FAIL;
goto exit;
@ -696,7 +695,7 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
t_len = sizeof(struct wlan_bssid_ex);
/* for hidden ap to set fw_state here */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_ADHOC_STATE) != true) {
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_ADHOC_STATE) != true) {
switch (ndis_network_mode) {
case Ndis802_11IBSS:
set_fwstate(pmlmepriv, WIFI_ADHOC_STATE);
@ -721,10 +720,10 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
psecuritypriv->authenticator_ie[0] = (unsigned char)psecnetwork->ie_length;
if ((psecnetwork->ie_length-12) < (256-1))
memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->ies[12], psecnetwork->ie_length-12);
if ((psecnetwork->ie_length - 12) < (256 - 1))
memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->ies[12], psecnetwork->ie_length - 12);
else
memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->ies[12], (256-1));
memcpy(&psecuritypriv->authenticator_ie[1], &psecnetwork->ies[12], (256 - 1));
psecnetwork->ie_length = 0;
/* Added by Albert 2009/02/18 */
@ -751,22 +750,22 @@ u8 rtw_joinbss_cmd(struct adapter *padapter, struct wlan_network *pnetwork)
}
phtpriv->ht_option = false;
ptmp = rtw_get_ie(&pnetwork->network.ies[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.ie_length-12);
ptmp = rtw_get_ie(&pnetwork->network.ies[12], WLAN_EID_HT_CAPABILITY, &tmp_len, pnetwork->network.ie_length - 12);
if (pregistrypriv->ht_enable && ptmp && tmp_len > 0) {
/* Added by Albert 2010/06/23 */
/* For the WEP mode, we will use the bg mode to do the connection to avoid some IOT issue. */
/* Especially for Realtek 8192u SoftAP. */
if ((padapter->securitypriv.dot11PrivacyAlgrthm != _WEP40_) &&
(padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) &&
(padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) {
(padapter->securitypriv.dot11PrivacyAlgrthm != _WEP104_) &&
(padapter->securitypriv.dot11PrivacyAlgrthm != _TKIP_)) {
rtw_ht_use_default_setting(padapter);
rtw_build_wmm_ie_ht(padapter, &psecnetwork->ies[12], &psecnetwork->ie_length);
/* rtw_restructure_ht_ie */
rtw_restructure_ht_ie(padapter, &pnetwork->network.ies[12], &psecnetwork->ies[0],
pnetwork->network.ie_length-12, &psecnetwork->ie_length,
pnetwork->network.configuration.ds_config);
pnetwork->network.ie_length - 12, &psecnetwork->ie_length,
pnetwork->network.configuration.ds_config);
}
}
@ -796,7 +795,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu
u8 res = _SUCCESS;
/* prepare cmd parameter */
param = rtw_zmalloc(sizeof(*param));
param = kzalloc(sizeof(*param), GFP_KERNEL);
if (!param) {
res = _FAIL;
goto exit;
@ -805,7 +804,7 @@ u8 rtw_disassoc_cmd(struct adapter *padapter, u32 deauth_timeout_ms, bool enqueu
if (enqueue) {
/* need enqueue, prepare cmd_obj and enqueue */
cmdobj = rtw_zmalloc(sizeof(*cmdobj));
cmdobj = kzalloc(sizeof(*cmdobj), GFP_KERNEL);
if (!cmdobj) {
res = _FAIL;
kfree(param);
@ -832,8 +831,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infrast
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
psetop = rtw_zmalloc(sizeof(struct setopmode_parm));
psetop = kzalloc(sizeof(*psetop), GFP_KERNEL);
if (!psetop) {
res = _FAIL;
goto exit;
@ -841,7 +839,7 @@ u8 rtw_setopmode_cmd(struct adapter *padapter, enum ndis_802_11_network_infrast
psetop->mode = (u8)networktype;
if (enqueue) {
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
if (!ph2c) {
kfree(psetop);
res = _FAIL;
@ -868,7 +866,7 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_
struct security_priv *psecuritypriv = &padapter->securitypriv;
u8 res = _SUCCESS;
psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
psetstakey_para = kzalloc(sizeof(*psetstakey_para), GFP_KERNEL);
if (!psetstakey_para) {
res = _FAIL;
goto exit;
@ -890,14 +888,14 @@ u8 rtw_setstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 unicast_
padapter->securitypriv.busetkipkey = true;
if (enqueue) {
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
if (!ph2c) {
kfree(psetstakey_para);
res = _FAIL;
goto exit;
}
psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp));
psetstakey_rsp = kzalloc(sizeof(*psetstakey_rsp), GFP_KERNEL);
if (!psetstakey_rsp) {
kfree(ph2c);
kfree(psetstakey_para);
@ -930,25 +928,25 @@ u8 rtw_clearstakey_cmd(struct adapter *padapter, struct sta_info *sta, u8 enqueu
while ((cam_id = rtw_camid_search(padapter, sta->hwaddr, -1)) >= 0) {
netdev_dbg(padapter->pnetdev,
"clear key for addr:%pM, camid:%d\n",
MAC_ARG(sta->hwaddr), cam_id);
sta->hwaddr, cam_id);
clear_cam_entry(padapter, cam_id);
rtw_camid_free(padapter, cam_id);
}
} else {
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
if (!ph2c) {
res = _FAIL;
goto exit;
}
psetstakey_para = rtw_zmalloc(sizeof(struct set_stakey_parm));
psetstakey_para = kzalloc(sizeof(*psetstakey_para), GFP_KERNEL);
if (!psetstakey_para) {
kfree(ph2c);
res = _FAIL;
goto exit;
}
psetstakey_rsp = rtw_zmalloc(sizeof(struct set_stakey_rsp));
psetstakey_rsp = kzalloc(sizeof(*psetstakey_rsp), GFP_KERNEL);
if (!psetstakey_rsp) {
kfree(ph2c);
kfree(psetstakey_para);
@ -978,13 +976,13 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr)
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
paddbareq_parm = rtw_zmalloc(sizeof(struct addBaReq_parm));
paddbareq_parm = kzalloc(sizeof(*paddbareq_parm), GFP_ATOMIC);
if (!paddbareq_parm) {
kfree(ph2c);
res = _FAIL;
@ -1002,6 +1000,7 @@ u8 rtw_addbareq_cmd(struct adapter *padapter, u8 tid, u8 *addr)
exit:
return res;
}
/* add for CONFIG_IEEE80211W, none 11w can use it */
u8 rtw_reset_securitypriv_cmd(struct adapter *padapter)
{
@ -1010,13 +1009,13 @@ u8 rtw_reset_securitypriv_cmd(struct adapter *padapter)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1043,13 +1042,13 @@ u8 rtw_free_assoc_resources_cmd(struct adapter *padapter)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1077,13 +1076,13 @@ u8 rtw_dynamic_chk_wk_cmd(struct adapter *padapter)
u8 res = _SUCCESS;
/* only primary padapter does this cmd */
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1122,8 +1121,8 @@ static void collect_traffic_statistics(struct adapter *padapter)
pdvobjpriv->traffic_stat.last_tx_bytes = pdvobjpriv->traffic_stat.tx_bytes;
pdvobjpriv->traffic_stat.last_rx_bytes = pdvobjpriv->traffic_stat.rx_bytes;
pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8/2/1024/1024);
pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8/2/1024/1024);
pdvobjpriv->traffic_stat.cur_tx_tp = (u32)(pdvobjpriv->traffic_stat.cur_tx_bytes * 8 / 2 / 1024 / 1024);
pdvobjpriv->traffic_stat.cur_rx_tp = (u32)(pdvobjpriv->traffic_stat.cur_rx_bytes * 8 / 2 / 1024 / 1024);
}
u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
@ -1148,7 +1147,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
BusyThreshold = BusyThresholdLow;
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > BusyThreshold ||
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold) {
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > BusyThreshold) {
bBusyTraffic = true;
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod)
@ -1159,7 +1158,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
/* Higher Tx/Rx data. */
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > 4000 ||
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000) {
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod > 4000) {
bHigherBusyTraffic = true;
if (pmlmepriv->LinkDetectInfo.NumRxOkInPeriod > pmlmepriv->LinkDetectInfo.NumTxOkInPeriod)
@ -1170,7 +1169,7 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
/* check traffic for powersaving. */
if (((pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod + pmlmepriv->LinkDetectInfo.NumTxOkInPeriod) > 8) ||
(pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) {
(pmlmepriv->LinkDetectInfo.NumRxUnicastOkInPeriod > 2)) {
bEnterPS = false;
if (bBusyTraffic) {
@ -1224,7 +1223,6 @@ u8 traffic_status_watchdog(struct adapter *padapter, u8 from_timer)
pmlmepriv->LinkDetectInfo.bHigherBusyTxTraffic = bHigherBusyTxTraffic;
return bEnterPS;
}
static void dynamic_chk_wk_hdl(struct adapter *padapter)
@ -1264,7 +1262,7 @@ void lps_ctrl_wk_hdl(struct adapter *padapter, u8 lps_ctrl_type)
u8 mstatus;
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
return;
}
@ -1318,13 +1316,13 @@ u8 rtw_lps_ctrl_wk_cmd(struct adapter *padapter, u8 lps_ctrl_type, u8 enqueue)
u8 res = _SUCCESS;
if (enqueue) {
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1359,13 +1357,13 @@ u8 rtw_dm_in_lps_wk_cmd(struct adapter *padapter)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1421,13 +1419,13 @@ u8 rtw_dm_ra_mask_wk_cmd(struct adapter *padapter, u8 *psta)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1446,7 +1444,6 @@ u8 rtw_dm_ra_mask_wk_cmd(struct adapter *padapter, u8 *psta)
exit:
return res;
}
u8 rtw_ps_cmd(struct adapter *padapter)
@ -1456,13 +1453,13 @@ u8 rtw_ps_cmd(struct adapter *padapter)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ppscmd = rtw_zmalloc(sizeof(struct cmd_obj));
ppscmd = kzalloc(sizeof(*ppscmd), GFP_ATOMIC);
if (!ppscmd) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ppscmd);
res = _FAIL;
@ -1516,9 +1513,7 @@ static void rtw_chk_hi_queue_hdl(struct adapter *padapter)
} else {/* re check again */
rtw_chk_hi_queue_cmd(padapter);
}
}
}
u8 rtw_chk_hi_queue_cmd(struct adapter *padapter)
@ -1528,13 +1523,13 @@ u8 rtw_chk_hi_queue_cmd(struct adapter *padapter)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1598,9 +1593,9 @@ static void rtw_btinfo_hdl(struct adapter *adapter, u8 *buf, u16 buf_len)
cmd_idx = info->cid;
if (info->len > buf_len-2) {
if (info->len > buf_len - 2) {
rtw_warn_on(1);
len = buf_len-2;
len = buf_len - 2;
} else {
len = info->len;
}
@ -1610,7 +1605,7 @@ static void rtw_btinfo_hdl(struct adapter *adapter, u8 *buf, u16 buf_len)
buf[1] = 0;
else if (cmd_idx == BTINFO_BT_AUTO_RPT)
buf[1] = 2;
hal_btcoex_BtInfoNotify(adapter, len+1, &buf[1]);
hal_btcoex_BtInfoNotify(adapter, len + 1, &buf[1]);
}
u8 rtw_c2h_packet_wk_cmd(struct adapter *padapter, u8 *pbuf, u16 length)
@ -1620,13 +1615,13 @@ u8 rtw_c2h_packet_wk_cmd(struct adapter *padapter, u8 *pbuf, u16 length)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_ATOMIC);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_ATOMIC);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1655,13 +1650,13 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 res = _SUCCESS;
ph2c = rtw_zmalloc(sizeof(struct cmd_obj));
ph2c = kzalloc(sizeof(*ph2c), GFP_KERNEL);
if (!ph2c) {
res = _FAIL;
goto exit;
}
pdrvextra_cmd_parm = rtw_zmalloc(sizeof(struct drvextra_cmd_parm));
pdrvextra_cmd_parm = kzalloc(sizeof(*pdrvextra_cmd_parm), GFP_KERNEL);
if (!pdrvextra_cmd_parm) {
kfree(ph2c);
res = _FAIL;
@ -1670,7 +1665,7 @@ u8 rtw_c2h_wk_cmd(struct adapter *padapter, u8 *c2h_evt)
pdrvextra_cmd_parm->ec_id = C2H_WK_CID;
pdrvextra_cmd_parm->type = 0;
pdrvextra_cmd_parm->size = c2h_evt?16:0;
pdrvextra_cmd_parm->size = c2h_evt ? 16 : 0;
pdrvextra_cmd_parm->pbuf = c2h_evt;
init_h2fwcmd_w_parm_no_rsp(ph2c, pdrvextra_cmd_parm, GEN_CMD_CODE(_Set_Drv_Extra));
@ -1697,7 +1692,7 @@ static void c2h_wk_callback(struct work_struct *work)
/* This C2H event is read, clear it */
c2h_evt_clear(adapter);
} else {
c2h_evt = rtw_malloc(16);
c2h_evt = kmalloc(16, GFP_ATOMIC);
if (c2h_evt) {
/* This C2H event is not read, read & clear now */
if (c2h_evt_read_88xx(adapter, c2h_evt) != _SUCCESS) {
@ -1877,7 +1872,6 @@ void rtw_createbss_cmd_callback(struct adapter *padapter, struct cmd_obj *pcmd)
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
/* we will set _FW_LINKED when there is one more sat to join us (rtw_stassoc_event_callback) */
}
createbss_cmd_fail:

View file

@ -1010,7 +1010,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork)
pbuf = rtw_get_wpa_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
if (pbuf && (wpa_ielen > 0)) {
if (_SUCCESS == rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
if (rtw_parse_wpa_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
pnetwork->bcn_info.group_cipher = group_cipher;
pnetwork->bcn_info.is_8021x = is8021x;
@ -1020,7 +1020,7 @@ static int rtw_get_cipher_info(struct wlan_network *pnetwork)
pbuf = rtw_get_wpa2_ie(&pnetwork->network.ies[12], &wpa_ielen, pnetwork->network.ie_length-12);
if (pbuf && (wpa_ielen > 0)) {
if (_SUCCESS == rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x)) {
if (rtw_parse_wpa2_ie(pbuf, wpa_ielen+2, &group_cipher, &pairwise_cipher, &is8021x) == _SUCCESS) {
pnetwork->bcn_info.pairwise_cipher = pairwise_cipher;
pnetwork->bcn_info.group_cipher = group_cipher;
pnetwork->bcn_info.is_8021x = is8021x;
@ -1140,7 +1140,7 @@ int rtw_action_frame_parse(const u8 *frame, u32 frame_len, u8 *category, u8 *act
return true;
}
static const char *_action_public_str[] = {
static const char * const _action_public_str[] = {
"ACT_PUB_BSSCOEXIST",
"ACT_PUB_DSE_ENABLE",
"ACT_PUB_DSE_DEENABLE",

View file

@ -29,7 +29,7 @@ u8 rtw_read8(struct adapter *adapter, u32 addr)
{
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
struct intf_hdl *pintfhdl = &pio_priv->intf;
u8 (*_read8)(struct intf_hdl *pintfhdl, u32 addr);
_read8 = pintfhdl->io_ops._read8;
@ -41,7 +41,7 @@ u16 rtw_read16(struct adapter *adapter, u32 addr)
{
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
struct intf_hdl *pintfhdl = &pio_priv->intf;
u16 (*_read16)(struct intf_hdl *pintfhdl, u32 addr);
_read16 = pintfhdl->io_ops._read16;
@ -53,20 +53,19 @@ u32 rtw_read32(struct adapter *adapter, u32 addr)
{
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
struct intf_hdl *pintfhdl = &pio_priv->intf;
u32 (*_read32)(struct intf_hdl *pintfhdl, u32 addr);
_read32 = pintfhdl->io_ops._read32;
return _read32(pintfhdl, addr);
}
int rtw_write8(struct adapter *adapter, u32 addr, u8 val)
{
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
struct intf_hdl *pintfhdl = &pio_priv->intf;
int (*_write8)(struct intf_hdl *pintfhdl, u32 addr, u8 val);
int ret;
@ -80,7 +79,7 @@ int rtw_write16(struct adapter *adapter, u32 addr, u16 val)
{
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
struct intf_hdl *pintfhdl = &pio_priv->intf;
int (*_write16)(struct intf_hdl *pintfhdl, u32 addr, u16 val);
int ret;
@ -93,7 +92,7 @@ int rtw_write32(struct adapter *adapter, u32 addr, u32 val)
{
/* struct io_queue *pio_queue = (struct io_queue *)adapter->pio_queue; */
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
struct intf_hdl *pintfhdl = &pio_priv->intf;
int (*_write32)(struct intf_hdl *pintfhdl, u32 addr, u32 val);
int ret;
@ -108,7 +107,7 @@ u32 rtw_write_port(struct adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
{
u32 (*_write_port)(struct intf_hdl *pintfhdl, u32 addr, u32 cnt, u8 *pmem);
struct io_priv *pio_priv = &adapter->iopriv;
struct intf_hdl *pintfhdl = &(pio_priv->intf);
struct intf_hdl *pintfhdl = &pio_priv->intf;
_write_port = pintfhdl->io_ops._write_port;

View file

@ -179,8 +179,8 @@ void _rtw_free_network(struct mlme_priv *pmlmepriv, struct wlan_network *pnetwor
if (pnetwork->fixed)
return;
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true))
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_STATE))
lifetime = 1;
if (!isfreeall) {
@ -267,7 +267,7 @@ signed int rtw_if_up(struct adapter *padapter)
signed int res;
if (padapter->bDriverStopped || padapter->bSurpriseRemoved ||
(check_fwstate(&padapter->mlmepriv, _FW_LINKED) == false))
!check_fwstate(&padapter->mlmepriv, _FW_LINKED))
res = false;
else
res = true;
@ -283,8 +283,8 @@ void rtw_generate_random_ibss(u8 *pibss)
pibss[1] = 0x11;
pibss[2] = 0x87;
pibss[3] = (u8)(curtime & 0xff) ;/* p[0]; */
pibss[4] = (u8)((curtime>>8) & 0xff) ;/* p[1]; */
pibss[5] = (u8)((curtime>>16) & 0xff) ;/* p[2]; */
pibss[4] = (u8)((curtime >> 8) & 0xff) ;/* p[1]; */
pibss[5] = (u8)((curtime >> 16) & 0xff) ;/* p[2]; */
}
u8 *rtw_get_capability_from_ie(u8 *ie)
@ -433,14 +433,14 @@ void update_network(struct wlan_bssid_ex *dst, struct wlan_bssid_ex *src,
sq_final = padapter->recvpriv.signal_qual;
/* the rssi value here is undecorated, and will be used for antenna diversity */
if (sq_smp != 101) /* from the right channel */
rssi_final = (src->rssi+dst->rssi*4)/5;
rssi_final = (src->rssi + dst->rssi * 4) / 5;
else
rssi_final = rssi_ori;
} else {
if (sq_smp != 101) { /* from the right channel */
ss_final = ((u32)(src->phy_info.signal_strength)+(u32)(dst->phy_info.signal_strength)*4)/5;
sq_final = ((u32)(src->phy_info.signal_quality)+(u32)(dst->phy_info.signal_quality)*4)/5;
rssi_final = (src->rssi+dst->rssi*4)/5;
ss_final = ((u32)(src->phy_info.signal_strength) + (u32)(dst->phy_info.signal_strength) * 4) / 5;
sq_final = ((u32)(src->phy_info.signal_quality) + (u32)(dst->phy_info.signal_quality) * 4) / 5;
rssi_final = (src->rssi + dst->rssi * 4) / 5;
} else {
/* bss info not receiving from the right channel, use the original RX signal infos */
ss_final = dst->phy_info.signal_strength;
@ -469,7 +469,7 @@ static void update_current_network(struct adapter *adapter, struct wlan_bssid_ex
&pmlmepriv->cur_network.network,
&pmlmepriv->cur_network.network);
if ((check_fwstate(pmlmepriv, _FW_LINKED) == true) && (is_same_network(&pmlmepriv->cur_network.network, pnetwork, 0))) {
if (check_fwstate(pmlmepriv, _FW_LINKED) && (is_same_network(&pmlmepriv->cur_network.network, pnetwork, 0))) {
update_network(&pmlmepriv->cur_network.network, pnetwork, adapter, true);
rtw_update_protection(adapter, (pmlmepriv->cur_network.network.ies) + sizeof(struct ndis_802_11_fix_ie),
pmlmepriv->cur_network.network.ie_length);
@ -609,7 +609,7 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor
privacy = pnetwork->network.privacy;
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
if (rtw_get_wps_ie(pnetwork->network.ies+_FIXED_IE_LENGTH_, pnetwork->network.ie_length-_FIXED_IE_LENGTH_, NULL, &wps_ielen))
if (rtw_get_wps_ie(pnetwork->network.ies + _FIXED_IE_LENGTH_, pnetwork->network.ie_length - _FIXED_IE_LENGTH_, NULL, &wps_ielen))
return true;
else
return false;
@ -633,7 +633,7 @@ int rtw_is_desired_network(struct adapter *adapter, struct wlan_network *pnetwor
if ((desired_encmode != Ndis802_11EncryptionDisabled) && (privacy == 0))
bselected = false;
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true) {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
if (pnetwork->network.infrastructure_mode != pmlmepriv->cur_network.network.infrastructure_mode)
bselected = false;
}
@ -661,7 +661,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf)
spin_lock_bh(&pmlmepriv->lock);
/* update IBSS_network 's timestamp */
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) == true) {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)) {
if (!memcmp(&pmlmepriv->cur_network.network.mac_address, pnetwork->mac_address, ETH_ALEN)) {
struct wlan_network *ibss_wlan = NULL;
@ -678,7 +678,7 @@ void rtw_survey_event_callback(struct adapter *adapter, u8 *pbuf)
}
/* lock pmlmepriv->lock when you accessing network_q */
if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == false) {
if (!check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) {
if (pnetwork->ssid.ssid[0] == 0)
pnetwork->ssid.ssid_length = 0;
rtw_add_network(adapter, pnetwork);
@ -710,8 +710,8 @@ void rtw_surveydone_event_callback(struct adapter *adapter, u8 *pbuf)
rtw_set_signal_stat_timer(&adapter->recvpriv);
if (pmlmepriv->to_join) {
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) {
if (check_fwstate(pmlmepriv, _FW_LINKED) == false) {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
set_fwstate(pmlmepriv, _FW_UNDER_LINKING);
if (rtw_select_and_join_from_scanned_queue(pmlmepriv) == _SUCCESS) {
@ -819,15 +819,6 @@ static void free_scanqueue(struct mlme_priv *pmlmepriv)
spin_unlock_bh(&scan_queue->lock);
}
static void rtw_reset_rx_info(struct debug_priv *pdbgpriv)
{
pdbgpriv->dbg_rx_ampdu_drop_count = 0;
pdbgpriv->dbg_rx_ampdu_forced_indicate_count = 0;
pdbgpriv->dbg_rx_ampdu_loss_count = 0;
pdbgpriv->dbg_rx_dup_mgt_frame_drop_count = 0;
pdbgpriv->dbg_rx_ampdu_window_shift_cnt = 0;
}
static void find_network(struct adapter *adapter)
{
struct wlan_network *pwlan = NULL;
@ -835,8 +826,10 @@ static void find_network(struct adapter *adapter)
struct wlan_network *tgt_network = &pmlmepriv->cur_network;
pwlan = rtw_find_network(&pmlmepriv->scanned_queue, tgt_network->network.mac_address);
if (pwlan)
pwlan->fixed = false;
if (!pwlan)
return;
pwlan->fixed = false;
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) &&
(adapter->stapriv.asoc_sta_count == 1))
@ -848,17 +841,15 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
{
struct mlme_priv *pmlmepriv = &adapter->mlmepriv;
struct wlan_network *tgt_network = &pmlmepriv->cur_network;
struct dvobj_priv *psdpriv = adapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE|WIFI_AP_STATE)) {
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE | WIFI_AP_STATE)) {
struct sta_info *psta;
psta = rtw_get_stainfo(&adapter->stapriv, tgt_network->network.mac_address);
rtw_free_stainfo(adapter, psta);
}
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE|WIFI_AP_STATE)) {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE | WIFI_AP_STATE)) {
struct sta_info *psta;
rtw_free_all_stainfo(adapter);
@ -873,8 +864,6 @@ void rtw_free_assoc_resources(struct adapter *adapter, int lock_scanned_queue)
if (lock_scanned_queue)
adapter->securitypriv.key_mask = 0;
rtw_reset_rx_info(pdbgpriv);
}
/* rtw_indicate_connect: the caller has to lock pmlmepriv->lock */
@ -909,7 +898,7 @@ void rtw_indicate_disconnect(struct adapter *padapter)
{
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING|WIFI_UNDER_WPS);
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING | WIFI_UNDER_WPS);
if (rtw_to_roam(padapter) > 0)
_clr_fwstate_(pmlmepriv, _FW_LINKED);
@ -940,7 +929,7 @@ inline void rtw_indicate_scan_done(struct adapter *padapter, bool aborted)
if ((!adapter_to_pwrctl(padapter)->bInSuspend) &&
(!check_fwstate(&padapter->mlmepriv,
WIFI_ASOC_STATE|WIFI_UNDER_LINKING))) {
WIFI_ASOC_STATE | WIFI_UNDER_LINKING))) {
rtw_set_ips_deny(padapter, 0);
_set_timer(&padapter->mlmepriv.dynamic_chk_timer, 1);
}
@ -1078,8 +1067,8 @@ static void rtw_joinbss_update_network(struct adapter *padapter, struct wlan_net
switch (pnetwork->network.infrastructure_mode) {
case Ndis802_11Infrastructure:
if (pmlmepriv->fw_state&WIFI_UNDER_WPS)
pmlmepriv->fw_state = WIFI_STATION_STATE|WIFI_UNDER_WPS;
if (pmlmepriv->fw_state & WIFI_UNDER_WPS)
pmlmepriv->fw_state = WIFI_STATION_STATE | WIFI_UNDER_WPS;
else
pmlmepriv->fw_state = WIFI_STATION_STATE;
@ -1206,7 +1195,7 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
rtw_free_stainfo(adapter, pcur_sta);
ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, pnetwork->network.mac_address);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
if (ptarget_wlan)
ptarget_wlan->fixed = true;
}
@ -1214,7 +1203,7 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
} else {
ptarget_wlan = _rtw_find_same_network(&pmlmepriv->scanned_queue, pnetwork);
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
if (ptarget_wlan)
ptarget_wlan->fixed = true;
}
@ -1231,7 +1220,7 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
}
/* s3. find ptarget_sta & update ptarget_sta after update cur_network only for station mode */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
ptarget_sta = rtw_joinbss_update_stainfo(adapter, pnetwork);
if (!ptarget_sta) {
spin_unlock_bh(&pmlmepriv->scanned_queue.lock);
@ -1240,7 +1229,7 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
}
/* s4. indicate connect */
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE) == true) {
if (check_fwstate(pmlmepriv, WIFI_STATION_STATE)) {
pmlmepriv->cur_network_scanned = ptarget_wlan;
rtw_indicate_connect(adapter);
}
@ -1258,7 +1247,7 @@ void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf)
rtw_reset_securitypriv(adapter);
_set_timer(&pmlmepriv->assoc_timer, 1);
if ((check_fwstate(pmlmepriv, _FW_UNDER_LINKING)) == true)
if (check_fwstate(pmlmepriv, _FW_UNDER_LINKING))
_clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
} else {/* if join_res < 0 (join fails), then try again */
@ -1309,7 +1298,7 @@ void rtw_sta_media_status_rpt(struct adapter *adapter, struct sta_info *psta, u3
if (!psta)
return;
media_status_rpt = (u16)((psta->mac_id<<8)|mstatus); /* MACID|OPMODE:1 connect */
media_status_rpt = (u16)((psta->mac_id << 8) | mstatus); /* MACID|OPMODE:1 connect */
rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status_rpt);
}
@ -1337,10 +1326,9 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf)
/* report to upper layer */
spin_lock_bh(&psta->lock);
if (psta->passoc_req && psta->assoc_req_len > 0) {
passoc_req = rtw_zmalloc(psta->assoc_req_len);
passoc_req = kmemdup(psta->passoc_req, psta->assoc_req_len, GFP_ATOMIC);
if (passoc_req) {
assoc_req_len = psta->assoc_req_len;
memcpy(passoc_req, psta->passoc_req, assoc_req_len);
kfree(psta->passoc_req);
psta->passoc_req = NULL;
@ -1386,8 +1374,8 @@ void rtw_stassoc_event_callback(struct adapter *adapter, u8 *pbuf)
spin_lock_bh(&pmlmepriv->lock);
if ((check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) == true) ||
(check_fwstate(pmlmepriv, WIFI_ADHOC_STATE) == true)) {
if (check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE) ||
check_fwstate(pmlmepriv, WIFI_ADHOC_STATE)) {
if (adapter->stapriv.asoc_sta_count == 2) {
spin_lock_bh(&pmlmepriv->scanned_queue.lock);
ptarget_wlan = rtw_find_network(&pmlmepriv->scanned_queue, cur_network->network.mac_address);
@ -1427,13 +1415,13 @@ void rtw_stadel_event_callback(struct adapter *adapter, u8 *pbuf)
if (mac_id >= 0) {
u16 media_status;
media_status = (mac_id<<8)|0; /* MACID|OPMODE:0 means disconnect */
media_status = (mac_id << 8) | 0; /* MACID|OPMODE:0 means disconnect */
/* for STA, AP, ADHOC mode, report disconnect stauts to FW */
rtw_hal_set_hwreg(adapter, HW_VAR_H2C_MEDIA_STATUS_RPT, (u8 *)&media_status);
}
/* if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) */
if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE)
if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE)
return;
mlmeext_sta_del_event_callback(adapter);
@ -1562,10 +1550,10 @@ void _rtw_join_timeout_handler(struct timer_list *t)
continue;
break;
} else {
rtw_indicate_disconnect(adapter);
break;
}
rtw_indicate_disconnect(adapter);
break;
}
} else {
@ -1607,7 +1595,7 @@ void rtw_mlme_reset_auto_scan_int(struct adapter *adapter)
if (pmlmeinfo->VHT_enable) /* disable auto scan when connect to 11AC AP */
mlme->auto_scan_int_ms = 0;
else if (adapter->registrypriv.wifi_spec && is_client_associated_to_ap(adapter) == true)
mlme->auto_scan_int_ms = 60*1000;
mlme->auto_scan_int_ms = 60 * 1000;
else if (rtw_chk_roam_flags(adapter, RTW_ROAM_ACTIVE)) {
if (check_fwstate(mlme, WIFI_STATION_STATE) && check_fwstate(mlme, _FW_LINKED))
mlme->auto_scan_int_ms = mlme->roam_scan_int_ms;
@ -1624,7 +1612,7 @@ static void rtw_auto_scan_handler(struct adapter *padapter)
if (pmlmepriv->auto_scan_int_ms != 0
&& jiffies_to_msecs(jiffies - pmlmepriv->scan_start_time) > pmlmepriv->auto_scan_int_ms) {
if (!padapter->registrypriv.wifi_spec) {
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING) == true)
if (check_fwstate(pmlmepriv, _FW_UNDER_SURVEY | _FW_UNDER_LINKING))
goto exit;
if (pmlmepriv->LinkDetectInfo.bBusyTraffic)
@ -1866,7 +1854,7 @@ int rtw_select_and_join_from_scanned_queue(struct mlme_priv *pmlmepriv)
candidate_exist:
/* check for situation of _FW_LINKED */
if (check_fwstate(pmlmepriv, _FW_LINKED) == true) {
if (check_fwstate(pmlmepriv, _FW_LINKED)) {
rtw_disassoc_cmd(adapter, 0, true);
rtw_indicate_disconnect(adapter);
rtw_free_assoc_resources(adapter, 0);
@ -1887,13 +1875,13 @@ signed int rtw_set_auth(struct adapter *adapter, struct security_priv *psecurity
struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
signed int res = _SUCCESS;
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL);
if (!pcmd) {
res = _FAIL; /* try again */
goto exit;
}
psetauthparm = rtw_zmalloc(sizeof(struct setauth_parm));
psetauthparm = kzalloc(sizeof(*psetauthparm), GFP_KERNEL);
if (!psetauthparm) {
kfree(pcmd);
res = _FAIL;
@ -1924,7 +1912,7 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp
struct cmd_priv *pcmdpriv = &adapter->cmdpriv;
signed int res = _SUCCESS;
psetkeyparm = rtw_zmalloc(sizeof(struct setkey_parm));
psetkeyparm = kzalloc(sizeof(*psetkeyparm), GFP_KERNEL);
if (!psetkeyparm) {
res = _FAIL;
goto exit;
@ -1966,7 +1954,7 @@ signed int rtw_set_key(struct adapter *adapter, struct security_priv *psecurityp
}
if (enqueue) {
pcmd = rtw_zmalloc(sizeof(struct cmd_obj));
pcmd = kzalloc(sizeof(*pcmd), GFP_KERNEL);
if (!pcmd) {
kfree(psetkeyparm);
res = _FAIL; /* try again */
@ -2000,7 +1988,7 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_
while (i < in_len) {
ielength = initial_out_len;
if (in_ie[i] == 0xDD && in_ie[i+2] == 0x00 && in_ie[i+3] == 0x50 && in_ie[i+4] == 0xF2 && in_ie[i+5] == 0x02 && i+5 < in_len) { /* WMM element ID and OUI */
if (in_ie[i] == 0xDD && in_ie[i + 2] == 0x00 && in_ie[i + 3] == 0x50 && in_ie[i + 4] == 0xF2 && in_ie[i + 5] == 0x02 && i + 5 < in_len) { /* WMM element ID and OUI */
for (j = i; j < i + 9; j++) {
out_ie[ielength] = in_ie[j];
ielength++;
@ -2012,13 +2000,13 @@ int rtw_restruct_wmm_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, uint in_
break;
}
i += (in_ie[i+1]+2); /* to the next IE element */
i += (in_ie[i + 1] + 2); /* to the next IE element */
}
return ielength;
}
/* Ported from 8185: IsInPreAuthKeyList().
/* Ported from 8185: IsInPreAuthKeyList().
* (Renamed from SecIsInPreAuthKeyList(), 2006-10-13.)
* Added by Annie, 2006-05-07.
*
@ -2068,12 +2056,12 @@ static int rtw_append_pmkid(struct adapter *Adapter, int iEntry, u8 *ie, uint ie
static void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
{
uint len;
u8 *buff, *p, i;
u8 *buff, *p;
union iwreq_data wrqu;
buff = NULL;
if (authmode == WLAN_EID_VENDOR_SPECIFIC) {
buff = rtw_zmalloc(IW_CUSTOM_MAX);
buff = kzalloc(IW_CUSTOM_MAX, GFP_ATOMIC);
if (!buff)
return;
@ -2084,8 +2072,7 @@ static void rtw_report_sec_ie(struct adapter *adapter, u8 authmode, u8 *sec_ie)
len = sec_ie[1] + 2;
len = (len < IW_CUSTOM_MAX) ? len : IW_CUSTOM_MAX;
for (i = 0; i < len; i++)
p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), "%02x", sec_ie[i]);
p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), " %*ph", len, sec_ie);
p += scnprintf(p, IW_CUSTOM_MAX - (p - buff), ")");
@ -2118,13 +2105,13 @@ signed int rtw_restruct_sec_ie(struct adapter *adapter, u8 *in_ie, u8 *out_ie, u
authmode = WLAN_EID_RSN;
if (check_fwstate(pmlmepriv, WIFI_UNDER_WPS)) {
memcpy(out_ie+ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len);
memcpy(out_ie + ielength, psecuritypriv->wps_ie, psecuritypriv->wps_ie_len);
ielength += psecuritypriv->wps_ie_len;
} else if ((authmode == WLAN_EID_VENDOR_SPECIFIC) || (authmode == WLAN_EID_RSN)) {
/* copy RSN or SSN */
memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], psecuritypriv->supplicant_ie[1]+2);
ielength += psecuritypriv->supplicant_ie[1]+2;
memcpy(&out_ie[ielength], &psecuritypriv->supplicant_ie[0], psecuritypriv->supplicant_ie[1] + 2);
ielength += psecuritypriv->supplicant_ie[1] + 2;
rtw_report_sec_ie(adapter, authmode, psecuritypriv->supplicant_ie);
}
@ -2292,7 +2279,7 @@ void rtw_build_wmm_ie_ht(struct adapter *padapter, u8 *out_ie, uint *pout_len)
if (padapter->mlmepriv.qospriv.qos_option == 0) {
out_len = *pout_len;
rtw_set_ie(out_ie+out_len, WLAN_EID_VENDOR_SPECIFIC,
rtw_set_ie(out_ie + out_len, WLAN_EID_VENDOR_SPECIFIC,
_WMM_IE_Length_, WMM_IE, pout_len);
padapter->mlmepriv.qospriv.qos_option = 1;
@ -2336,7 +2323,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
} else {
p = rtw_get_ie(in_ie, WLAN_EID_HT_OPERATION, &ielen, in_len);
if (p && (ielen == sizeof(struct ieee80211_ht_addt_info))) {
struct HT_info_element *pht_info = (struct HT_info_element *)(p+2);
struct HT_info_element *pht_info = (struct HT_info_element *)(p + 2);
if (pht_info->infos[0] & BIT(2)) {
switch (pht_info->infos[0] & 0x3) {
@ -2399,14 +2386,14 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
rtw_hal_get_def_var(padapter, HW_VAR_MAX_RX_AMPDU_FACTOR,
&max_rx_ampdu_factor);
ht_capie.ampdu_params_info = (max_rx_ampdu_factor&0x03);
ht_capie.ampdu_params_info = (max_rx_ampdu_factor & 0x03);
if (padapter->securitypriv.dot11PrivacyAlgrthm == _AES_)
ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&(0x07<<2));
ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & (0x07 << 2));
else
ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY&0x00);
ht_capie.ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & 0x00);
rtw_set_ie(out_ie+out_len, WLAN_EID_HT_CAPABILITY,
rtw_set_ie(out_ie + out_len, WLAN_EID_HT_CAPABILITY,
sizeof(struct ieee80211_ht_cap), (unsigned char *)&ht_capie, pout_len);
phtpriv->ht_option = true;
@ -2415,7 +2402,7 @@ unsigned int rtw_restructure_ht_ie(struct adapter *padapter, u8 *in_ie, u8 *out_
p = rtw_get_ie(in_ie, WLAN_EID_HT_OPERATION, &ielen, in_len);
if (p && (ielen == sizeof(struct ieee80211_ht_addt_info))) {
out_len = *pout_len;
rtw_set_ie(out_ie+out_len, WLAN_EID_HT_OPERATION, ielen, p+2, pout_len);
rtw_set_ie(out_ie + out_len, WLAN_EID_HT_OPERATION, ielen, p + 2, pout_len);
}
}
@ -2447,17 +2434,17 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len, u8 channe
/* check Max Rx A-MPDU Size */
len = 0;
p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_CAPABILITY, &len, ie_len-sizeof(struct ndis_802_11_fix_ie));
p = rtw_get_ie(pie + sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_CAPABILITY, &len, ie_len - sizeof(struct ndis_802_11_fix_ie));
if (p && len > 0) {
pht_capie = (struct ieee80211_ht_cap *)(p+2);
pht_capie = (struct ieee80211_ht_cap *)(p + 2);
max_ampdu_sz = (pht_capie->ampdu_params_info & IEEE80211_HT_CAP_AMPDU_FACTOR);
max_ampdu_sz = 1 << (max_ampdu_sz+3); /* max_ampdu_sz (kbytes); */
max_ampdu_sz = 1 << (max_ampdu_sz + 3); /* max_ampdu_sz (kbytes); */
phtpriv->rx_ampdu_maxlen = max_ampdu_sz;
}
len = 0;
p = rtw_get_ie(pie+sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_OPERATION, &len, ie_len-sizeof(struct ndis_802_11_fix_ie));
p = rtw_get_ie(pie + sizeof(struct ndis_802_11_fix_ie), WLAN_EID_HT_OPERATION, &len, ie_len - sizeof(struct ndis_802_11_fix_ie));
if (p && len > 0) {
/* todo: */
}
@ -2536,8 +2523,8 @@ void rtw_issue_addbareq_cmd(struct adapter *padapter, struct xmit_frame *pxmitfr
phtpriv = &psta->htpriv;
if (phtpriv->ht_option && phtpriv->ampdu_enable) {
issued = (phtpriv->agg_enable_bitmap>>priority)&0x1;
issued |= (phtpriv->candidate_tid_bitmap>>priority)&0x1;
issued = (phtpriv->agg_enable_bitmap >> priority) & 0x1;
issued |= (phtpriv->candidate_tid_bitmap >> priority) & 0x1;
if (issued == 0) {
psta->htpriv.candidate_tid_bitmap |= BIT((u8)priority);
@ -2607,12 +2594,12 @@ void _rtw_roaming(struct adapter *padapter, struct wlan_network *tgt_network)
signed int rtw_linked_check(struct adapter *padapter)
{
if ((check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) == true) ||
(check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE) == true)) {
if (check_fwstate(&padapter->mlmepriv, WIFI_AP_STATE) ||
check_fwstate(&padapter->mlmepriv, WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) {
if (padapter->stapriv.asoc_sta_count > 2)
return true;
} else { /* Station mode */
if (check_fwstate(&padapter->mlmepriv, _FW_LINKED) == true)
if (check_fwstate(&padapter->mlmepriv, _FW_LINKED))
return true;
}
return false;

File diff suppressed because it is too large Load diff

View file

@ -139,8 +139,6 @@ exit:
void rtw_ps_processor(struct adapter *padapter)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
u32 ps_deny = 0;
mutex_lock(&adapter_to_pwrctl(padapter)->lock);
@ -149,10 +147,8 @@ void rtw_ps_processor(struct adapter *padapter)
if (ps_deny != 0)
goto exit;
if (pwrpriv->bInSuspend) {/* system suspend or autosuspend */
pdbgpriv->dbg_ps_insuspend_cnt++;
if (pwrpriv->bInSuspend) /* system suspend or autosuspend */
return;
}
pwrpriv->ps_processing = true;

View file

@ -501,7 +501,7 @@ static union recv_frame *portctrl(struct adapter *adapter, union recv_frame *pre
{
u8 *psta_addr = NULL;
u8 *ptr;
uint auth_alg;
unsigned int auth_alg;
struct recv_frame_hdr *pfhdr;
struct sta_info *psta;
struct sta_priv *pstapriv;
@ -1425,7 +1425,7 @@ static signed int validate_80211w_mgmt(struct adapter *adapter, union recv_frame
memcpy(pattrib->ta, GetAddr2Ptr(ptr), ETH_ALEN);
/* actual management data frame body */
data_len = pattrib->pkt_len - pattrib->hdrlen - pattrib->iv_len - pattrib->icv_len;
mgmt_DATA = rtw_zmalloc(data_len);
mgmt_DATA = kzalloc(data_len, GFP_ATOMIC);
if (!mgmt_DATA)
goto validate_80211w_fail;
precv_frame = decryptor(adapter, precv_frame);
@ -1630,7 +1630,7 @@ static struct sk_buff *rtw_alloc_msdu_pkt(union recv_frame *prframe, u16 nSubfra
pattrib = &prframe->u.hdr.attrib;
sub_skb = rtw_skb_alloc(nSubframe_Length + 12);
sub_skb = __dev_alloc_skb(nSubframe_Length + 12, GFP_ATOMIC);
if (!sub_skb)
return NULL;
@ -1782,9 +1782,6 @@ static int amsdu_to_msdu(struct adapter *padapter, union recv_frame *prframe)
static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_num)
{
struct adapter *padapter = preorder_ctrl->padapter;
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
u8 wsize = preorder_ctrl->wsize_b;
u16 wend = (preorder_ctrl->indicate_seq + wsize - 1) % 4096u;
@ -1810,7 +1807,6 @@ static int check_indicate_seq(struct recv_reorder_ctrl *preorder_ctrl, u16 seq_n
preorder_ctrl->indicate_seq = seq_num + 1 - wsize;
else
preorder_ctrl->indicate_seq = 0xFFF - (wsize - (seq_num + 1)) + 1;
pdbgpriv->dbg_rx_ampdu_window_shift_cnt++;
}
return true;
@ -1861,15 +1857,6 @@ static int enqueue_reorder_recvframe(struct recv_reorder_ctrl *preorder_ctrl, un
}
static void recv_indicatepkts_pkt_loss_cnt(struct debug_priv *pdbgpriv, u64 prev_seq, u64 current_seq)
{
if (current_seq < prev_seq)
pdbgpriv->dbg_rx_ampdu_loss_count += (4096 + current_seq - prev_seq);
else
pdbgpriv->dbg_rx_ampdu_loss_count += (current_seq - prev_seq);
}
static int rtw_recv_indicatepkt(struct adapter *padapter, union recv_frame *precv_frame)
{
struct recv_priv *precvpriv;
@ -1916,8 +1903,6 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor
int bPktInBuf = false;
struct recv_priv *precvpriv = &padapter->recvpriv;
struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
/* spin_lock_irqsave(&ppending_recvframe_queue->lock, irql); */
/* spin_lock(&ppending_recvframe_queue->lock); */
@ -1927,7 +1912,6 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor
/* Handling some condition for forced indicate case. */
if (bforced == true) {
pdbgpriv->dbg_rx_ampdu_forced_indicate_count++;
if (list_empty(phead)) {
/* spin_unlock_irqrestore(&ppending_recvframe_queue->lock, irql); */
/* spin_unlock(&ppending_recvframe_queue->lock); */
@ -1937,7 +1921,6 @@ static int recv_indicatepkts_in_order(struct adapter *padapter, struct recv_reor
prframe = (union recv_frame *)plist;
pattrib = &prframe->u.hdr.attrib;
recv_indicatepkts_pkt_loss_cnt(pdbgpriv, preorder_ctrl->indicate_seq, pattrib->seq_num);
preorder_ctrl->indicate_seq = pattrib->seq_num;
}
@ -1998,8 +1981,6 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
struct rx_pkt_attrib *pattrib = &prframe->u.hdr.attrib;
struct recv_reorder_ctrl *preorder_ctrl = prframe->u.hdr.preorder_ctrl;
struct __queue *ppending_recvframe_queue = &preorder_ctrl->pending_recvframe_queue;
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
if (!pattrib->amsdu) {
/* s1. */
@ -2035,9 +2016,6 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
preorder_ctrl->indicate_seq = (preorder_ctrl->indicate_seq + 1)%4096;
if (retval != _SUCCESS) {
}
return retval;
}
}
@ -2045,11 +2023,8 @@ static int recv_indicatepkt_reorder(struct adapter *padapter, union recv_frame *
spin_lock_bh(&ppending_recvframe_queue->lock);
/* s2. check if winstart_b(indicate_seq) needs to been updated */
if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num)) {
pdbgpriv->dbg_rx_ampdu_drop_count++;
if (!check_indicate_seq(preorder_ctrl, pattrib->seq_num))
goto _err_exit;
}
/* s3. Insert all packet into Reorder Queue to maintain its ordering. */
if (!enqueue_reorder_recvframe(preorder_ctrl, prframe)) {

View file

@ -5,6 +5,7 @@
*
******************************************************************************/
#include <linux/crc32.h>
#include <linux/unaligned.h>
#include <drv_types.h>
#include <crypto/aes.h>
#include <crypto/utils.h>
@ -128,29 +129,6 @@ void rtw_wep_decrypt(struct adapter *padapter, u8 *precvframe)
/* 3 =====TKIP related ===== */
static u32 secmicgetuint32(u8 *p)
/* Convert from Byte[] to Us3232 in a portable way */
{
s32 i;
u32 res = 0;
for (i = 0; i < 4; i++)
res |= ((u32)(*p++)) << (8 * i);
return res;
}
static void secmicputuint32(u8 *p, u32 val)
/* Convert from Us3232 to Byte[] in a portable way */
{
long i;
for (i = 0; i < 4; i++) {
*p++ = (u8) (val & 0xff);
val >>= 8;
}
}
static void secmicclear(struct mic_data *pmicdata)
{
/* Reset the state to the empty message. */
@ -163,8 +141,8 @@ static void secmicclear(struct mic_data *pmicdata)
void rtw_secmicsetkey(struct mic_data *pmicdata, u8 *key)
{
/* Set the key */
pmicdata->K0 = secmicgetuint32(key);
pmicdata->K1 = secmicgetuint32(key + 4);
pmicdata->K0 = get_unaligned_le32(key);
pmicdata->K1 = get_unaligned_le32(key + 4);
/* and reset the message */
secmicclear(pmicdata);
}
@ -212,8 +190,8 @@ void rtw_secgetmic(struct mic_data *pmicdata, u8 *dst)
while (pmicdata->nBytesInM != 0)
rtw_secmicappendbyte(pmicdata, 0);
/* The appendByte function has already computed the result. */
secmicputuint32(dst, pmicdata->L);
secmicputuint32(dst + 4, pmicdata->R);
put_unaligned_le32(pmicdata->L, dst);
put_unaligned_le32(pmicdata->R, dst + 4);
/* Reset to the empty message. */
secmicclear(pmicdata);
}
@ -1316,8 +1294,7 @@ u32 rtw_BIP_verify(struct adapter *padapter, u8 *precvframe)
__le64 le_tmp64;
ori_len = pattrib->pkt_len - WLAN_HDR_A3_LEN + BIP_AAD_SIZE;
BIP_AAD = rtw_zmalloc(ori_len);
BIP_AAD = kzalloc(ori_len, GFP_KERNEL);
if (!BIP_AAD)
return _FAIL;
@ -1488,7 +1465,7 @@ void rtw_sec_restore_wep_key(struct adapter *adapter)
struct security_priv *securitypriv = &(adapter->securitypriv);
signed int keyid;
if ((_WEP40_ == securitypriv->dot11PrivacyAlgrthm) || (_WEP104_ == securitypriv->dot11PrivacyAlgrthm)) {
if ((securitypriv->dot11PrivacyAlgrthm == _WEP40_) || (securitypriv->dot11PrivacyAlgrthm == _WEP104_)) {
for (keyid = 0; keyid < 4; keyid++) {
if (securitypriv->key_mask & BIT(keyid)) {
if (keyid == securitypriv->dot11PrivacyKeyIndex)

View file

@ -54,7 +54,7 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
struct sta_info *psta;
s32 i;
pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA+4);
pstapriv->pallocated_stainfo_buf = vzalloc(sizeof(struct sta_info) * NUM_STA + 4);
if (!pstapriv->pallocated_stainfo_buf)
return _FAIL;
@ -105,7 +105,7 @@ u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
inline int rtw_stainfo_offset(struct sta_priv *stapriv, struct sta_info *sta)
{
int offset = (((u8 *)sta) - stapriv->pstainfo_buf)/sizeof(struct sta_info);
int offset = (((u8 *)sta) - stapriv->pstainfo_buf) / sizeof(struct sta_info);
return offset;
}
@ -191,77 +191,76 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv *pstapriv, u8 *hwaddr)
/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
spin_unlock_bh(&(pstapriv->sta_hash_lock));
return NULL;
} else {
psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list);
list_del_init(&(psta->list));
/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
_rtw_init_stainfo(psta);
psta->padapter = pstapriv->padapter;
memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
index = wifi_mac_hash(hwaddr);
if (index >= NUM_STA) {
spin_unlock_bh(&(pstapriv->sta_hash_lock));
psta = NULL;
goto exit;
}
phash_list = &(pstapriv->sta_hash[index]);
/* spin_lock_bh(&(pstapriv->sta_hash_lock)); */
list_add_tail(&psta->hash_list, phash_list);
pstapriv->asoc_sta_count++;
/* spin_unlock_bh(&(pstapriv->sta_hash_lock)); */
/* Commented by Albert 2009/08/13 */
/* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
/* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
/* So, we initialize the tid_rxseq variable as the 0xffff. */
for (i = 0; i < 16; i++)
memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);
timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0);
/* for A-MPDU Rx reordering buffer control */
for (i = 0; i < 16 ; i++) {
preorder_ctrl = &psta->recvreorder_ctrl[i];
preorder_ctrl->padapter = pstapriv->padapter;
preorder_ctrl->enable = false;
preorder_ctrl->indicate_seq = 0xffff;
preorder_ctrl->wend_b = 0xffff;
/* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
preorder_ctrl->wsize_b = 64;/* 64; */
INIT_LIST_HEAD(&preorder_ctrl->pending_recvframe_queue.queue);
spin_lock_init(&preorder_ctrl->pending_recvframe_queue.lock);
/* init recv timer */
timer_setup(&preorder_ctrl->reordering_ctrl_timer,
rtw_reordering_ctrl_timeout_handler, 0);
}
/* init for DM */
psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
/* init for the sequence number of received management frame */
psta->RxMgmtFrameSeqNum = 0xffff;
spin_unlock_bh(&(pstapriv->sta_hash_lock));
/* alloc mac id for non-bc/mc station, */
rtw_alloc_macid(pstapriv->padapter, psta);
}
psta = container_of(get_next(&pfree_sta_queue->queue), struct sta_info, list);
list_del_init(&(psta->list));
/* spin_unlock_bh(&(pfree_sta_queue->lock)); */
_rtw_init_stainfo(psta);
psta->padapter = pstapriv->padapter;
memcpy(psta->hwaddr, hwaddr, ETH_ALEN);
index = wifi_mac_hash(hwaddr);
if (index >= NUM_STA) {
spin_unlock_bh(&(pstapriv->sta_hash_lock));
psta = NULL;
goto exit;
}
phash_list = &(pstapriv->sta_hash[index]);
/* spin_lock_bh(&(pstapriv->sta_hash_lock)); */
list_add_tail(&psta->hash_list, phash_list);
pstapriv->asoc_sta_count++;
/* spin_unlock_bh(&(pstapriv->sta_hash_lock)); */
/* Commented by Albert 2009/08/13 */
/* For the SMC router, the sequence number of first packet of WPS handshake will be 0. */
/* In this case, this packet will be dropped by recv_decache function if we use the 0x00 as the default value for tid_rxseq variable. */
/* So, we initialize the tid_rxseq variable as the 0xffff. */
for (i = 0; i < 16; i++)
memcpy(&psta->sta_recvpriv.rxcache.tid_rxseq[i], &wRxSeqInitialValue, 2);
timer_setup(&psta->addba_retry_timer, addba_timer_hdl, 0);
/* for A-MPDU Rx reordering buffer control */
for (i = 0; i < 16 ; i++) {
preorder_ctrl = &psta->recvreorder_ctrl[i];
preorder_ctrl->padapter = pstapriv->padapter;
preorder_ctrl->enable = false;
preorder_ctrl->indicate_seq = 0xffff;
preorder_ctrl->wend_b = 0xffff;
/* preorder_ctrl->wsize_b = (NR_RECVBUFF-2); */
preorder_ctrl->wsize_b = 64;/* 64; */
INIT_LIST_HEAD(&preorder_ctrl->pending_recvframe_queue.queue);
spin_lock_init(&preorder_ctrl->pending_recvframe_queue.lock);
/* init recv timer */
timer_setup(&preorder_ctrl->reordering_ctrl_timer,
rtw_reordering_ctrl_timeout_handler, 0);
}
/* init for DM */
psta->rssi_stat.UndecoratedSmoothedPWDB = (-1);
psta->rssi_stat.UndecoratedSmoothedCCK = (-1);
/* init for the sequence number of received management frame */
psta->RxMgmtFrameSeqNum = 0xffff;
spin_unlock_bh(&(pstapriv->sta_hash_lock));
/* alloc mac id for non-bc/mc station, */
rtw_alloc_macid(pstapriv->padapter, psta);
exit:
@ -311,7 +310,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
/* spin_lock_bh(&(pxmitpriv->vi_pending.lock)); */
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->vi_q.sta_pending);
list_del_init(&(pstaxmitpriv->vi_q.tx_pending));
phwxmit = pxmitpriv->hwxmits+1;
phwxmit = pxmitpriv->hwxmits + 1;
phwxmit->accnt -= pstaxmitpriv->vi_q.qcnt;
pstaxmitpriv->vi_q.qcnt = 0;
/* spin_unlock_bh(&(pxmitpriv->vi_pending.lock)); */
@ -320,7 +319,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
/* spin_lock_bh(&(pxmitpriv->be_pending.lock)); */
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->be_q.sta_pending);
list_del_init(&(pstaxmitpriv->be_q.tx_pending));
phwxmit = pxmitpriv->hwxmits+2;
phwxmit = pxmitpriv->hwxmits + 2;
phwxmit->accnt -= pstaxmitpriv->be_q.qcnt;
pstaxmitpriv->be_q.qcnt = 0;
/* spin_unlock_bh(&(pxmitpriv->be_pending.lock)); */
@ -329,7 +328,7 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
/* spin_lock_bh(&(pxmitpriv->bk_pending.lock)); */
rtw_free_xmitframe_queue(pxmitpriv, &pstaxmitpriv->bk_q.sta_pending);
list_del_init(&(pstaxmitpriv->bk_q.tx_pending));
phwxmit = pxmitpriv->hwxmits+3;
phwxmit = pxmitpriv->hwxmits + 3;
phwxmit->accnt -= pstaxmitpriv->bk_q.qcnt;
pstaxmitpriv->bk_q.qcnt = 0;
/* spin_unlock_bh(&(pxmitpriv->bk_pending.lock)); */

View file

@ -63,11 +63,10 @@ u8 networktype_to_raid_ex(struct adapter *adapter, struct sta_info *psta)
break;
case WIRELESS_11B_24N:
case WIRELESS_11BG_24N:
if (psta->bw_mode == CHANNEL_WIDTH_20) {
if (psta->bw_mode == CHANNEL_WIDTH_20)
raid = RATEID_IDX_BGN_20M_1SS_BN;
} else {
else
raid = RATEID_IDX_BGN_40M_1SS;
}
break;
default:
raid = RATEID_IDX_BGN_40M_2SS;
@ -243,7 +242,7 @@ void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable)
rtw_hal_set_hwreg(padapter, HW_VAR_DM_FUNC_CLR, (u8 *)(&mode));
}
void Set_MSR(struct adapter *padapter, u8 type)
void set_msr(struct adapter *padapter, u8 type)
{
rtw_hal_set_hwreg(padapter, HW_VAR_MEDIA_STATUS, (u8 *)(&type));
}
@ -617,7 +616,7 @@ s16 rtw_camid_alloc(struct adapter *adapter, struct sta_info *sta, u8 kid)
netdev_dbg(adapter->pnetdev,
FUNC_ADPT_FMT " pairwise key with %pM id:%u no room\n",
FUNC_ADPT_ARG(adapter),
MAC_ARG(sta->hwaddr), kid);
sta->hwaddr, kid);
else
netdev_dbg(adapter->pnetdev,
FUNC_ADPT_FMT " group key id:%u no room\n",
@ -694,8 +693,8 @@ int WMM_param_handler(struct adapter *padapter, struct ndis_80211_var_ie *pIE)
if (!memcmp(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element)))
return false;
else
memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element));
memcpy(&(pmlmeinfo->WMM_param), (pIE->data + 6), sizeof(struct WMM_para_element));
pmlmeinfo->WMM_enable = 1;
return true;
@ -1132,7 +1131,7 @@ int rtw_check_bcn_info(struct adapter *Adapter, u8 *pframe, u32 packet_len)
if (memcmp(cur_network->network.mac_address, pbssid, 6))
return true;
bssid = rtw_zmalloc(sizeof(struct wlan_bssid_ex));
bssid = kzalloc(sizeof(*bssid), GFP_KERNEL);
if (!bssid)
return true;
@ -1450,9 +1449,7 @@ unsigned char check_assoc_AP(u8 *pframe, uint len)
return get_realtek_assoc_AP_vender(pIE);
else if (!memcmp(pIE->data, AIRGOCAP_OUI, 3))
return HT_IOT_PEER_AIRGO;
else
break;
break;
default:
break;
}

View file

@ -78,7 +78,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
}
pxmitpriv->pxmit_frame_buf = (u8 *)N_BYTE_ALIGMENT((SIZE_PTR)(pxmitpriv->pallocated_frame_buf), 4);
pxframe = (struct xmit_frame *) pxmitpriv->pxmit_frame_buf;
pxframe = (struct xmit_frame *)pxmitpriv->pxmit_frame_buf;
for (i = 0; i < NR_XMITFRAME; i++) {
INIT_LIST_HEAD(&pxframe->list);
@ -238,7 +238,9 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
pxmitbuf->padapter = padapter;
pxmitbuf->buf_tag = XMITBUF_CMD;
res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf, MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ, true);
res = rtw_os_xmit_resource_alloc(padapter, pxmitbuf,
MAX_CMDBUF_SZ + XMITBUF_ALIGN_SZ,
true);
if (res == _FAIL) {
res = _FAIL;
goto exit;
@ -248,7 +250,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, struct adapter *padapter)
pxmitbuf->pend = pxmitbuf->pbuf + MAX_CMDBUF_SZ;
pxmitbuf->len = 0;
pxmitbuf->pdata = pxmitbuf->ptail = pxmitbuf->phead;
pxmitbuf->alloc_sz = MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ;
pxmitbuf->alloc_sz = MAX_CMDBUF_SZ + XMITBUF_ALIGN_SZ;
}
}
@ -274,7 +276,7 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
{
int i;
struct adapter *padapter = pxmitpriv->adapter;
struct xmit_frame *pxmitframe = (struct xmit_frame *) pxmitpriv->pxmit_frame_buf;
struct xmit_frame *pxmitframe = (struct xmit_frame *)pxmitpriv->pxmit_frame_buf;
struct xmit_buf *pxmitbuf = (struct xmit_buf *)pxmitpriv->pxmitbuf;
rtw_hal_free_xmit_priv(padapter);
@ -321,7 +323,9 @@ void _rtw_free_xmit_priv(struct xmit_priv *pxmitpriv)
for (i = 0; i < CMDBUF_MAX; i++) {
pxmitbuf = &pxmitpriv->pcmd_xmitbuf[i];
if (pxmitbuf)
rtw_os_xmit_resource_free(padapter, pxmitbuf, MAX_CMDBUF_SZ+XMITBUF_ALIGN_SZ, true);
rtw_os_xmit_resource_free(padapter, pxmitbuf,
MAX_CMDBUF_SZ + XMITBUF_ALIGN_SZ,
true);
}
rtw_free_hwxmits(padapter);
@ -596,23 +600,31 @@ u8 qos_acm(u8 acm_mask, u8 priority)
return priority;
}
static void set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
static int set_qos(struct pkt_file *ppktfile, struct pkt_attrib *pattrib)
{
struct ethhdr etherhdr;
struct iphdr ip_hdr;
s32 UserPriority = 0;
int ret;
_rtw_open_pktfile(ppktfile->pkt, ppktfile);
_rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);
ret = _rtw_pktfile_read(ppktfile, (unsigned char *)&etherhdr, ETH_HLEN);
if (ret < 0)
return ret;
/* get UserPriority from IP hdr */
if (pattrib->ether_type == 0x0800) {
_rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
ret = _rtw_pktfile_read(ppktfile, (u8 *)&ip_hdr, sizeof(ip_hdr));
if (ret < 0)
return ret;
UserPriority = ip_hdr.tos >> 5;
}
pattrib->priority = UserPriority;
pattrib->hdrlen = WLAN_HDR_A3_QOS_LEN;
pattrib->subtype = WIFI_QOS_DATA_TYPE;
return 0;
}
static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct pkt_attrib *pattrib)
@ -626,9 +638,12 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct qos_priv *pqospriv = &pmlmepriv->qospriv;
signed int res = _SUCCESS;
int ret;
_rtw_open_pktfile(pkt, &pktfile);
_rtw_pktfile_read(&pktfile, (u8 *)&etherhdr, ETH_HLEN);
ret = _rtw_pktfile_read(&pktfile, (u8 *)&etherhdr, ETH_HLEN);
if (ret < 0)
return ret;
pattrib->ether_type = ntohs(etherhdr.h_proto);
@ -655,7 +670,9 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
u8 tmp[24];
_rtw_pktfile_read(&pktfile, &tmp[0], 24);
ret = _rtw_pktfile_read(&pktfile, &tmp[0], 24);
if (ret < 0)
return ret;
pattrib->dhcp_pkt = 0;
if (pktfile.pkt_len > 282) {/* MINIMUM_DHCP_PACKET_SIZE) { */
@ -715,8 +732,9 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
if (!(psta->state & _FW_LINKED))
return _FAIL;
/* TODO:_lock */
spin_lock_bh(&psta->lock);
if (update_attrib_sec_info(padapter, pattrib, psta) == _FAIL) {
spin_unlock_bh(&psta->lock);
res = _FAIL;
goto exit;
}
@ -724,7 +742,7 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
update_attrib_phy_info(padapter, pattrib, psta);
pattrib->psta = psta;
/* TODO:_unlock */
spin_unlock_bh(&psta->lock);
pattrib->pctrl = 0;
@ -736,12 +754,17 @@ static s32 update_attrib(struct adapter *padapter, struct sk_buff *pkt, struct p
pattrib->subtype = WIFI_DATA_TYPE;
pattrib->priority = 0;
if (check_fwstate(pmlmepriv, WIFI_AP_STATE|WIFI_ADHOC_STATE|WIFI_ADHOC_MASTER_STATE)) {
if (pattrib->qos_en)
set_qos(&pktfile, pattrib);
if (check_fwstate(pmlmepriv, WIFI_AP_STATE | WIFI_ADHOC_STATE | WIFI_ADHOC_MASTER_STATE)) {
if (pattrib->qos_en) {
ret = set_qos(&pktfile, pattrib);
if (ret < 0)
return ret;
}
} else {
if (pqospriv->qos_option) {
set_qos(&pktfile, pattrib);
ret = set_qos(&pktfile, pattrib);
if (ret < 0)
return ret;
if (pmlmepriv->acm_mask != 0)
pattrib->priority = qos_acm(pmlmepriv->acm_mask, pattrib->priority);
@ -787,15 +810,15 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr
rtw_secmicsetkey(&micdata, &pattrib->dot11tkiptxmickey.skey[0]);
}
if (pframe[1]&1) { /* ToDS == 1 */
if (pframe[1] & 1) { /* ToDS == 1 */
rtw_secmicappend(&micdata, &pframe[16], 6); /* DA */
if (pframe[1]&2) /* From Ds == 1 */
if (pframe[1] & 2) /* From Ds == 1 */
rtw_secmicappend(&micdata, &pframe[24], 6);
else
rtw_secmicappend(&micdata, &pframe[10], 6);
} else { /* ToDS == 0 */
rtw_secmicappend(&micdata, &pframe[4], 6); /* DA */
if (pframe[1]&2) /* From Ds == 1 */
if (pframe[1] & 2) /* From Ds == 1 */
rtw_secmicappend(&micdata, &pframe[16], 6);
else
rtw_secmicappend(&micdata, &pframe[10], 6);
@ -810,16 +833,20 @@ static s32 xmitframe_addmic(struct adapter *padapter, struct xmit_frame *pxmitfr
for (curfragnum = 0; curfragnum < pattrib->nr_frags; curfragnum++) {
payload = (u8 *)round_up((SIZE_PTR)(payload), 4);
payload = payload+pattrib->hdrlen+pattrib->iv_len;
payload = payload + pattrib->hdrlen + pattrib->iv_len;
if ((curfragnum+1) == pattrib->nr_frags) {
length = pattrib->last_txcmdsz-pattrib->hdrlen-pattrib->iv_len-((pattrib->bswenc) ? pattrib->icv_len : 0);
if ((curfragnum + 1) == pattrib->nr_frags) {
length = pattrib->last_txcmdsz - pattrib->hdrlen -
pattrib->iv_len -
((pattrib->bswenc) ? pattrib->icv_len : 0);
rtw_secmicappend(&micdata, payload, length);
payload = payload+length;
payload = payload + length;
} else {
length = pxmitpriv->frag_len-pattrib->hdrlen-pattrib->iv_len-((pattrib->bswenc) ? pattrib->icv_len : 0);
length = pxmitpriv->frag_len - pattrib->hdrlen -
pattrib->iv_len -
((pattrib->bswenc) ? pattrib->icv_len : 0);
rtw_secmicappend(&micdata, payload, length);
payload = payload+length+pattrib->icv_len;
payload = payload + length + pattrib->icv_len;
}
}
rtw_secgetmic(&micdata, &mic[0]);
@ -1039,6 +1066,7 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
s32 bmcst = is_multicast_ether_addr(pattrib->ra);
s32 res = _SUCCESS;
int ret;
if (!pxmitframe->buf_addr)
return _FAIL;
@ -1054,7 +1082,9 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
}
_rtw_open_pktfile(pkt, &pktfile);
_rtw_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen);
ret = _rtw_pktfile_read(&pktfile, NULL, pattrib->pkt_hdrlen);
if (ret < 0)
return ret;
frg_inx = 0;
frg_len = pxmitpriv->frag_len - 4;/* 2346-4 = 2342 */
@ -1096,6 +1126,9 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
mem_sz = _rtw_pktfile_read(&pktfile, pframe, mpdu_len);
}
if (mem_sz < 0)
return mem_sz;
pframe += mem_sz;
if ((pattrib->icv_len > 0) && (pattrib->bswenc)) {
@ -1108,8 +1141,10 @@ s32 rtw_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, struct
if (bmcst || (rtw_endofpktfile(&pktfile) == true)) {
pattrib->nr_frags = frg_inx;
pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len + ((pattrib->nr_frags == 1) ? llc_sz:0) +
((pattrib->bswenc) ? pattrib->icv_len : 0) + mem_sz;
pattrib->last_txcmdsz = pattrib->hdrlen + pattrib->iv_len +
((pattrib->nr_frags == 1) ? llc_sz : 0) +
((pattrib->bswenc) ? pattrib->icv_len : 0) +
mem_sz;
ClearMFrag(mem_start);
@ -1158,8 +1193,8 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s
mem_start = pframe = (u8 *)(pxmitframe->buf_addr) + TXDESC_OFFSET;
pwlanhdr = (struct ieee80211_hdr *)pframe;
ori_len = BIP_AAD_SIZE+pattrib->pktlen;
tmp_buf = BIP_AAD = rtw_zmalloc(ori_len);
ori_len = BIP_AAD_SIZE + pattrib->pktlen;
tmp_buf = BIP_AAD = kzalloc(ori_len, GFP_ATOMIC);
subtype = GetFrameSubType(pframe); /* bit(7)~bit(2) */
if (!BIP_AAD)
@ -1211,14 +1246,14 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s
/* conscruct AAD, copy address 1 to address 3 */
memcpy(BIP_AAD + 2, &pwlanhdr->addrs, sizeof(pwlanhdr->addrs));
/* copy management fram body */
memcpy(BIP_AAD+BIP_AAD_SIZE, MGMT_body, frame_body_len);
memcpy(BIP_AAD + BIP_AAD_SIZE, MGMT_body, frame_body_len);
/* calculate mic */
if (omac1_aes_128(padapter->securitypriv.dot11wBIPKey[padapter->securitypriv.dot11wBIPKeyid].skey
, BIP_AAD, BIP_AAD_SIZE+frame_body_len, mic))
, BIP_AAD, BIP_AAD_SIZE + frame_body_len, mic))
goto xmitframe_coalesce_fail;
/* copy right BIP mic value, total is 128bits, we use the 0~63 bits */
memcpy(pframe-8, mic, 8);
memcpy(pframe - 8, mic, 8);
} else { /* unicast mgmt frame TX */
/* start to encrypt mgmt frame */
if (subtype == WIFI_DEAUTH || subtype == WIFI_DISASSOC ||
@ -1267,9 +1302,10 @@ s32 rtw_mgmt_xmitframe_coalesce(struct adapter *padapter, struct sk_buff *pkt, s
memcpy(pframe, pattrib->iv, pattrib->iv_len);
pframe += pattrib->iv_len;
/* copy mgmt data portion after CCMP header */
memcpy(pframe, tmp_buf+pattrib->hdrlen, pattrib->pktlen-pattrib->hdrlen);
memcpy(pframe, tmp_buf + pattrib->hdrlen,
pattrib->pktlen - pattrib->hdrlen);
/* move pframe to end of mgmt pkt */
pframe += pattrib->pktlen-pattrib->hdrlen;
pframe += pattrib->pktlen - pattrib->hdrlen;
/* add 8 bytes CCMP IV header to length */
pattrib->pktlen += pattrib->iv_len;
if ((pattrib->icv_len > 0) && (pattrib->bswenc)) {
@ -1375,7 +1411,7 @@ void rtw_count_tx_stats(struct adapter *padapter, struct xmit_frame *pxmitframe,
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
u8 pkt_num = 1;
if ((pxmitframe->frame_tag&0x0f) == DATA_FRAMETAG) {
if ((pxmitframe->frame_tag & 0x0f) == DATA_FRAMETAG) {
pkt_num = pxmitframe->agg_num;
pmlmepriv->LinkDetectInfo.NumTxOkInPeriod += pkt_num;
@ -1662,8 +1698,7 @@ struct xmit_frame *rtw_alloc_xmitframe_once(struct xmit_priv *pxmitpriv)
struct xmit_frame *pxframe = NULL;
u8 *alloc_addr;
alloc_addr = rtw_zmalloc(sizeof(struct xmit_frame) + 4);
alloc_addr = kzalloc(sizeof(*pxframe) + 4, GFP_ATOMIC);
if (!alloc_addr)
goto exit;
@ -1707,8 +1742,6 @@ s32 rtw_free_xmitframe(struct xmit_priv *pxmitpriv, struct xmit_frame *pxmitfram
queue = &pxmitpriv->free_xmit_queue;
else if (pxmitframe->ext_tag == 1)
queue = &pxmitpriv->free_xframe_ext_queue;
else {
}
spin_lock_bh(&queue->lock);
@ -1836,8 +1869,7 @@ s32 rtw_alloc_hwxmits(struct adapter *padapter)
pxmitpriv->hwxmits = NULL;
pxmitpriv->hwxmits = rtw_zmalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry);
pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry, sizeof(*hwxmits), GFP_ATOMIC);
if (!pxmitpriv->hwxmits)
return _FAIL;
@ -1958,7 +1990,7 @@ s32 rtw_xmit(struct adapter *padapter, struct sk_buff **ppkt)
res = update_attrib(padapter, *ppkt, &pxmitframe->attrib);
if (res == _FAIL) {
if (res != _SUCCESS) {
rtw_free_xmitframe(pxmitpriv, pxmitframe);
return -1;
}
@ -2070,7 +2102,7 @@ signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct x
spin_lock_bh(&psta->sleep_q.lock);
if (psta->state&WIFI_SLEEP_STATE) {
if (psta->state & WIFI_SLEEP_STATE) {
u8 wmmps_ac = 0;
if (pstapriv->sta_dz_bitmap & BIT(psta->aid)) {
@ -2083,20 +2115,20 @@ signed int xmitframe_enqueue_for_sleeping_sta(struct adapter *padapter, struct x
switch (pattrib->priority) {
case 1:
case 2:
wmmps_ac = psta->uapsd_bk&BIT(0);
wmmps_ac = psta->uapsd_bk & BIT(0);
break;
case 4:
case 5:
wmmps_ac = psta->uapsd_vi&BIT(0);
wmmps_ac = psta->uapsd_vi & BIT(0);
break;
case 6:
case 7:
wmmps_ac = psta->uapsd_vo&BIT(0);
wmmps_ac = psta->uapsd_vo & BIT(0);
break;
case 0:
case 3:
default:
wmmps_ac = psta->uapsd_be&BIT(0);
wmmps_ac = psta->uapsd_be & BIT(0);
break;
}
@ -2214,20 +2246,20 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
wmmps_ac = psta->uapsd_bk&BIT(1);
wmmps_ac = psta->uapsd_bk & BIT(1);
break;
case 4:
case 5:
wmmps_ac = psta->uapsd_vi&BIT(1);
wmmps_ac = psta->uapsd_vi & BIT(1);
break;
case 6:
case 7:
wmmps_ac = psta->uapsd_vo&BIT(1);
wmmps_ac = psta->uapsd_vo & BIT(1);
break;
case 0:
case 3:
default:
wmmps_ac = psta->uapsd_be&BIT(1);
wmmps_ac = psta->uapsd_be & BIT(1);
break;
}
@ -2259,7 +2291,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)
pstapriv->tim_bitmap &= ~BIT(psta->aid);
if (psta->state&WIFI_SLEEP_STATE)
if (psta->state & WIFI_SLEEP_STATE)
psta->state ^= WIFI_SLEEP_STATE;
if (psta->state & WIFI_STA_ALIVE_CHK_STATE) {
@ -2274,7 +2306,7 @@ void wakeup_sta_to_xmit(struct adapter *padapter, struct sta_info *psta)
if (!psta_bmc)
goto _exit;
if ((pstapriv->sta_dz_bitmap&0xfffe) == 0x0) { /* no any sta in ps mode */
if ((pstapriv->sta_dz_bitmap & 0xfffe) == 0x0) { /* no any sta in ps mode */
xmitframe_phead = get_list_head(&psta_bmc->sleep_q);
list_for_each_safe(xmitframe_plist, tmp, xmitframe_phead) {
pxmitframe = list_entry(xmitframe_plist,
@ -2327,20 +2359,20 @@ void xmit_delivery_enabled_frames(struct adapter *padapter, struct sta_info *pst
switch (pxmitframe->attrib.priority) {
case 1:
case 2:
wmmps_ac = psta->uapsd_bk&BIT(1);
wmmps_ac = psta->uapsd_bk & BIT(1);
break;
case 4:
case 5:
wmmps_ac = psta->uapsd_vi&BIT(1);
wmmps_ac = psta->uapsd_vi & BIT(1);
break;
case 6:
case 7:
wmmps_ac = psta->uapsd_vo&BIT(1);
wmmps_ac = psta->uapsd_vo & BIT(1);
break;
case 0:
case 3:
default:
wmmps_ac = psta->uapsd_be&BIT(1);
wmmps_ac = psta->uapsd_be & BIT(1);
break;
}

View file

@ -1,23 +1,21 @@
// SPDX-License-Identifier: GPL-2.0
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
******************************************************************************/
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
******************************************************************************/
#include <linux/kernel.h>
#include "odm_precomp.h"
static bool CheckPositive(
struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2
)
static bool CheckPositive(struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2)
{
u8 _BoardType =
((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */
((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */
((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */
((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */
((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */
((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */
((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */
((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */
((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */
((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */
u32 cond1 = Condition1, cond2 = Condition2;
u32 driver1 =
@ -33,8 +31,7 @@ static bool CheckPositive(
pDM_Odm->TypeALNA << 16 |
pDM_Odm->TypeAPA << 24;
/* Value Defined Check =============== */
/* Value Defined Check =============== */
/* QFN Type [15:12] and Cut Version [27:24] need to do value check */
if (((cond1 & 0x0000F000) != 0) && ((cond1 & 0x0000F000) != (driver1 & 0x0000F000)))
@ -42,16 +39,16 @@ static bool CheckPositive(
if (((cond1 & 0x0F000000) != 0) && ((cond1 & 0x0F000000) != (driver1 & 0x0F000000)))
return false;
/* Bit Defined Check ================ */
/* We don't care [31:28] and [23:20] */
/* */
/* Bit Defined Check ================ */
/* We don't care [31:28] and [23:20] */
/* */
cond1 &= 0x000F0FFF;
driver1 &= 0x000F0FFF;
if ((cond1 & driver1) == cond1) {
u32 bitMask = 0;
if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */
if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */
return true;
if ((cond1 & BIT0) != 0) /* GLNA */
@ -63,7 +60,7 @@ static bool CheckPositive(
if ((cond1 & BIT3) != 0) /* APA */
bitMask |= 0xFF000000;
/* BoardType of each RF path is matched */
/* BoardType of each RF path is matched */
if ((cond2 & bitMask) == (driver2 & bitMask))
return true;
}
@ -71,8 +68,8 @@ static bool CheckPositive(
}
/******************************************************************************
* AGC_TAB.TXT
******************************************************************************/
* AGC_TAB.TXT
******************************************************************************/
static u32 Array_MP_8723B_AGC_TAB[] = {
0xC78, 0xFD000001,
@ -217,18 +214,18 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm)
for (i = 0; i < ArrayLen; i += 2) {
u32 v1 = Array[i];
u32 v2 = Array[i+1];
u32 v2 = Array[i + 1];
/* This (offset, data) pair doesn't care the condition. */
/* This (offset, data) pair doesn't care the condition. */
if (v1 < 0x40000000) {
odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2);
continue;
} else {
/* This line is the beginning of branch. */
/* This line is the beginning of branch. */
bool bMatched = true;
u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
u8 cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
if (cCond == COND_ELSE) { /* ELSE, ENDIF */
if (cCond == COND_ELSE) { /* ELSE, ENDIF */
bMatched = true;
READ_NEXT_PAIR(v1, v2, i);
} else if (!CheckPositive(pDM_Odm, v1, v2)) {
@ -242,25 +239,26 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm)
}
if (!bMatched) {
/* Condition isn't matched.
* Discard the following (offset, data) pairs.
*/
while (v1 < 0x40000000 && i < ArrayLen-2)
/*
* Condition isn't matched.
* Discard the following (offset, data) pairs.
*/
while (v1 < 0x40000000 && i < ArrayLen - 2)
READ_NEXT_PAIR(v1, v2, i);
i -= 2; /* prevent from for-loop += 2 */
i -= 2; /* prevent from for-loop += 2 */
} else {
/* Configure matched pairs and skip to end of if-else. */
while (v1 < 0x40000000 && i < ArrayLen-2) {
/* Configure matched pairs and skip to end of if-else. */
while (v1 < 0x40000000 && i < ArrayLen - 2) {
odm_ConfigBB_AGC_8723B(pDM_Odm, v1, bMaskDWord, v2);
READ_NEXT_PAIR(v1, v2, i);
}
/* Keeps reading until ENDIF. */
cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
while (cCond != COND_ENDIF && i < ArrayLen-2) {
/* Keeps reading until ENDIF. */
cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
while (cCond != COND_ENDIF && i < ArrayLen - 2) {
READ_NEXT_PAIR(v1, v2, i);
cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
}
}
}
@ -268,8 +266,8 @@ void ODM_ReadAndConfig_MP_8723B_AGC_TAB(struct dm_odm_t *pDM_Odm)
}
/******************************************************************************
* PHY_REG.TXT
******************************************************************************/
* PHY_REG.TXT
******************************************************************************/
static u32 Array_MP_8723B_PHY_REG[] = {
0x800, 0x80040000,
@ -476,18 +474,18 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm)
for (i = 0; i < ArrayLen; i += 2) {
u32 v1 = Array[i];
u32 v2 = Array[i+1];
u32 v2 = Array[i + 1];
/* This (offset, data) pair doesn't care the condition. */
/* This (offset, data) pair doesn't care the condition. */
if (v1 < 0x40000000) {
odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2);
continue;
} else {
/* This line is the beginning of branch. */
/* This line is the beginning of branch. */
bool bMatched = true;
u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
u8 cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
if (cCond == COND_ELSE) { /* ELSE, ENDIF */
if (cCond == COND_ELSE) { /* ELSE, ENDIF */
bMatched = true;
READ_NEXT_PAIR(v1, v2, i);
} else if (!CheckPositive(pDM_Odm, v1, v2)) {
@ -501,24 +499,25 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm)
}
if (!bMatched) {
/* Condition isn't matched.
* Discard the following (offset, data) pairs.
*/
while (v1 < 0x40000000 && i < ArrayLen-2)
/*
* Condition isn't matched.
* Discard the following (offset, data) pairs.
*/
while (v1 < 0x40000000 && i < ArrayLen - 2)
READ_NEXT_PAIR(v1, v2, i);
i -= 2; /* prevent from for-loop += 2 */
} else { /* Configure matched pairs and skip to end of if-else. */
while (v1 < 0x40000000 && i < ArrayLen-2) {
i -= 2; /* prevent from for-loop += 2 */
} else { /* Configure matched pairs and skip to end of if-else. */
while (v1 < 0x40000000 && i < ArrayLen - 2) {
odm_ConfigBB_PHY_8723B(pDM_Odm, v1, bMaskDWord, v2);
READ_NEXT_PAIR(v1, v2, i);
}
/* Keeps reading until ENDIF. */
cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
while (cCond != COND_ENDIF && i < ArrayLen-2) {
/* Keeps reading until ENDIF. */
cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
while (cCond != COND_ENDIF && i < ArrayLen - 2) {
READ_NEXT_PAIR(v1, v2, i);
cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
}
}
}
@ -526,8 +525,8 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG(struct dm_odm_t *pDM_Odm)
}
/******************************************************************************
* PHY_REG_PG.TXT
******************************************************************************/
* PHY_REG_PG.TXT
******************************************************************************/
static u32 Array_MP_8723B_PHY_REG_PG[] = {
0, 0x00000e08, 0x0000ff00, 0x00003800,
@ -548,9 +547,9 @@ void ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(struct dm_odm_t *pDM_Odm)
for (i = 0; i < ARRAY_SIZE(Array_MP_8723B_PHY_REG_PG); i += 4) {
u32 v1 = Array[i];
u32 v2 = Array[i+1];
u32 v3 = Array[i+2];
u32 v4 = Array[i+3];
u32 v2 = Array[i + 1];
u32 v3 = Array[i + 2];
u32 v4 = Array[i + 3];
odm_ConfigBB_PHY_REG_PG_8723B(pDM_Odm, v1, v2, v3, v4);
}

View file

@ -1,17 +1,16 @@
/* SPDX-License-Identifier: GPL-2.0 */
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
******************************************************************************/
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
******************************************************************************/
#ifndef __INC_MP_BB_HW_IMG_8723B_H
#define __INC_MP_BB_HW_IMG_8723B_H
/******************************************************************************
* AGC_TAB.TXT
******************************************************************************/
* AGC_TAB.TXT
******************************************************************************/
void
ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */
@ -19,8 +18,8 @@ ODM_ReadAndConfig_MP_8723B_AGC_TAB(/* TC: Test Chip, MP: MP Chip */
);
/******************************************************************************
* PHY_REG.TXT
******************************************************************************/
* PHY_REG.TXT
******************************************************************************/
void
ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */
@ -28,8 +27,8 @@ ODM_ReadAndConfig_MP_8723B_PHY_REG(/* TC: Test Chip, MP: MP Chip */
);
/******************************************************************************
* PHY_REG_PG.TXT
******************************************************************************/
* PHY_REG_PG.TXT
******************************************************************************/
void
ODM_ReadAndConfig_MP_8723B_PHY_REG_PG(/* TC: Test Chip, MP: MP Chip */

View file

@ -1,23 +1,21 @@
// SPDX-License-Identifier: GPL-2.0
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
******************************************************************************/
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
******************************************************************************/
#include <linux/kernel.h>
#include "odm_precomp.h"
static bool CheckPositive(
struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2
)
static bool CheckPositive(struct dm_odm_t *pDM_Odm, const u32 Condition1, const u32 Condition2)
{
u8 _BoardType =
((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */
((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */
((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */
((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */
((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */
((pDM_Odm->BoardType & BIT4) >> 4) << 0 | /* _GLNA */
((pDM_Odm->BoardType & BIT3) >> 3) << 1 | /* _GPA */
((pDM_Odm->BoardType & BIT7) >> 7) << 2 | /* _ALNA */
((pDM_Odm->BoardType & BIT6) >> 6) << 3 | /* _APA */
((pDM_Odm->BoardType & BIT2) >> 2) << 4; /* _BT */
u32 cond1 = Condition1, cond2 = Condition2;
u32 driver1 =
@ -33,8 +31,7 @@ static bool CheckPositive(
pDM_Odm->TypeALNA << 16 |
pDM_Odm->TypeAPA << 24;
/* Value Defined Check =============== */
/* Value Defined Check =============== */
/* QFN Type [15:12] and Cut Version [27:24] need to do value check */
if (((cond1 & 0x0000F000) != 0) && ((cond1 & 0x0000F000) != (driver1 & 0x0000F000)))
@ -42,15 +39,16 @@ static bool CheckPositive(
if (((cond1 & 0x0F000000) != 0) && ((cond1 & 0x0F000000) != (driver1 & 0x0F000000)))
return false;
/* Bit Defined Check ================ */
/* We don't care [31:28] and [23:20] */
/* */
/* Bit Defined Check ================ */
/* We don't care [31:28] and [23:20] */
/* */
cond1 &= 0x000F0FFF;
driver1 &= 0x000F0FFF;
if ((cond1 & driver1) == cond1) {
u32 bitMask = 0;
if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */
if ((cond1 & 0x0F) == 0) /* BoardType is DONTCARE */
return true;
if ((cond1 & BIT0) != 0) /* GLNA */
@ -62,15 +60,16 @@ static bool CheckPositive(
if ((cond1 & BIT3) != 0) /* APA */
bitMask |= 0xFF000000;
if ((cond2 & bitMask) == (driver2 & bitMask)) /* BoardType of each RF path is matched */
/* BoardType of each RF path is matched */
if ((cond2 & bitMask) == (driver2 & bitMask))
return true;
}
return false;
}
/******************************************************************************
* MAC_REG.TXT
******************************************************************************/
* MAC_REG.TXT
******************************************************************************/
static u32 Array_MP_8723B_MAC_REG[] = {
0x02F, 0x00000030,
@ -187,18 +186,18 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct dm_odm_t *pDM_Odm)
for (i = 0; i < ArrayLen; i += 2) {
u32 v1 = Array[i];
u32 v2 = Array[i+1];
u32 v2 = Array[i + 1];
/* This (offset, data) pair doesn't care the condition. */
/* This (offset, data) pair doesn't care the condition. */
if (v1 < 0x40000000) {
odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2);
continue;
} else {
/* This line is the beginning of branch. */
/* This line is the beginning of branch. */
bool bMatched = true;
u8 cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
u8 cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
if (cCond == COND_ELSE) { /* ELSE, ENDIF */
if (cCond == COND_ELSE) { /* ELSE, ENDIF */
bMatched = true;
READ_NEXT_PAIR(v1, v2, i);
} else if (!CheckPositive(pDM_Odm, v1, v2)) {
@ -212,22 +211,25 @@ void ODM_ReadAndConfig_MP_8723B_MAC_REG(struct dm_odm_t *pDM_Odm)
}
if (!bMatched) {
/* Condition isn't matched. Discard the following (offset, data) pairs. */
while (v1 < 0x40000000 && i < ArrayLen-2)
/*
* Condition isn't matched.
* Discard the following (offset, data) pairs.
*/
while (v1 < 0x40000000 && i < ArrayLen - 2)
READ_NEXT_PAIR(v1, v2, i);
i -= 2; /* prevent from for-loop += 2 */
} else { /* Configure matched pairs and skip to end of if-else. */
while (v1 < 0x40000000 && i < ArrayLen-2) {
i -= 2; /* prevent from for-loop += 2 */
} else { /* Configure matched pairs and skip to end of if-else. */
while (v1 < 0x40000000 && i < ArrayLen - 2) {
odm_ConfigMAC_8723B(pDM_Odm, v1, (u8)v2);
READ_NEXT_PAIR(v1, v2, i);
}
/* Keeps reading until ENDIF. */
cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
while (cCond != COND_ENDIF && i < ArrayLen-2) {
/* Keeps reading until ENDIF. */
cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
while (cCond != COND_ENDIF && i < ArrayLen - 2) {
READ_NEXT_PAIR(v1, v2, i);
cCond = (u8)((v1 & (BIT29|BIT28)) >> 28);
cCond = (u8)((v1 & (BIT29 | BIT28)) >> 28);
}
}
}

View file

@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/******************************************************************************
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
******************************************************************************/
*
* Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
*
******************************************************************************/
#include <linux/kernel.h>
#include "odm_precomp.h"
@ -79,8 +79,8 @@ static bool CheckPositive(
}
/******************************************************************************
* RadioA.TXT
******************************************************************************/
* RadioA.TXT
******************************************************************************/
static u32 Array_MP_8723B_RadioA[] = {
0x000, 0x00010000,
@ -243,9 +243,10 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(struct dm_odm_t *pDM_Odm)
}
if (!bMatched) {
/* Condition isn't matched.
* Discard the following (offset, data) pairs.
*/
/*
* Condition isn't matched.
* Discard the following (offset, data) pairs.
*/
while (v1 < 0x40000000 && i < ArrayLen-2)
READ_NEXT_PAIR(v1, v2, i);
@ -269,8 +270,8 @@ void ODM_ReadAndConfig_MP_8723B_RadioA(struct dm_odm_t *pDM_Odm)
}
/******************************************************************************
* TxPowerTrack_SDIO.TXT
******************************************************************************/
* TxPowerTrack_SDIO.TXT
******************************************************************************/
static u8 gDeltaSwingTableIdx_MP_2GB_N_TxPowerTrack_SDIO_8723B[] = {
0, 0, 1, 2, 2, 2, 3, 3, 3, 4, 5, 5, 6, 6, 6, 6,
@ -354,8 +355,8 @@ void ODM_ReadAndConfig_MP_8723B_TxPowerTrack_SDIO(struct dm_odm_t *pDM_Odm)
}
/******************************************************************************
* TXPWR_LMT.TXT
******************************************************************************/
* TXPWR_LMT.TXT
******************************************************************************/
static u8 *Array_MP_8723B_TXPWR_LMT[] = {
"FCC", "20M", "CCK", "1T", "01", "32",

View file

@ -1078,6 +1078,7 @@ void ODM_SetIQCbyRFpath(struct dm_odm_t *pDM_Odm, u32 RFpath)
{
struct odm_rf_cal_t *pRFCalibrateInfo = &pDM_Odm->RFCalibrateInfo;
u8 path;
if (
(pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL] != 0x0) &&
@ -1085,23 +1086,18 @@ void ODM_SetIQCbyRFpath(struct dm_odm_t *pDM_Odm, u32 RFpath)
(pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][VAL] != 0x0) &&
(pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xC14][VAL] != 0x0)
) {
if (RFpath) { /* S1: RFpath = 0, S0:RFpath = 1 */
/* S0 TX IQC */
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC94][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC94][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC80][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC4C][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S0][IDX_0xC4C][VAL]);
/* S0 RX IQC */
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xC14][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xC14][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xCA0][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[PATH_S0][IDX_0xCA0][VAL]);
} else {
/* S1 TX IQC */
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC94][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC94][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC80][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC4C][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[PATH_S1][IDX_0xC4C][VAL]);
/* S1 RX IQC */
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xC14][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xC14][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xCA0][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[PATH_S1][IDX_0xCA0][VAL]);
}
if (RFpath)
path = PATH_S0;
else
path = PATH_S1;
/* TX IQC */
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC94][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC94][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC80][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC80][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC4C][KEY], bMaskDWord, pRFCalibrateInfo->TxIQC_8723B[path][IDX_0xC4C][VAL]);
/* RX IQC */
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[path][IDX_0xC14][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[path][IDX_0xC14][VAL]);
PHY_SetBBReg(pDM_Odm->Adapter, pRFCalibrateInfo->RxIQC_8723B[path][IDX_0xCA0][KEY], bMaskDWord, pRFCalibrateInfo->RxIQC_8723B[path][IDX_0xCA0][VAL]);
}
}

View file

@ -782,21 +782,8 @@ bool GetU1ByteIntegerFromStringInDecimal(char *Str, u8 *pInt)
void rtw_hal_check_rxfifo_full(struct adapter *adapter)
{
struct dvobj_priv *psdpriv = adapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
int save_cnt = false;
/* switch counter to RX fifo */
rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xf0);
save_cnt = true;
/* todo: other chips */
if (save_cnt) {
/* rtw_write8(adapter, REG_RXERR_RPT+3, rtw_read8(adapter, REG_RXERR_RPT+3)|0xa0); */
pdbgpriv->dbg_rx_fifo_last_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow;
pdbgpriv->dbg_rx_fifo_curr_overflow = rtw_read16(adapter, REG_RXERR_RPT);
pdbgpriv->dbg_rx_fifo_diff_overflow = pdbgpriv->dbg_rx_fifo_curr_overflow-pdbgpriv->dbg_rx_fifo_last_overflow;
}
}
static u32 Array_kfreemap[] = {

View file

@ -573,8 +573,9 @@ s8 PHY_GetTxPowerByRate(struct adapter *padapter, u8 RFPath, u8 Rate)
s8 value = 0;
u8 rateIndex = PHY_GetRateIndexOfTxPowerByRate(Rate);
if ((padapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory == 2) ||
padapter->registrypriv.RegEnableTxPowerByRate == 0)
if ((padapter->registrypriv.reg_enable_tx_power_by_rate == 2 &&
pHalData->EEPROMRegulatory == 2) ||
padapter->registrypriv.reg_enable_tx_power_by_rate == 0)
return 0;
if (RFPath >= RF_PATH_MAX)
@ -690,12 +691,12 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
struct hal_com_data *hal_data = GET_HAL_DATA(adapter);
s8 limits[10] = {0}; u8 i = 0;
if (((adapter->registrypriv.RegEnableTxPowerLimit == 2) &&
if (((adapter->registrypriv.reg_enable_tx_power_limit == 2) &&
(hal_data->EEPROMRegulatory != 1)) ||
(adapter->registrypriv.RegEnableTxPowerLimit == 0))
(adapter->registrypriv.reg_enable_tx_power_limit == 0))
return MAX_POWER_INDEX;
switch (adapter->registrypriv.RegPwrTblSel) {
switch (adapter->registrypriv.reg_pwr_tbl_sel) {
case 1:
idx_regulation = TXPWR_LMT_ETSI;
break;
@ -751,6 +752,7 @@ s8 phy_get_tx_pwr_lmt(struct adapter *adapter, u32 reg_pwr_tbl_sel,
void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter)
{
struct hal_com_data *pHalData = GET_HAL_DATA(Adapter);
struct registry_priv *r = &Adapter->registrypriv;
u8 BW40PwrBasedBm2_4G = 0x2E;
u8 regulation, bw, channel, rateSection;
s8 tempValue = 0, tempPwrLmt = 0;
@ -771,7 +773,7 @@ void PHY_ConvertTxPowerLimitToPowerIndex(struct adapter *Adapter)
else if (rateSection == 0) /* CCK */
BW40PwrBasedBm2_4G = PHY_GetTxPowerByRateBase(Adapter, rfPath, CCK);
} else
BW40PwrBasedBm2_4G = Adapter->registrypriv.RegPowerBase * 2;
BW40PwrBasedBm2_4G = r->reg_power_base * 2;
if (tempPwrLmt != MAX_POWER_INDEX) {
tempValue = tempPwrLmt - BW40PwrBasedBm2_4G;

View file

@ -207,7 +207,7 @@ void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level)
pmlmepriv = &(padapter->mlmepriv);
if (check_fwstate(pmlmepriv, WIFI_AP_STATE) == true)
add_RATid(padapter, psta, rssi_level);
add_ratid(padapter, psta, rssi_level);
else {
UpdateHalRAMask8723B(padapter, psta->mac_id, rssi_level);
}
@ -218,17 +218,6 @@ void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_l
rtl8723b_Add_RateATid(padapter, bitmap, arg, rssi_level);
}
/*Start specifical interface thread */
void rtw_hal_start_thread(struct adapter *padapter)
{
rtl8723b_start_thread(padapter);
}
/*Start specifical interface thread */
void rtw_hal_stop_thread(struct adapter *padapter)
{
rtl8723b_stop_thread(padapter);
}
u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask)
{
return PHY_QueryBBReg_8723B(padapter, RegAddr, BitMask);

View file

@ -100,9 +100,8 @@ void ODM_CfoTracking(void *pDM_VOID)
u8 Adjust_Xtal = 1;
/* 4 Support ability */
if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING)) {
if (!(pDM_Odm->SupportAbility & ODM_BB_CFO_TRACKING))
return;
}
if (!pDM_Odm->bLinked || !pDM_Odm->bOneEntryOnly) {
/* 4 No link or more than one entry */
@ -110,9 +109,9 @@ void ODM_CfoTracking(void *pDM_VOID)
} else {
/* 3 1. CFO Tracking */
/* 4 1.1 No new packet */
if (pCfoTrack->packetCount == pCfoTrack->packetCount_pre) {
if (pCfoTrack->packetCount == pCfoTrack->packetCount_pre)
return;
}
pCfoTrack->packetCount_pre = pCfoTrack->packetCount;
/* 4 1.2 Calculate CFO */
@ -133,8 +132,9 @@ void ODM_CfoTracking(void *pDM_VOID)
) {
pCfoTrack->largeCFOHit = 1;
return;
} else
pCfoTrack->largeCFOHit = 0;
}
pCfoTrack->largeCFOHit = 0;
pCfoTrack->CFO_ave_pre = CFO_ave;
/* 4 1.4 Dynamic Xtal threshold */
@ -176,11 +176,10 @@ void ODM_CfoTracking(void *pDM_VOID)
}
/* 3 2. Dynamic ATC switch */
if (CFO_ave < CFO_TH_ATC && CFO_ave > -CFO_TH_ATC) {
if (CFO_ave < CFO_TH_ATC && CFO_ave > -CFO_TH_ATC)
odm_SetATCStatus(pDM_Odm, false);
} else {
else
odm_SetATCStatus(pDM_Odm, true);
}
}
}

View file

@ -17,8 +17,8 @@ static void _FWDownloadEnable(struct adapter *padapter, bool enable)
if (enable) {
/* 8051 enable */
tmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
rtw_write8(padapter, REG_SYS_FUNC_EN+1, tmp|0x04);
tmp = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
rtw_write8(padapter, REG_SYS_FUNC_EN + 1, tmp | 0x04);
tmp = rtw_read8(padapter, REG_MCUFWDL);
rtw_write8(padapter, REG_MCUFWDL, tmp|0x01);
@ -158,23 +158,23 @@ void _8051Reset8723(struct adapter *padapter)
/* Reset 8051(WLMCU) IO wrapper */
/* 0x1c[8] = 0 */
/* Suggested by Isaac@SD1 and Gimmy@SD1, coding by Lucas@20130624 */
io_rst = rtw_read8(padapter, REG_RSV_CTRL+1);
io_rst = rtw_read8(padapter, REG_RSV_CTRL + 1);
io_rst &= ~BIT(0);
rtw_write8(padapter, REG_RSV_CTRL+1, io_rst);
rtw_write8(padapter, REG_RSV_CTRL + 1, io_rst);
cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
cpu_rst &= ~BIT(2);
rtw_write8(padapter, REG_SYS_FUNC_EN+1, cpu_rst);
rtw_write8(padapter, REG_SYS_FUNC_EN + 1, cpu_rst);
/* Enable 8051 IO wrapper */
/* 0x1c[8] = 1 */
io_rst = rtw_read8(padapter, REG_RSV_CTRL+1);
io_rst = rtw_read8(padapter, REG_RSV_CTRL + 1);
io_rst |= BIT(0);
rtw_write8(padapter, REG_RSV_CTRL+1, io_rst);
rtw_write8(padapter, REG_RSV_CTRL + 1, io_rst);
cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
cpu_rst = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
cpu_rst |= BIT(2);
rtw_write8(padapter, REG_SYS_FUNC_EN+1, cpu_rst);
rtw_write8(padapter, REG_SYS_FUNC_EN + 1, cpu_rst);
}
u8 g_fwdl_chksum_fail;
@ -259,7 +259,7 @@ exit:
void rtl8723b_FirmwareSelfReset(struct adapter *padapter)
{
struct hal_com_data *pHalData = GET_HAL_DATA(padapter);
u8 u1bTmp;
u8 val;
u8 Delay = 100;
if (
@ -268,19 +268,19 @@ void rtl8723b_FirmwareSelfReset(struct adapter *padapter)
/* 0x1cf = 0x20. Inform 8051 to reset. 2009.12.25. tynli_test */
rtw_write8(padapter, REG_HMETFR+3, 0x20);
u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
while (u1bTmp & BIT2) {
val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
while (val & BIT2) {
Delay--;
if (Delay == 0)
break;
udelay(50);
u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
}
if (Delay == 0) {
/* force firmware reset */
u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN+1);
rtw_write8(padapter, REG_SYS_FUNC_EN+1, u1bTmp&(~BIT2));
val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val & (~BIT2));
}
}
}
@ -304,8 +304,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw)
const struct firmware *fw;
struct device *device = dvobj_to_dev(padapter->dvobj);
u8 *fwfilepath;
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
u8 tmp_ps;
pFirmware = kzalloc(sizeof(struct rt_firmware), GFP_KERNEL);
@ -324,8 +322,6 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw)
/* 2. read power_state = 0xA0[1:0] */
tmp_ps = rtw_read8(padapter, 0xa0);
tmp_ps &= 0x03;
if (tmp_ps != 0x01)
pdbgpriv->dbg_downloadfw_pwr_state_cnt++;
fwfilepath = "rtlwifi/rtl8723bs_nic.bin";
@ -346,12 +342,14 @@ s32 rtl8723b_FirmwareDownload(struct adapter *padapter, bool bUsedWoWLANFw)
if (fw->size > FW_8723B_SIZE) {
rtStatus = _FAIL;
release_firmware(fw);
goto exit;
}
pFirmware->fw_buffer_sz = kmemdup(fw->data, fw->size, GFP_KERNEL);
if (!pFirmware->fw_buffer_sz) {
rtStatus = _FAIL;
release_firmware(fw);
goto exit;
}
@ -642,7 +640,7 @@ static void hal_ReadEFuse_WiFi(
if ((_offset + _size_byte) > EFUSE_MAX_MAP_LEN)
return;
efuseTbl = rtw_malloc(EFUSE_MAX_MAP_LEN);
efuseTbl = kmalloc(EFUSE_MAX_MAP_LEN, GFP_ATOMIC);
if (!efuseTbl)
return;
@ -730,7 +728,7 @@ static void hal_ReadEFuse_BT(
if ((_offset + _size_byte) > EFUSE_BT_MAP_LEN)
return;
efuseTbl = rtw_malloc(EFUSE_BT_MAP_LEN);
efuseTbl = kmalloc(EFUSE_BT_MAP_LEN, GFP_ATOMIC);
if (!efuseTbl)
return;
@ -1024,7 +1022,7 @@ void hal_notch_filter_8723b(struct adapter *adapter, bool enable)
void UpdateHalRAMask8723B(struct adapter *padapter, u32 mac_id, u8 rssi_level)
{
u32 mask, rate_bitmap;
u8 shortGIrate = false;
u8 short_gi_rate = false;
struct sta_info *psta;
struct hal_com_data *pHalData = GET_HAL_DATA(padapter);
struct dm_priv *pdmpriv = &pHalData->dmpriv;
@ -1038,7 +1036,7 @@ void UpdateHalRAMask8723B(struct adapter *padapter, u32 mac_id, u8 rssi_level)
if (!psta)
return;
shortGIrate = query_ra_short_GI(psta);
short_gi_rate = query_ra_short_GI(psta);
mask = psta->ra_mask;
@ -1051,7 +1049,7 @@ void UpdateHalRAMask8723B(struct adapter *padapter, u32 mac_id, u8 rssi_level)
mask &= ~rate_bitmap;
if (pHalData->fw_ractrl) {
rtl8723b_set_FwMacIdConfig_cmd(padapter, mac_id, psta->raid, psta->bw_mode, shortGIrate, mask);
rtl8723b_set_FwMacIdConfig_cmd(padapter, mac_id, psta->raid, psta->bw_mode, short_gi_rate, mask);
}
/* set correct initial date rate for each mac_id */
@ -1946,7 +1944,7 @@ static void hw_var_set_opmode(struct adapter *padapter, u8 variable, u8 *val)
rtw_write8(padapter, REG_BCN_CTRL, val8);
/* set net_type */
Set_MSR(padapter, mode);
set_msr(padapter, mode);
if ((mode == _HW_STATE_STATION_) || (mode == _HW_STATE_NOLINK_)) {
{
@ -2914,22 +2912,3 @@ u8 GetHalDefVar8723B(struct adapter *padapter, enum hal_def_variable variable, v
return bResult;
}
void rtl8723b_start_thread(struct adapter *padapter)
{
struct xmit_priv *xmitpriv = &padapter->xmitpriv;
xmitpriv->SdioXmitThread = kthread_run(rtl8723bs_xmit_thread, padapter, "RTWHALXT");
}
void rtl8723b_stop_thread(struct adapter *padapter)
{
struct xmit_priv *xmitpriv = &padapter->xmitpriv;
/* stop xmit_buf_thread */
if (xmitpriv->SdioXmitThread) {
complete(&xmitpriv->SdioXmitStart);
wait_for_completion(&xmitpriv->SdioXmitTerminate);
xmitpriv->SdioXmitThread = NULL;
}
}

View file

@ -338,13 +338,10 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter)
/* Read Tx Power Limit File */
PHY_InitTxPowerLimit(Adapter);
if (
Adapter->registrypriv.RegEnableTxPowerLimit == 1 ||
(Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1)
) {
ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv,
CONFIG_RF_TXPWR_LMT, 0);
}
if (Adapter->registrypriv.reg_enable_tx_power_limit == 1 ||
(Adapter->registrypriv.reg_enable_tx_power_limit == 2 &&
pHalData->EEPROMRegulatory == 1))
ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_TXPWR_LMT, 0);
/* */
/* 1. Read PHY_REG.TXT BB INIT!! */
@ -353,20 +350,18 @@ static int phy_BB8723b_Config_ParaFile(struct adapter *Adapter)
/* If EEPROM or EFUSE autoload OK, We must config by PHY_REG_PG.txt */
PHY_InitTxPowerByRate(Adapter);
if (
Adapter->registrypriv.RegEnableTxPowerByRate == 1 ||
(Adapter->registrypriv.RegEnableTxPowerByRate == 2 && pHalData->EEPROMRegulatory != 2)
) {
ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv,
CONFIG_BB_PHY_REG_PG);
if (Adapter->registrypriv.reg_enable_tx_power_by_rate == 1 ||
(Adapter->registrypriv.reg_enable_tx_power_by_rate == 2 &&
pHalData->EEPROMRegulatory != 2)) {
ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG);
if (pHalData->odmpriv.PhyRegPgValueType == PHY_REG_PG_EXACT_VALUE)
PHY_TxPowerByRateConfiguration(Adapter);
if (
Adapter->registrypriv.RegEnableTxPowerLimit == 1 ||
(Adapter->registrypriv.RegEnableTxPowerLimit == 2 && pHalData->EEPROMRegulatory == 1)
)
if (Adapter->registrypriv.reg_enable_tx_power_limit == 1 ||
(Adapter->registrypriv.reg_enable_tx_power_limit == 2 &&
pHalData->EEPROMRegulatory == 1))
PHY_ConvertTxPowerLimitToPowerIndex(Adapter);
}
@ -541,7 +536,7 @@ u8 PHY_GetTxPowerIndex(
limit = phy_get_tx_pwr_lmt(
padapter,
padapter->registrypriv.RegPwrTblSel,
padapter->registrypriv.reg_pwr_tbl_sel,
pHalData->CurrentChannelBW,
RFPath,
Rate,

View file

@ -159,12 +159,10 @@ static void rtl8723bs_c2h_packet_handler(struct adapter *padapter,
if (length == 0)
return;
tmp = rtw_zmalloc(length);
tmp = kmemdup(pbuf, length, GFP_ATOMIC);
if (!tmp)
return;
memcpy(tmp, pbuf, length);
res = rtw_c2h_packet_wk_cmd(padapter, tmp, length);
if (!res)
@ -292,7 +290,7 @@ static void rtl8723bs_recv_tasklet(struct tasklet_struct *t)
alloc_sz += 14;
}
pkt_copy = rtw_skb_alloc(alloc_sz);
pkt_copy = __dev_alloc_skb(alloc_sz, GFP_ATOMIC);
if (!pkt_copy) {
rtw_free_recvframe(precvframe, &precvpriv->free_recv_queue);
break;
@ -382,7 +380,7 @@ s32 rtl8723bs_init_recv_priv(struct adapter *padapter)
spin_lock_init(&precvpriv->recv_buf_pending_queue.lock);
n = NR_RECVBUFF * sizeof(struct recv_buf) + 4;
precvpriv->pallocated_recv_buf = rtw_zmalloc(n);
precvpriv->pallocated_recv_buf = kzalloc(n, GFP_KERNEL);
if (!precvpriv->pallocated_recv_buf) {
res = _FAIL;
goto exit;
@ -399,8 +397,7 @@ s32 rtl8723bs_init_recv_priv(struct adapter *padapter)
SIZE_PTR tmpaddr = 0;
SIZE_PTR alignment = 0;
precvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
precvbuf->pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_ATOMIC);
if (precvbuf->pskb) {
precvbuf->pskb->dev = padapter->pnetdev;

View file

@ -146,7 +146,7 @@ s32 rtl8723bs_xmit_buf_handler(struct adapter *padapter)
do {
queue_empty = rtl8723_dequeue_writeport(padapter);
/* dump secondary adapter xmitbuf */
/* dump secondary adapter xmitbuf */
} while (!queue_empty);
rtw_unregister_tx_alive(padapter);
@ -289,10 +289,10 @@ static s32 xmit_xmitframes(struct adapter *padapter, struct xmit_priv *pxmitpriv
pxmitframe->buf_addr = pxmitbuf->ptail;
ret = rtw_xmitframe_coalesce(padapter, pxmitframe->pkt, pxmitframe);
if (ret == _FAIL) {
if (ret != _SUCCESS) {
netdev_err(padapter->pnetdev,
"%s: coalesce FAIL!",
__func__);
"%s: coalesce failed with error %d\n",
__func__, ret);
/* Todo: error handler */
} else {
k++;

View file

@ -589,7 +589,7 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
struct hal_com_data *pHalData;
struct pwrctrl_priv *pwrctrlpriv;
u32 NavUpper = WiFiNavUpperUs;
u8 u1bTmp;
u8 val;
pHalData = GET_HAL_DATA(padapter);
pwrctrlpriv = adapter_to_pwrctl(padapter);
@ -780,9 +780,9 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
pHalData->SdioTxOQTMaxFreeSpace = pHalData->SdioTxOQTFreeSpace;
/* Enable MACTXEN/MACRXEN block */
u1bTmp = rtw_read8(padapter, REG_CR);
u1bTmp |= (MACTXEN | MACRXEN);
rtw_write8(padapter, REG_CR, u1bTmp);
val = rtw_read8(padapter, REG_CR);
val |= (MACTXEN | MACRXEN);
rtw_write8(padapter, REG_CR, val);
rtw_hal_set_hwreg(padapter, HW_VAR_NAV_UPPER, (u8 *)&NavUpper);
@ -848,7 +848,7 @@ u32 rtl8723bs_hal_init(struct adapter *padapter)
/* */
static void CardDisableRTL8723BSdio(struct adapter *padapter)
{
u8 u1bTmp;
u8 val;
u8 bMacPwrCtrlOn;
/* Run LPS WL RFOFF flow */
@ -856,26 +856,26 @@ static void CardDisableRTL8723BSdio(struct adapter *padapter)
/* ==== Reset digital sequence ====== */
u1bTmp = rtw_read8(padapter, REG_MCUFWDL);
if ((u1bTmp & RAM_DL_SEL) && padapter->bFWReady) /* 8051 RAM code */
val = rtw_read8(padapter, REG_MCUFWDL);
if ((val & RAM_DL_SEL) && padapter->bFWReady) /* 8051 RAM code */
rtl8723b_FirmwareSelfReset(padapter);
/* Reset MCU 0x2[10]= 0. Suggested by Filen. 2011.01.26. by tynli. */
u1bTmp = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
u1bTmp &= ~BIT(2); /* 0x2[10], FEN_CPUEN */
rtw_write8(padapter, REG_SYS_FUNC_EN + 1, u1bTmp);
val = rtw_read8(padapter, REG_SYS_FUNC_EN + 1);
val &= ~BIT(2); /* 0x2[10], FEN_CPUEN */
rtw_write8(padapter, REG_SYS_FUNC_EN + 1, val);
/* MCUFWDL 0x80[1:0]= 0 */
/* reset MCU ready status */
rtw_write8(padapter, REG_MCUFWDL, 0);
/* Reset MCU IO Wrapper, added by Roger, 2011.08.30 */
u1bTmp = rtw_read8(padapter, REG_RSV_CTRL + 1);
u1bTmp &= ~BIT(0);
rtw_write8(padapter, REG_RSV_CTRL + 1, u1bTmp);
u1bTmp = rtw_read8(padapter, REG_RSV_CTRL + 1);
u1bTmp |= BIT(0);
rtw_write8(padapter, REG_RSV_CTRL+1, u1bTmp);
val = rtw_read8(padapter, REG_RSV_CTRL + 1);
val &= ~BIT(0);
rtw_write8(padapter, REG_RSV_CTRL + 1, val);
val = rtw_read8(padapter, REG_RSV_CTRL + 1);
val |= BIT(0);
rtw_write8(padapter, REG_RSV_CTRL + 1, val);
/* ==== Reset digital sequence end ====== */
@ -886,9 +886,6 @@ static void CardDisableRTL8723BSdio(struct adapter *padapter)
u32 rtl8723bs_hal_deinit(struct adapter *padapter)
{
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
if (padapter->hw_init_completed) {
if (adapter_to_pwrctl(padapter)->bips_processing) {
if (padapter->netif_up) {
@ -921,18 +918,15 @@ u32 rtl8723bs_hal_deinit(struct adapter *padapter)
adapter_to_pwrctl(padapter)->pre_ips_type = 0;
} else {
pdbgpriv->dbg_carddisable_cnt++;
CardDisableRTL8723BSdio(padapter);
adapter_to_pwrctl(padapter)->pre_ips_type = 1;
}
} else {
pdbgpriv->dbg_carddisable_cnt++;
CardDisableRTL8723BSdio(padapter);
}
} else
pdbgpriv->dbg_deinit_fail_cnt++;
}
return _SUCCESS;
}

View file

@ -132,6 +132,7 @@ static u32 _cvrt2ftaddr(const u32 addr, u8 *pdevice_id, u16 *poffset)
static u8 sdio_read8(struct intf_hdl *intfhdl, u32 addr)
{
u32 ftaddr;
ftaddr = _cvrt2ftaddr(addr, NULL, NULL);
return sd_read8(intfhdl, ftaddr, NULL);
@ -180,7 +181,7 @@ static u32 sdio_read32(struct intf_hdl *intfhdl, u32 addr)
} else {
u8 *tmpbuf;
tmpbuf = rtw_malloc(8);
tmpbuf = kmalloc(8, GFP_ATOMIC);
if (!tmpbuf)
return SDIO_ERR_VAL32;
@ -227,9 +228,9 @@ static s32 sdio_readN(struct intf_hdl *intfhdl, u32 addr, u32 cnt, u8 *buf)
ftaddr &= ~(u16)0x3;
n = cnt + shift;
tmpbuf = rtw_malloc(n);
tmpbuf = kmalloc(n, GFP_ATOMIC);
if (!tmpbuf)
return -1;
return -ENOMEM;
err = sd_read(intfhdl, ftaddr, n, tmpbuf);
if (!err)
@ -330,9 +331,9 @@ static s32 sdio_writeN(struct intf_hdl *intfhdl, u32 addr, u32 cnt, u8 *buf)
ftaddr &= ~(u16)0x3;
n = cnt + shift;
tmpbuf = rtw_malloc(n);
tmpbuf = kmalloc(n, GFP_ATOMIC);
if (!tmpbuf)
return -1;
return -ENOMEM;
err = sd_read(intfhdl, ftaddr, 4, tmpbuf);
if (err) {
kfree(tmpbuf);
@ -502,9 +503,9 @@ static s32 _sdio_local_read(
return _sd_cmd52_read(intfhdl, addr, cnt, buf);
n = round_up(cnt, 4);
tmpbuf = rtw_malloc(n);
tmpbuf = kmalloc(n, GFP_ATOMIC);
if (!tmpbuf)
return -1;
return -ENOMEM;
err = _sd_read(intfhdl, addr, n, tmpbuf);
if (!err)
@ -543,9 +544,9 @@ s32 sdio_local_read(
return sd_cmd52_read(intfhdl, addr, cnt, buf);
n = round_up(cnt, 4);
tmpbuf = rtw_malloc(n);
tmpbuf = kmalloc(n, GFP_ATOMIC);
if (!tmpbuf)
return -1;
return -ENOMEM;
err = sd_read(intfhdl, addr, n, tmpbuf);
if (!err)
@ -582,9 +583,9 @@ s32 sdio_local_write(
)
return sd_cmd52_write(intfhdl, addr, cnt, buf);
tmpbuf = rtw_malloc(cnt);
tmpbuf = kmalloc(cnt, GFP_ATOMIC);
if (!tmpbuf)
return -1;
return -ENOMEM;
memcpy(tmpbuf, buf, cnt);
@ -809,7 +810,7 @@ static struct recv_buf *sd_recv_rxfifo(struct adapter *adapter, u32 size)
SIZE_PTR tmpaddr = 0;
SIZE_PTR alignment = 0;
recvbuf->pskb = rtw_skb_alloc(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ);
recvbuf->pskb = __dev_alloc_skb(MAX_RECVBUF_SZ + RECVBUFF_ALIGN_SZ, GFP_ATOMIC);
if (!recvbuf->pskb)
return NULL;
@ -882,7 +883,7 @@ void sd_int_dpc(struct adapter *adapter)
u8 *status;
u32 addr;
status = rtw_malloc(4);
status = kmalloc(4, GFP_ATOMIC);
if (status) {
addr = REG_TXDMA_STATUS;
hal_sdio_get_cmd_addr_8723b(adapter, WLAN_IOREG_DEVICE_ID, addr, &addr);
@ -895,7 +896,7 @@ void sd_int_dpc(struct adapter *adapter)
if (hal->sdio_hisr & SDIO_HISR_C2HCMD) {
struct c2h_evt_hdr_88xx *c2h_evt;
c2h_evt = rtw_zmalloc(16);
c2h_evt = kzalloc(16, GFP_ATOMIC);
if (c2h_evt) {
if (c2h_evt_read_88xx(adapter, (u8 *)c2h_evt) == _SUCCESS) {
if (c2h_id_filter_ccx_8723b((u8 *)c2h_evt)) {

View file

@ -156,14 +156,10 @@ struct registry_priv {
u8 notch_filter;
/* define for tx power adjust */
u8 RegEnableTxPowerLimit;
u8 RegEnableTxPowerByRate;
u8 RegPowerBase;
u8 RegPwrTblSel;
s8 TxBBSwing_2G;
u8 AmplifierType_2G;
u8 bEn_RFE;
u8 RFE_Type;
u8 reg_enable_tx_power_limit;
u8 reg_enable_tx_power_by_rate;
u8 reg_power_base;
u8 reg_pwr_tbl_sel;
u8 check_fw_ps;
u8 qos_opt_enable;
@ -177,45 +173,6 @@ struct registry_priv {
#define GET_IFACE_NUMS(padapter) (((struct adapter *)padapter)->dvobj->iface_nums)
#define GET_ADAPTER(padapter, iface_id) (((struct adapter *)padapter)->dvobj->padapters[iface_id])
struct debug_priv {
u32 dbg_sdio_free_irq_error_cnt;
u32 dbg_sdio_alloc_irq_error_cnt;
u32 dbg_sdio_free_irq_cnt;
u32 dbg_sdio_alloc_irq_cnt;
u32 dbg_sdio_deinit_error_cnt;
u32 dbg_sdio_init_error_cnt;
u32 dbg_suspend_error_cnt;
u32 dbg_suspend_cnt;
u32 dbg_resume_cnt;
u32 dbg_resume_error_cnt;
u32 dbg_deinit_fail_cnt;
u32 dbg_carddisable_cnt;
u32 dbg_carddisable_error_cnt;
u32 dbg_ps_insuspend_cnt;
u32 dbg_dev_unload_inIPS_cnt;
u32 dbg_wow_leave_ps_fail_cnt;
u32 dbg_scan_pwr_state_cnt;
u32 dbg_downloadfw_pwr_state_cnt;
u32 dbg_fw_read_ps_state_fail_cnt;
u32 dbg_leave_ips_fail_cnt;
u32 dbg_leave_lps_fail_cnt;
u32 dbg_h2c_leave32k_fail_cnt;
u32 dbg_diswow_dload_fw_fail_cnt;
u32 dbg_enwow_dload_fw_fail_cnt;
u32 dbg_ips_drvopen_fail_cnt;
u32 dbg_poll_fail_cnt;
u32 dbg_rpwm_toggle_cnt;
u32 dbg_rpwm_timeout_fail_cnt;
u64 dbg_rx_fifo_last_overflow;
u64 dbg_rx_fifo_curr_overflow;
u64 dbg_rx_fifo_diff_overflow;
u64 dbg_rx_ampdu_drop_count;
u64 dbg_rx_ampdu_forced_indicate_count;
u64 dbg_rx_ampdu_loss_count;
u64 dbg_rx_dup_mgt_frame_drop_count;
u64 dbg_rx_ampdu_window_shift_cnt;
};
struct rtw_traffic_statistics {
/* tx statistics */
u64 tx_bytes;
@ -251,8 +208,6 @@ struct dvobj_priv {
s32 processing_dev_remove;
struct debug_priv drv_dbg;
/* for local/global synchronization */
/* */
spinlock_t lock;

View file

@ -221,9 +221,6 @@ void rtw_hal_free_recv_priv(struct adapter *padapter);
void rtw_hal_update_ra_mask(struct sta_info *psta, u8 rssi_level);
void rtw_hal_add_ra_tid(struct adapter *padapter, u32 bitmap, u8 *arg, u8 rssi_level);
void rtw_hal_start_thread(struct adapter *padapter);
void rtw_hal_stop_thread(struct adapter *padapter);
void beacon_timing_control(struct adapter *padapter);
u32 rtw_hal_read_bbreg(struct adapter *padapter, u32 RegAddr, u32 BitMask);

View file

@ -506,7 +506,6 @@ join_res:
#define DEFAULT_MAX_SCAN_AGE (15 * HZ)
#define DEFAULT_FTS 2346
#define MAC_ARG(x) (x)
#define IP_ARG(x) (x)
static inline int is_multicast_mac_addr(const u8 *addr)

View file

@ -54,21 +54,10 @@
extern int RTW_STATUS_CODE(int error_code);
void *_rtw_zmalloc(u32 sz);
void *_rtw_malloc(u32 sz);
void _kfree(u8 *pbuf, u32 sz);
struct sk_buff *_rtw_skb_alloc(u32 sz);
struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb);
int _rtw_netif_rx(struct net_device *ndev, struct sk_buff *skb);
#define rtw_malloc(sz) _rtw_malloc((sz))
#define rtw_zmalloc(sz) _rtw_zmalloc((sz))
#define rtw_skb_alloc(size) _rtw_skb_alloc((size))
#define rtw_skb_alloc_f(size, mstat_f) _rtw_skb_alloc((size))
#define rtw_skb_copy(skb) _rtw_skb_copy((skb))
#define rtw_skb_copy_f(skb, mstat_f) _rtw_skb_copy((skb))
#define rtw_netif_rx(ndev, skb) _rtw_netif_rx(ndev, skb)
extern void _rtw_init_queue(struct __queue *pqueue);
@ -91,10 +80,6 @@ static inline int rtw_bug_check(void *parg1, void *parg2, void *parg3, void *par
#define _RND(sz, r) ((((sz)+((r)-1))/(r))*(r))
#ifndef MAC_ARG
#define MAC_ARG(x) (x)
#endif
extern void rtw_free_netdev(struct net_device *netdev);
/* Macros for handling unaligned memory accesses */

View file

@ -231,9 +231,6 @@ void rtl8723b_InitBeaconParameters(struct adapter *padapter);
void _InitBurstPktLen_8723BS(struct adapter *adapter);
void _8051Reset8723(struct adapter *padapter);
void rtl8723b_start_thread(struct adapter *padapter);
void rtl8723b_stop_thread(struct adapter *padapter);
int FirmwareDownloadBT(struct adapter *adapter, struct rt_firmware *firmware);
void CCX_FwC2HTxRpt_8723b(struct adapter *padapter, u8 *pdata, u8 len);

View file

@ -11,7 +11,7 @@ void init_mlme_ap_info(struct adapter *padapter);
void free_mlme_ap_info(struct adapter *padapter);
/* void update_BCNTIM(struct adapter *padapter); */
void update_beacon(struct adapter *padapter, u8 ie_id, u8 *oui, u8 tx);
void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level);
void add_ratid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level);
void expire_timeout_chk(struct adapter *padapter);
void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta);
void start_bss_network(struct adapter *padapter);

View file

@ -441,7 +441,7 @@ void Save_DM_Func_Flag(struct adapter *padapter);
void Restore_DM_Func_Flag(struct adapter *padapter);
void Switch_DM_Func(struct adapter *padapter, u32 mode, u8 enable);
void Set_MSR(struct adapter *padapter, u8 type);
void set_msr(struct adapter *padapter, u8 type);
u8 rtw_get_oper_ch(struct adapter *adapter);
void rtw_set_oper_ch(struct adapter *adapter, u8 ch);

View file

@ -35,7 +35,7 @@ void rtw_os_xmit_resource_free(struct adapter *padapter, struct xmit_buf *pxmitb
extern uint rtw_remainder_len(struct pkt_file *pfile);
extern void _rtw_open_pktfile(struct sk_buff *pkt, struct pkt_file *pfile);
extern uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen);
int _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, unsigned int rlen);
extern signed int rtw_endofpktfile(struct pkt_file *pfile);
extern void rtw_os_pkt_complete(struct adapter *padapter, struct sk_buff *pkt);

View file

@ -111,6 +111,7 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(
{
struct ieee80211_supported_band *spt_band = NULL;
int n_channels, n_bitrates;
size_t alloc_sz;
if (band == NL80211_BAND_2GHZ) {
n_channels = RTW_2G_CHANNELS_NUM;
@ -119,9 +120,10 @@ static struct ieee80211_supported_band *rtw_spt_band_alloc(
goto exit;
}
spt_band = rtw_zmalloc(sizeof(struct ieee80211_supported_band) +
sizeof(struct ieee80211_channel) * n_channels +
sizeof(struct ieee80211_rate) * n_bitrates);
alloc_sz = sizeof(*spt_band);
alloc_sz = size_add(alloc_sz, array_size(n_channels, sizeof(struct ieee80211_channel)));
alloc_sz = size_add(alloc_sz, array_size(n_bitrates, sizeof(struct ieee80211_rate)));
spt_band = kzalloc(alloc_sz, GFP_KERNEL);
if (!spt_band)
goto exit;
@ -315,9 +317,10 @@ struct cfg80211_bss *rtw_cfg80211_inform_bss(struct adapter *padapter, struct wl
len, notify_signal, GFP_ATOMIC);
if (unlikely(!bss))
goto exit;
goto free_buf;
cfg80211_put_bss(wiphy, bss);
free_buf:
kfree(buf);
exit:
@ -840,11 +843,9 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev,
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
param_len = sizeof(struct ieee_param) + params->key_len;
param = rtw_malloc(param_len);
param = kzalloc(param_len, GFP_KERNEL);
if (!param)
return -1;
memset(param, 0, param_len);
return -ENOMEM;
param->cmd = IEEE_CMD_SET_ENCRYPTION;
eth_broadcast_addr(param->sta_addr);
@ -1162,11 +1163,10 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct adapter *padapter, char *b
pmlmepriv->wps_probe_req_ie = NULL;
}
pmlmepriv->wps_probe_req_ie = rtw_malloc(wps_ielen);
pmlmepriv->wps_probe_req_ie = kmemdup(wps_ie, wps_ielen, GFP_KERNEL);
if (!pmlmepriv->wps_probe_req_ie)
return -EINVAL;
memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen);
pmlmepriv->wps_probe_req_ie_len = wps_ielen;
}
}
@ -1430,7 +1430,7 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel
goto exit;
}
buf = rtw_zmalloc(ielen);
buf = kzalloc(ielen, GFP_KERNEL);
if (!buf) {
ret = -ENOMEM;
goto exit;
@ -1714,14 +1714,12 @@ static int cfg80211_rtw_connect(struct wiphy *wiphy, struct net_device *ndev,
wep_key_len = wep_key_len <= 5 ? 5 : 13;
wep_total_len = wep_key_len +
offsetof(struct ndis_802_11_wep, key_material);
pwep = rtw_malloc(wep_total_len);
pwep = kzalloc(wep_total_len, GFP_KERNEL);
if (!pwep) {
ret = -ENOMEM;
goto exit;
}
memset(pwep, 0, wep_total_len);
pwep->key_length = wep_key_len;
pwep->length = wep_total_len;
@ -2147,7 +2145,7 @@ static int rtw_cfg80211_add_monitor_if(struct adapter *padapter, char *name, str
pnpi->sizeof_priv = sizeof(struct adapter);
/* wdev */
mon_wdev = rtw_zmalloc(sizeof(struct wireless_dev));
mon_wdev = kzalloc(sizeof(*mon_wdev), GFP_KERNEL);
if (!mon_wdev) {
ret = -ENOMEM;
goto out;
@ -2257,7 +2255,7 @@ static int rtw_add_beacon(struct adapter *adapter, const u8 *head, size_t head_l
if (head_len < 24)
return -EINVAL;
pbuf = rtw_zmalloc(head_len + tail_len);
pbuf = kzalloc(head_len + tail_len, GFP_KERNEL);
if (!pbuf)
return -ENOMEM;
@ -2728,7 +2726,7 @@ int rtw_wdev_alloc(struct adapter *padapter, struct device *dev)
goto free_wiphy;
/* wdev */
wdev = rtw_zmalloc(sizeof(struct wireless_dev));
wdev = kzalloc(sizeof(*wdev), GFP_KERNEL);
if (!wdev) {
ret = -ENOMEM;
goto unregister_wiphy;

View file

@ -6,6 +6,7 @@
******************************************************************************/
#include <drv_types.h>
#include <hal_data.h>
#include <rtl8723b_xmit.h>
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
@ -259,13 +260,10 @@ static void loadparam(struct adapter *padapter, struct net_device *pnetdev)
registry_par->notch_filter = (u8)rtw_notch_filter;
registry_par->RegEnableTxPowerLimit = (u8)rtw_tx_pwr_lmt_enable;
registry_par->RegEnableTxPowerByRate = (u8)rtw_tx_pwr_by_rate;
registry_par->reg_enable_tx_power_limit = (u8)rtw_tx_pwr_lmt_enable;
registry_par->reg_enable_tx_power_by_rate = (u8)rtw_tx_pwr_by_rate;
registry_par->RegPowerBase = 14;
registry_par->TxBBSwing_2G = 0xFF;
registry_par->bEn_RFE = 1;
registry_par->RFE_Type = 64;
registry_par->reg_power_base = 14;
registry_par->qos_opt_enable = (u8)rtw_qos_opt_enable;
@ -480,7 +478,13 @@ u32 rtw_start_drv_threads(struct adapter *padapter)
else
wait_for_completion(&padapter->cmdpriv.terminate_cmdthread_comp); /* wait for cmd_thread to run */
rtw_hal_start_thread(padapter);
padapter->xmitpriv.SdioXmitThread = kthread_run(rtl8723bs_xmit_thread,
padapter, "RTWHALXT");
if (IS_ERR(padapter->xmitpriv.SdioXmitThread)) {
padapter->xmitpriv.SdioXmitThread = NULL;
_status = _FAIL;
}
return _status;
}
@ -492,7 +496,12 @@ void rtw_stop_drv_threads(struct adapter *padapter)
complete(&padapter->xmitpriv.xmit_comp);
wait_for_completion(&padapter->xmitpriv.terminate_xmitthread_comp);
rtw_hal_stop_thread(padapter);
/* stop SdioXmitThread */
if (padapter->xmitpriv.SdioXmitThread) {
complete(&padapter->xmitpriv.SdioXmitStart);
wait_for_completion(&padapter->xmitpriv.SdioXmitTerminate);
padapter->xmitpriv.SdioXmitThread = NULL;
}
}
static void rtw_init_default_value(struct adapter *padapter)
@ -553,14 +562,13 @@ static void rtw_init_default_value(struct adapter *padapter)
padapter->fix_rate = 0xFF;
padapter->driver_ampdu_spacing = 0xFF;
padapter->driver_rx_ampdu_factor = 0xFF;
}
struct dvobj_priv *devobj_init(void)
{
struct dvobj_priv *pdvobj = NULL;
pdvobj = rtw_zmalloc(sizeof(*pdvobj));
pdvobj = kzalloc(sizeof(*pdvobj), GFP_KERNEL);
if (!pdvobj)
return NULL;
@ -898,7 +906,6 @@ void rtw_ips_pwr_down(struct adapter *padapter)
void rtw_ips_dev_unload(struct adapter *padapter)
{
if (!padapter->bSurpriseRemoved)
rtw_hal_deinit(padapter);
}
@ -934,14 +941,6 @@ static int netdev_close(struct net_device *pnetdev)
padapter->net_closed = true;
padapter->netif_up = false;
/*if (!padapter->hw_init_completed)
{
padapter->bDriverStopped = true;
rtw_dev_unload(padapter);
}
else*/
if (pwrctl->rf_pwrstate == rf_on) {
/* s1. */
if (pnetdev) {
@ -974,13 +973,10 @@ void rtw_ndev_destructor(struct net_device *ndev)
void rtw_dev_unload(struct adapter *padapter)
{
struct pwrctrl_priv *pwrctl = adapter_to_pwrctl(padapter);
struct dvobj_priv *pobjpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &pobjpriv->drv_dbg;
struct cmd_priv *pcmdpriv = &padapter->cmdpriv;
u8 cnt = 0;
if (padapter->bup) {
padapter->bDriverStopped = true;
if (padapter->xmitpriv.ack_tx)
rtw_ack_tx_done(&padapter->xmitpriv, RTW_SCTX_DONE_DRV_STOP);
@ -1005,7 +1001,6 @@ void rtw_dev_unload(struct adapter *padapter)
/* check HW status and SW state */
netdev_dbg(padapter->pnetdev,
"%s: driver in IPS-FWLPS\n", __func__);
pdbgpriv->dbg_dev_unload_inIPS_cnt++;
LeaveAllPowerSaveMode(padapter);
} else {
netdev_dbg(padapter->pnetdev,
@ -1022,7 +1017,6 @@ void rtw_dev_unload(struct adapter *padapter)
}
padapter->bup = false;
}
}
@ -1089,24 +1083,21 @@ static void rtw_suspend_normal(struct adapter *padapter)
void rtw_suspend_common(struct adapter *padapter)
{
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(psdpriv);
struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
unsigned long start_time = jiffies;
netdev_dbg(padapter->pnetdev, " suspend start\n");
pdbgpriv->dbg_suspend_cnt++;
pwrpriv->bInSuspend = true;
while (pwrpriv->bips_processing)
msleep(1);
if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved)) {
pdbgpriv->dbg_suspend_error_cnt++;
if ((!padapter->bup) || (padapter->bDriverStopped) || (padapter->bSurpriseRemoved))
return;
}
rtw_ps_deny(padapter, PS_DENY_SUSPEND);
rtw_cancel_all_timer(padapter);
@ -1134,8 +1125,6 @@ static int rtw_resume_process_normal(struct adapter *padapter)
struct net_device *pnetdev;
struct pwrctrl_priv *pwrpriv;
struct mlme_priv *pmlmepriv;
struct dvobj_priv *psdpriv;
struct debug_priv *pdbgpriv;
int ret = _SUCCESS;
@ -1147,8 +1136,6 @@ static int rtw_resume_process_normal(struct adapter *padapter)
pnetdev = padapter->pnetdev;
pwrpriv = adapter_to_pwrctl(padapter);
pmlmepriv = &padapter->mlmepriv;
psdpriv = padapter->dvobj;
pdbgpriv = &psdpriv->drv_dbg;
/* interface init */
/* if (sdio_init(adapter_to_dvobj(padapter)) != _SUCCESS) */
if ((padapter->intf_init) && (padapter->intf_init(adapter_to_dvobj(padapter)) != _SUCCESS)) {
@ -1167,7 +1154,6 @@ static int rtw_resume_process_normal(struct adapter *padapter)
if (pm_netdev_open(pnetdev, true) != 0) {
ret = -1;
pdbgpriv->dbg_resume_error_cnt++;
goto exit;
}

View file

@ -6,10 +6,7 @@
******************************************************************************/
#include <drv_types.h>
/*
* Translate the OS dependent @param error_code to OS independent RTW_STATUS_CODE
* @return: one of RTW_STATUS_CODE
*/
/* Translate the OS dependent error_code to RTW_STATUS_CODE */
inline int RTW_STATUS_CODE(int error_code)
{
if (error_code >= 0)
@ -17,31 +14,6 @@ inline int RTW_STATUS_CODE(int error_code)
return _FAIL;
}
void *_rtw_malloc(u32 sz)
{
return kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
}
void *_rtw_zmalloc(u32 sz)
{
void *pbuf = _rtw_malloc(sz);
if (pbuf)
memset(pbuf, 0, sz);
return pbuf;
}
inline struct sk_buff *_rtw_skb_alloc(u32 sz)
{
return __dev_alloc_skb(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
}
inline struct sk_buff *_rtw_skb_copy(const struct sk_buff *skb)
{
return skb_copy(skb, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
}
inline int _rtw_netif_rx(struct net_device *ndev, struct sk_buff *skb)
{
skb->dev = ndev;
@ -132,11 +104,9 @@ void rtw_buf_update(u8 **buf, u32 *buf_len, u8 *src, u32 src_len)
goto keep_ori;
/* duplicate src */
dup = rtw_malloc(src_len);
if (dup) {
dup = kmemdup(src, src_len, GFP_ATOMIC);
if (dup)
dup_len = src_len;
memcpy(dup, src, dup_len);
}
keep_ori:
ori = *buf;
@ -152,7 +122,6 @@ keep_ori:
kfree(ori);
}
/**
* rtw_cbuf_full - test if cbuf is full
* @cbuf: pointer of struct rtw_cbuf
@ -204,6 +173,7 @@ bool rtw_cbuf_push(struct rtw_cbuf *cbuf, void *buf)
void *rtw_cbuf_pop(struct rtw_cbuf *cbuf)
{
void *buf;
if (rtw_cbuf_empty(cbuf))
return NULL;
@ -223,12 +193,8 @@ struct rtw_cbuf *rtw_cbuf_alloc(u32 size)
{
struct rtw_cbuf *cbuf;
cbuf = rtw_malloc(struct_size(cbuf, bufs, size));
if (cbuf) {
cbuf->write = cbuf->read = 0;
cbuf->size = size;
}
cbuf = kzalloc(struct_size(cbuf, bufs, size), GFP_KERNEL);
cbuf->size = size;
return cbuf;
}

View file

@ -70,13 +70,10 @@ static int sdio_alloc_irq(struct dvobj_priv *dvobj)
sdio_claim_host(func);
err = sdio_claim_irq(func, &sd_sync_int_hdl);
if (err) {
dvobj->drv_dbg.dbg_sdio_alloc_irq_error_cnt++;
if (err)
netdev_crit(dvobj->if1->pnetdev, "%s: sdio_claim_irq FAIL(%d)!\n", __func__, err);
} else {
dvobj->drv_dbg.dbg_sdio_alloc_irq_cnt++;
else
dvobj->irq_alloc = 1;
}
sdio_release_host(func);
@ -97,12 +94,10 @@ static void sdio_free_irq(struct dvobj_priv *dvobj)
sdio_claim_host(func);
err = sdio_release_irq(func);
if (err) {
dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++;
netdev_err(dvobj->if1->pnetdev,
"%s: sdio_release_irq FAIL(%d)!\n",
__func__, err);
} else
dvobj->drv_dbg.dbg_sdio_free_irq_cnt++;
}
sdio_release_host(func);
}
dvobj->irq_alloc = 0;
@ -122,16 +117,13 @@ static u32 sdio_init(struct dvobj_priv *dvobj)
sdio_claim_host(func);
err = sdio_enable_func(func);
if (err) {
dvobj->drv_dbg.dbg_sdio_init_error_cnt++;
if (err)
goto release;
}
err = sdio_set_block_size(func, 512);
if (err) {
dvobj->drv_dbg.dbg_sdio_init_error_cnt++;
if (err)
goto release;
}
psdio_data->block_transfer_len = 512;
psdio_data->tx_block_mode = 1;
psdio_data->rx_block_mode = 1;
@ -147,22 +139,15 @@ release:
static void sdio_deinit(struct dvobj_priv *dvobj)
{
struct sdio_func *func;
int err;
func = dvobj->intf_data.func;
if (func) {
sdio_claim_host(func);
err = sdio_disable_func(func);
if (err)
dvobj->drv_dbg.dbg_sdio_deinit_error_cnt++;
sdio_disable_func(func);
if (dvobj->irq_alloc) {
err = sdio_release_irq(func);
if (err)
dvobj->drv_dbg.dbg_sdio_free_irq_error_cnt++;
else
dvobj->drv_dbg.dbg_sdio_free_irq_cnt++;
sdio_release_irq(func);
}
sdio_release_host(func);
@ -377,7 +362,8 @@ static int rtw_drv_init(
if (status != _SUCCESS)
goto free_if1;
if (sdio_alloc_irq(dvobj) != _SUCCESS)
status = sdio_alloc_irq(dvobj);
if (status != _SUCCESS)
goto free_if1;
status = _SUCCESS;
@ -433,15 +419,12 @@ static int rtw_sdio_suspend(struct device *dev)
struct dvobj_priv *psdpriv = sdio_get_drvdata(func);
struct pwrctrl_priv *pwrpriv = dvobj_to_pwrctl(psdpriv);
struct adapter *padapter = psdpriv->if1;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
if (padapter->bDriverStopped)
return 0;
if (pwrpriv->bInSuspend) {
pdbgpriv->dbg_suspend_error_cnt++;
if (pwrpriv->bInSuspend)
return 0;
}
rtw_suspend_common(padapter);
@ -451,13 +434,9 @@ static int rtw_sdio_suspend(struct device *dev)
static int rtw_resume_process(struct adapter *padapter)
{
struct pwrctrl_priv *pwrpriv = adapter_to_pwrctl(padapter);
struct dvobj_priv *psdpriv = padapter->dvobj;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
if (!pwrpriv->bInSuspend) {
pdbgpriv->dbg_resume_error_cnt++;
if (!pwrpriv->bInSuspend)
return -1;
}
return rtw_resume_common(padapter);
}
@ -469,9 +448,6 @@ static int rtw_sdio_resume(struct device *dev)
struct adapter *padapter = psdpriv->if1;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
int ret = 0;
struct debug_priv *pdbgpriv = &psdpriv->drv_dbg;
pdbgpriv->dbg_resume_cnt++;
ret = rtw_resume_process(padapter);

View file

@ -219,14 +219,14 @@ u32 sd_read32(struct intf_hdl *pintfhdl, u32 addr, s32 *err)
if (*err == 0) {
rtw_reset_continual_io_error(psdiodev);
break;
} else {
if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
padapter->bSurpriseRemoved = true;
}
if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
padapter->bSurpriseRemoved = true;
break;
}
if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
padapter->bSurpriseRemoved = true;
if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
padapter->bSurpriseRemoved = true;
break;
}
}
}
@ -295,14 +295,14 @@ void sd_write32(struct intf_hdl *pintfhdl, u32 addr, u32 v, s32 *err)
if (*err == 0) {
rtw_reset_continual_io_error(psdiodev);
break;
} else {
if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
padapter->bSurpriseRemoved = true;
}
if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
padapter->bSurpriseRemoved = true;
break;
}
if ((-ESHUTDOWN == *err) || (-ENODEV == *err))
padapter->bSurpriseRemoved = true;
if (rtw_inc_and_chk_continual_io_error(psdiodev) == true) {
padapter->bSurpriseRemoved = true;
break;
}
}
}

View file

@ -21,19 +21,22 @@ void _rtw_open_pktfile(struct sk_buff *pktptr, struct pkt_file *pfile)
pfile->cur_buffer = pfile->buf_start;
}
uint _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, uint rlen)
int _rtw_pktfile_read(struct pkt_file *pfile, u8 *rmem, unsigned int rlen)
{
uint len = 0;
int ret;
len = rtw_remainder_len(pfile);
len = (rlen > len) ? len : rlen;
if (rtw_remainder_len(pfile) < rlen)
return -EINVAL;
if (rmem)
skb_copy_bits(pfile->pkt, pfile->buf_len - pfile->pkt_len, rmem, len);
if (rmem) {
ret = skb_copy_bits(pfile->pkt, pfile->buf_len - pfile->pkt_len, rmem, rlen);
if (ret < 0)
return ret;
}
pfile->cur_addr += len;
pfile->pkt_len -= len;
return len;
pfile->cur_addr += rlen;
pfile->pkt_len -= rlen;
return rlen;
}
signed int rtw_endofpktfile(struct pkt_file *pfile)
@ -46,7 +49,7 @@ signed int rtw_endofpktfile(struct pkt_file *pfile)
int rtw_os_xmit_resource_alloc(struct adapter *padapter, struct xmit_buf *pxmitbuf, u32 alloc_sz, u8 flag)
{
if (alloc_sz > 0) {
pxmitbuf->pallocated_buf = rtw_zmalloc(alloc_sz);
pxmitbuf->pallocated_buf = kzalloc(alloc_sz, GFP_KERNEL);
if (!pxmitbuf->pallocated_buf)
return _FAIL;
@ -159,8 +162,7 @@ static int rtw_mlcst2unicst(struct adapter *padapter, struct sk_buff *skb)
!memcmp(psta->hwaddr, bc_addr, 6))
continue;
newskb = rtw_skb_copy(skb);
newskb = skb_copy(skb, GFP_ATOMIC);
if (newskb) {
memcpy(newskb->data, psta->hwaddr, 6);
res = rtw_xmit(padapter, &newskb);

View file

@ -1,6 +1,4 @@
TODO:
- lots of checkpatch cleanup
- use kernel coding style
- refine the code and remove unused code
- Implement hardware acceleration for imageblit if image->depth > 1
- must be ported to the atomic kms framework in the drm subsystem (which will

View file

@ -249,7 +249,7 @@ int ddk750_init_hw(struct initchip_param *p_init_param)
* Reset the memory controller.
* If the memory controller is not reset in SM750,
* the system might hang when sw accesses the memory.
* The memory should be resetted after changing the MXCLK.
* The memory should be reset after changing the MXCLK.
*/
if (p_init_param->reset_memory == 1) {
reg = peek32(MISC_CTRL);

View file

@ -740,7 +740,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
"kernel HELPERS prepared vesa_modes",
};
static const char *fixId[2] = {
static const char *fix_id[2] = {
"sm750_fb1", "sm750_fb2",
};
@ -862,7 +862,7 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index)
fix->ywrapstep = crtc->ywrapstep;
fix->accel = FB_ACCEL_SMI;
strscpy(fix->id, fixId[index], sizeof(fix->id));
strscpy(fix->id, fix_id[index], sizeof(fix->id));
fix->smem_start = crtc->o_screen + sm750_dev->vidmem_start;
pr_info("fix->smem_start = %lx\n", fix->smem_start);
@ -918,12 +918,12 @@ static void sm750fb_setup(struct sm750_dev *sm750_dev, char *src)
swap = 0;
sm750_dev->initParm.chip_clk = 0;
sm750_dev->initParm.mem_clk = 0;
sm750_dev->initParm.master_clk = 0;
sm750_dev->initParm.powerMode = 0;
sm750_dev->initParm.setAllEngOff = 0;
sm750_dev->initParm.resetMemory = 1;
sm750_dev->init_parm.chip_clk = 0;
sm750_dev->init_parm.mem_clk = 0;
sm750_dev->init_parm.master_clk = 0;
sm750_dev->init_parm.powerMode = 0;
sm750_dev->init_parm.setAllEngOff = 0;
sm750_dev->init_parm.resetMemory = 1;
/* defaultly turn g_hwcursor on for both view */
g_hwcursor = 3;

View file

@ -102,7 +102,7 @@ struct sm750_dev {
/* locks*/
spinlock_t slock;
struct init_status initParm;
struct init_status init_parm;
enum sm750_pnltype pnltype;
enum sm750_dataflow dataflow;
int nocrt;

View file

@ -27,7 +27,7 @@ static inline u32 read_dpr(struct lynx_accel *accel, int offset)
return readl(accel->dpr_base + offset);
}
static inline void write_dpPort(struct lynx_accel *accel, u32 data)
static inline void write_dp_port(struct lynx_accel *accel, u32 data)
{
writel(data, accel->dp_port_base);
}
@ -132,12 +132,12 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
/**
* sm750_hw_copyarea
* @accel: Acceleration device data
* @sBase: Address of source: offset in frame buffer
* @sPitch: Pitch value of source surface in BYTE
* @source_base: Address of source: offset in frame buffer
* @source_pitch: Pitch value of source surface in BYTE
* @sx: Starting x coordinate of source surface
* @sy: Starting y coordinate of source surface
* @dBase: Address of destination: offset in frame buffer
* @dPitch: Pitch value of destination surface in BYTE
* @dest_base: Address of destination: offset in frame buffer
* @dest_pitch: Pitch value of destination surface in BYTE
* @Bpp: Color depth of destination surface
* @dx: Starting x coordinate of destination surface
* @dy: Starting y coordinate of destination surface
@ -146,21 +146,21 @@ int sm750_hw_fillrect(struct lynx_accel *accel,
* @rop2: ROP value
*/
int sm750_hw_copyarea(struct lynx_accel *accel,
unsigned int sBase, unsigned int sPitch,
unsigned int source_base, unsigned int source_pitch,
unsigned int sx, unsigned int sy,
unsigned int dBase, unsigned int dPitch,
unsigned int dest_base, unsigned int dest_pitch,
unsigned int Bpp, unsigned int dx, unsigned int dy,
unsigned int width, unsigned int height,
unsigned int rop2)
{
unsigned int nDirection, de_ctrl;
unsigned int direction, de_ctrl;
nDirection = LEFT_TO_RIGHT;
direction = LEFT_TO_RIGHT;
/* Direction of ROP2 operation: 1 = Left to Right, (-1) = Right to Left */
de_ctrl = 0;
/* If source and destination are the same surface, need to check for overlay cases */
if (sBase == dBase && sPitch == dPitch) {
if (source_base == dest_base && source_pitch == dest_pitch) {
/* Determine direction of operation */
if (sy < dy) {
/* +----------+
@ -173,7 +173,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* +----------+
*/
nDirection = BOTTOM_TO_TOP;
direction = BOTTOM_TO_TOP;
} else if (sy > dy) {
/* +----------+
* |D |
@ -185,7 +185,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* +----------+
*/
nDirection = TOP_TO_BOTTOM;
direction = TOP_TO_BOTTOM;
} else {
/* sy == dy */
@ -198,7 +198,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* +------+---+------+
*/
nDirection = RIGHT_TO_LEFT;
direction = RIGHT_TO_LEFT;
} else {
/* sx > dx */
@ -210,12 +210,12 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* +------+---+------+
*/
nDirection = LEFT_TO_RIGHT;
direction = LEFT_TO_RIGHT;
}
}
}
if ((nDirection == BOTTOM_TO_TOP) || (nDirection == RIGHT_TO_LEFT)) {
if ((direction == BOTTOM_TO_TOP) || (direction == RIGHT_TO_LEFT)) {
sx += width - 1;
sy += height - 1;
dx += width - 1;
@ -234,14 +234,14 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* It is an address offset (128 bit aligned)
* from the beginning of frame buffer.
*/
write_dpr(accel, DE_WINDOW_SOURCE_BASE, sBase); /* dpr40 */
write_dpr(accel, DE_WINDOW_SOURCE_BASE, source_base); /* dpr40 */
/*
* 2D Destination Base.
* It is an address offset (128 bit aligned)
* from the beginning of frame buffer.
*/
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase); /* dpr44 */
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dest_base); /* dpr44 */
/*
* Program pitch (distance between the 1st points of two adjacent lines).
@ -249,9 +249,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* pixel values. Need Byte to pixel conversion.
*/
write_dpr(accel, DE_PITCH,
((dPitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
((dest_pitch / Bpp << DE_PITCH_DESTINATION_SHIFT) &
DE_PITCH_DESTINATION_MASK) |
(sPitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
(source_pitch / Bpp & DE_PITCH_SOURCE_MASK)); /* dpr10 */
/*
* Screen Window width in Pixels.
@ -259,9 +259,9 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
* for a given point.
*/
write_dpr(accel, DE_WINDOW_WIDTH,
((dPitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
((dest_pitch / Bpp << DE_WINDOW_WIDTH_DST_SHIFT) &
DE_WINDOW_WIDTH_DST_MASK) |
(sPitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */
(source_pitch / Bpp & DE_WINDOW_WIDTH_SRC_MASK)); /* dpr3c */
if (accel->de_wait() != 0)
return -1;
@ -277,7 +277,7 @@ int sm750_hw_copyarea(struct lynx_accel *accel,
(height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */
de_ctrl = (rop2 & DE_CONTROL_ROP_MASK) | DE_CONTROL_ROP_SELECT |
((nDirection == RIGHT_TO_LEFT) ? DE_CONTROL_DIRECTION : 0) |
((direction == RIGHT_TO_LEFT) ? DE_CONTROL_DIRECTION : 0) |
DE_CONTROL_COMMAND_BITBLT | DE_CONTROL_STATUS;
write_dpr(accel, DE_CONTROL, de_ctrl); /* dpr0c */
@ -299,38 +299,38 @@ static unsigned int de_get_transparency(struct lynx_accel *accel)
/**
* sm750_hw_imageblit
* @accel: Acceleration device data
* @pSrcbuf: pointer to start of source buffer in system memory
* @srcDelta: Pitch value (in bytes) of the source buffer, +ive means top down
* @src_buf: pointer to start of source buffer in system memory
* @src_delta: Pitch value (in bytes) of the source buffer, +ive means top down
* and -ive mean button up
* @startBit: Mono data can start at any bit in a byte, this value should be
* @start_bit: Mono data can start at any bit in a byte, this value should be
* 0 to 7
* @dBase: Address of destination: offset in frame buffer
* @dPitch: Pitch value of destination surface in BYTE
* @bytePerPixel: Color depth of destination surface
* @dest_base: Address of destination: offset in frame buffer
* @dest_pitch: Pitch value of destination surface in BYTE
* @byte_per_pixel: Color depth of destination surface
* @dx: Starting x coordinate of destination surface
* @dy: Starting y coordinate of destination surface
* @width: width of rectangle in pixel value
* @height: height of rectangle in pixel value
* @fColor: Foreground color (corresponding to a 1 in the monochrome data
* @bColor: Background color (corresponding to a 0 in the monochrome data
* @fg_color: Foreground color (corresponding to a 1 in the monochrome data
* @bg_color: Background color (corresponding to a 0 in the monochrome data
* @rop2: ROP value
*/
int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
u32 srcDelta, u32 startBit, u32 dBase, u32 dPitch,
u32 bytePerPixel, u32 dx, u32 dy, u32 width,
u32 height, u32 fColor, u32 bColor, u32 rop2)
int sm750_hw_imageblit(struct lynx_accel *accel, const char *src_buf,
u32 src_delta, u32 start_bit, u32 dest_base, u32 dest_pitch,
u32 byte_per_pixel, u32 dx, u32 dy, u32 width,
u32 height, u32 fg_color, u32 bg_color, u32 rop2)
{
unsigned int ulBytesPerScan;
unsigned int ul4BytesPerScan;
unsigned int ulBytesRemain;
unsigned int bytes_per_scan;
unsigned int words_per_scan;
unsigned int bytes_remain;
unsigned int de_ctrl = 0;
unsigned char ajRemain[4];
unsigned char remain[4];
int i, j;
startBit &= 7; /* Just make sure the start bit is within legal range */
ulBytesPerScan = (width + startBit + 7) / 8;
ul4BytesPerScan = ulBytesPerScan & ~3;
ulBytesRemain = ulBytesPerScan & 3;
start_bit &= 7; /* Just make sure the start bit is within legal range */
bytes_per_scan = (width + start_bit + 7) / 8;
words_per_scan = bytes_per_scan & ~3;
bytes_remain = bytes_per_scan & 3;
if (accel->de_wait() != 0)
return -1;
@ -345,7 +345,7 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
* It is an address offset (128 bit aligned)
* from the beginning of frame buffer.
*/
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dBase);
write_dpr(accel, DE_WINDOW_DESTINATION_BASE, dest_base);
/*
* Program pitch (distance between the 1st points of two adjacent
@ -353,9 +353,9 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
* register uses pixel values. Need Byte to pixel conversion.
*/
write_dpr(accel, DE_PITCH,
((dPitch / bytePerPixel << DE_PITCH_DESTINATION_SHIFT) &
((dest_pitch / byte_per_pixel << DE_PITCH_DESTINATION_SHIFT) &
DE_PITCH_DESTINATION_MASK) |
(dPitch / bytePerPixel & DE_PITCH_SOURCE_MASK)); /* dpr10 */
(dest_pitch / byte_per_pixel & DE_PITCH_SOURCE_MASK)); /* dpr10 */
/*
* Screen Window width in Pixels.
@ -363,17 +363,17 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
* in frame buffer for a given point.
*/
write_dpr(accel, DE_WINDOW_WIDTH,
((dPitch / bytePerPixel << DE_WINDOW_WIDTH_DST_SHIFT) &
((dest_pitch / byte_per_pixel << DE_WINDOW_WIDTH_DST_SHIFT) &
DE_WINDOW_WIDTH_DST_MASK) |
(dPitch / bytePerPixel & DE_WINDOW_WIDTH_SRC_MASK));
(dest_pitch / byte_per_pixel & DE_WINDOW_WIDTH_SRC_MASK));
/*
* Note: For 2D Source in Host Write, only X_K1_MONO field is needed,
* and Y_K2 field is not used.
* For mono bitmap, use startBit for X_K1.
* For mono bitmap, use start_bit for X_K1.
*/
write_dpr(accel, DE_SOURCE,
(startBit << DE_SOURCE_X_K1_SHIFT) &
(start_bit << DE_SOURCE_X_K1_SHIFT) &
DE_SOURCE_X_K1_MONO_MASK); /* dpr00 */
write_dpr(accel, DE_DESTINATION,
@ -384,8 +384,8 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
((width << DE_DIMENSION_X_SHIFT) & DE_DIMENSION_X_MASK) |
(height & DE_DIMENSION_Y_ET_MASK)); /* dpr08 */
write_dpr(accel, DE_FOREGROUND, fColor);
write_dpr(accel, DE_BACKGROUND, bColor);
write_dpr(accel, DE_FOREGROUND, fg_color);
write_dpr(accel, DE_BACKGROUND, bg_color);
de_ctrl = (rop2 & DE_CONTROL_ROP_MASK) |
DE_CONTROL_ROP_SELECT | DE_CONTROL_COMMAND_HOST_WRITE |
@ -396,16 +396,16 @@ int sm750_hw_imageblit(struct lynx_accel *accel, const char *pSrcbuf,
/* Write MONO data (line by line) to 2D Engine data port */
for (i = 0; i < height; i++) {
/* For each line, send the data in chunks of 4 bytes */
for (j = 0; j < (ul4BytesPerScan / 4); j++)
write_dpPort(accel, *(unsigned int *)(pSrcbuf + (j * 4)));
for (j = 0; j < (words_per_scan / 4); j++)
write_dp_port(accel, *(unsigned int *)(src_buf + (j * 4)));
if (ulBytesRemain) {
memcpy(ajRemain, pSrcbuf + ul4BytesPerScan,
ulBytesRemain);
write_dpPort(accel, *(unsigned int *)ajRemain);
if (bytes_remain) {
memcpy(remain, src_buf + words_per_scan,
bytes_remain);
write_dp_port(accel, *(unsigned int *)remain);
}
pSrcbuf += srcDelta;
src_buf += src_delta;
}
return 0;

View file

@ -93,7 +93,7 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
{
struct init_status *parm;
parm = &sm750_dev->initParm;
parm = &sm750_dev->init_parm;
if (parm->chip_clk == 0)
parm->chip_clk = (sm750_get_chip_type() == SM750LE) ?
DEFAULT_SM750LE_CHIP_CLOCK :
@ -104,7 +104,7 @@ int hw_sm750_inithw(struct sm750_dev *sm750_dev, struct pci_dev *pdev)
if (parm->master_clk == 0)
parm->master_clk = parm->chip_clk / 3;
ddk750_init_hw((struct initchip_param *)&sm750_dev->initParm);
ddk750_init_hw((struct initchip_param *)&sm750_dev->init_parm);
/* for sm718, open pci burst */
if (sm750_dev->devid == 0x718) {
poke32(SYSTEM_CTRL,

View file

@ -1288,7 +1288,7 @@ EXPORT_SYMBOL(vme_irq_handler);
* already in use. Hardware specific errors also possible.
*/
int vme_irq_request(struct vme_dev *vdev, int level, int statid,
void (*callback)(int, int, void *),
void (*callback)(int level, int statid, void *priv_data),
void *priv_data)
{
struct vme_bridge *bridge;

View file

@ -121,69 +121,70 @@ struct vme_dev {
*/
struct vme_driver {
const char *name;
int (*match)(struct vme_dev *);
int (*probe)(struct vme_dev *);
void (*remove)(struct vme_dev *);
int (*match)(struct vme_dev *vdev);
int (*probe)(struct vme_dev *vdev);
void (*remove)(struct vme_dev *vdev);
struct device_driver driver;
struct list_head devices;
};
void *vme_alloc_consistent(struct vme_resource *, size_t, dma_addr_t *);
void vme_free_consistent(struct vme_resource *, size_t, void *, dma_addr_t);
void *vme_alloc_consistent(struct vme_resource *resource, size_t size, dma_addr_t *dma);
void vme_free_consistent(struct vme_resource *resource, size_t size, void *vaddr, dma_addr_t dma);
size_t vme_get_size(struct vme_resource *);
size_t vme_get_size(struct vme_resource *resource);
int vme_check_window(struct vme_bridge *bridge, u32 aspace,
unsigned long long vme_base, unsigned long long size);
struct vme_resource *vme_slave_request(struct vme_dev *, u32, u32);
int vme_slave_set(struct vme_resource *, int, unsigned long long,
unsigned long long, dma_addr_t, u32, u32);
int vme_slave_get(struct vme_resource *, int *, unsigned long long *,
unsigned long long *, dma_addr_t *, u32 *, u32 *);
void vme_slave_free(struct vme_resource *);
struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address, u32 cycle);
int vme_slave_set(struct vme_resource *resource, int enabled, unsigned long long vme_base,
unsigned long long size, dma_addr_t buf_base, u32 aspace, u32 cycle);
int vme_slave_get(struct vme_resource *resource, int *enabled, unsigned long long *vme_base,
unsigned long long *size, dma_addr_t *buf_base, u32 *aspace, u32 *cycle);
void vme_slave_free(struct vme_resource *resource);
struct vme_resource *vme_master_request(struct vme_dev *, u32, u32, u32);
int vme_master_set(struct vme_resource *, int, unsigned long long,
unsigned long long, u32, u32, u32);
int vme_master_get(struct vme_resource *, int *, unsigned long long *,
unsigned long long *, u32 *, u32 *, u32 *);
ssize_t vme_master_read(struct vme_resource *, void *, size_t, loff_t);
ssize_t vme_master_write(struct vme_resource *, void *, size_t, loff_t);
unsigned int vme_master_rmw(struct vme_resource *, unsigned int, unsigned int,
unsigned int, loff_t);
struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address, u32 cycle, u32 dwidth);
int vme_master_set(struct vme_resource *resource, int enabled, unsigned long long vme_base,
unsigned long long size, u32 aspace, u32 cycle, u32 dwidth);
int vme_master_get(struct vme_resource *resource, int *enabled, unsigned long long *vme_base,
unsigned long long *size, u32 *aspace, u32 *cycle, u32 *dwidth);
ssize_t vme_master_read(struct vme_resource *resource, void *buf, size_t count, loff_t offset);
ssize_t vme_master_write(struct vme_resource *resource, void *buf, size_t count, loff_t offset);
unsigned int vme_master_rmw(struct vme_resource *resource, unsigned int mask, unsigned int compare,
unsigned int swap, loff_t offset);
int vme_master_mmap(struct vme_resource *resource, struct vm_area_struct *vma);
void vme_master_free(struct vme_resource *);
void vme_master_free(struct vme_resource *resource);
struct vme_resource *vme_dma_request(struct vme_dev *, u32);
struct vme_dma_list *vme_new_dma_list(struct vme_resource *);
struct vme_dma_attr *vme_dma_pattern_attribute(u32, u32);
struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t);
struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long, u32, u32, u32);
void vme_dma_free_attribute(struct vme_dma_attr *);
int vme_dma_list_add(struct vme_dma_list *, struct vme_dma_attr *,
struct vme_dma_attr *, size_t);
int vme_dma_list_exec(struct vme_dma_list *);
int vme_dma_list_free(struct vme_dma_list *);
int vme_dma_free(struct vme_resource *);
struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route);
struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource);
struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type);
struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address);
struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address,
u32 aspace, u32 cycle, u32 dwidth);
void vme_dma_free_attribute(struct vme_dma_attr *attributes);
int vme_dma_list_add(struct vme_dma_list *list, struct vme_dma_attr *src,
struct vme_dma_attr *dest, size_t count);
int vme_dma_list_exec(struct vme_dma_list *list);
int vme_dma_list_free(struct vme_dma_list *list);
int vme_dma_free(struct vme_resource *resource);
int vme_irq_request(struct vme_dev *, int, int,
void (*callback)(int, int, void *), void *);
void vme_irq_free(struct vme_dev *, int, int);
int vme_irq_generate(struct vme_dev *, int, int);
int vme_irq_request(struct vme_dev *vdev, int level, int statid,
void (*callback)(int level, int statid, void *priv_data), void *priv_data);
void vme_irq_free(struct vme_dev *vdev, int level, int statid);
int vme_irq_generate(struct vme_dev *vdev, int level, int statid);
struct vme_resource *vme_lm_request(struct vme_dev *);
int vme_lm_count(struct vme_resource *);
int vme_lm_set(struct vme_resource *, unsigned long long, u32, u32);
int vme_lm_get(struct vme_resource *, unsigned long long *, u32 *, u32 *);
int vme_lm_attach(struct vme_resource *, int, void (*callback)(void *), void *);
int vme_lm_detach(struct vme_resource *, int);
void vme_lm_free(struct vme_resource *);
struct vme_resource *vme_lm_request(struct vme_dev *vdev);
int vme_lm_count(struct vme_resource *resource);
int vme_lm_set(struct vme_resource *resource, unsigned long long lm_base, u32 aspace, u32 cycle);
int vme_lm_get(struct vme_resource *resource, unsigned long long *lm_base, u32 *aspace, u32 *cycle);
int vme_lm_attach(struct vme_resource *resource, int monitor, void (*callback)(void *), void *data);
int vme_lm_detach(struct vme_resource *resource, int monitor);
void vme_lm_free(struct vme_resource *resource);
int vme_slot_num(struct vme_dev *);
int vme_bus_num(struct vme_dev *);
int vme_slot_num(struct vme_dev *vdev);
int vme_bus_num(struct vme_dev *vdev);
int vme_register_driver(struct vme_driver *, unsigned int);
void vme_unregister_driver(struct vme_driver *);
int vme_register_driver(struct vme_driver *drv, unsigned int ndevs);
void vme_unregister_driver(struct vme_driver *drv);
#endif /* _VME_H_ */

View file

@ -88,7 +88,7 @@ struct vme_error_handler {
};
struct vme_callback {
void (*func)(int, int, void*);
void (*func)(int level, int statid, void *priv_data);
void *priv_data;
};
@ -178,11 +178,11 @@ struct vme_bridge {
};
void vme_bus_error_handler(struct vme_bridge *bridge, unsigned long long address, int am);
void vme_irq_handler(struct vme_bridge *, int, int);
void vme_irq_handler(struct vme_bridge *bridge, int level, int statid);
struct vme_bridge *vme_init_bridge(struct vme_bridge *);
int vme_register_bridge(struct vme_bridge *);
void vme_unregister_bridge(struct vme_bridge *);
struct vme_bridge *vme_init_bridge(struct vme_bridge *bridge);
int vme_register_bridge(struct vme_bridge *bridge);
void vme_unregister_bridge(struct vme_bridge *bridge);
struct vme_error_handler *vme_register_error_handler(struct vme_bridge *bridge, u32 aspace,
unsigned long long address, size_t len);
void vme_unregister_error_handler(struct vme_error_handler *handler);

View file

@ -690,7 +690,7 @@ err_dev:
return err;
}
static void vme_user_remove(struct vme_dev *dev)
static void vme_user_remove(struct vme_dev *vdev)
{
int i;