Re: [PATCH v3 1/1] staging: dgnc: take lock when storing value in dgnc_po ll_tick

2015-09-22 Thread Sudip Mukherjee
On Wed, Sep 23, 2015 at 03:28:07AM +0100, Salah Triki wrote:
> dgnc_poll_tick is declared global, so dgnc_driver_pollrate_store needs to 
> take the
> lock dgnc_poll_lock before modifying this variable. dgnc_poll_lock is the
> appropriate lock, since it is intended for poll scheduling and dgnc_poll_tick
> contains the poll rate. dgnc_poll_lock needs to be declare not static and
> extern in order to be visible for dgnc_driver_pollrate_store.
> 
> Signed-off-by: Salah Triki 
> ---

> + spin_lock_irqsave(&dgnc_poll_lock, flags);
If I remember correctly Greg asked why you are using spin_lock_irqsave()?

If you need to lock why you are not using mutex here?

regards
sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 13/13] Staging: rtl8712: Coding style warning fix for block comment

2015-09-22 Thread Sudip Mukherjee
On Wed, Sep 23, 2015 at 02:03:56AM +0530, Punit Vara wrote:
> This patch is to rtl8712_gp_bitdef.h file that fixes up following
> warning reported by checkpatch :
> 
> -Block comments use a trailing */ on a separate line
> 
> Signed-off-by: Punit Vara 
> ---
I am getting confused. One of your previous patch showed PATCH 5/6, this
one shows 13/13, but i am not seeing the other patches of these two
series. Is it the problem with my mail filters or you are not sending?

regards
sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] staging: sm750fb: remove unused MB(x) and KB(x) macros

2015-09-22 Thread Sudip Mukherjee
On Tue, Sep 22, 2015 at 12:01:18PM +0300, Mike Rapoport wrote:
> The MB(x) and KB(x) macros are not used and therefore they can be
> removed
> 
> Signed-off-by: Mike Rapoport 
> ---
ohh.. discard my earlier mail. I have not seen that you have done that
in this patch. Sorry for the noise.

regards
sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: sm750fb: replace custom MB(x) macro with appropriate SZ_xM

2015-09-22 Thread Sudip Mukherjee
On Tue, Sep 22, 2015 at 12:01:17PM +0300, Mike Rapoport wrote:
> Use SZ_xM defined in linux/sizes.h instead of custom MB(x) macro
> 
> Signed-off-by: Mike Rapoport 
> ---
If you are removing the use of MB(x) please also remove the
#define MB(x) ((x)<<20)

regards
sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 3/6] staging: fsl-mc: up-rev dpbp binary interface to v2.0

2015-09-22 Thread Greg KH
On Tue, Sep 22, 2015 at 06:08:56PM -0500, J. German Rivera wrote:
> Add cmd_flags parameter to all dpbp APIs to comply
> with the dpbp 2.0 MC interface. Updated MC version
> major number. Pass irq args in struct instead of
> separate args.
> 
> Signed-off-by: J. German Rivera 
> ---
>  drivers/staging/fsl-mc/bus/dpbp.c | 136 
> --
>  drivers/staging/fsl-mc/include/dpbp-cmd.h |   2 +-
>  drivers/staging/fsl-mc/include/dpbp.h |  91 +++-
>  3 files changed, 162 insertions(+), 67 deletions(-)
> 
> diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
> b/drivers/staging/fsl-mc/bus/dpbp.c
> index d99ab6d..0004e65 100644
> --- a/drivers/staging/fsl-mc/bus/dpbp.c
> +++ b/drivers/staging/fsl-mc/bus/dpbp.c
> @@ -34,14 +34,19 @@
>  #include "../include/dpbp.h"
>  #include "../include/dpbp-cmd.h"
> 
> -int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token)
> +int dpbp_open(struct fsl_mc_io *mc_io,
> +   uint32_t cmd_flags,
> +   int dpbp_id,
> +   uint16_t *token)
>  {
>   struct mc_command cmd = { 0 };
>   int err;
> 
>   /* prepare command */
>   cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN,
> -   MC_CMD_PRI_LOW, 0);
> +   cmd_flags,
> +   0);

Why are you reformatting all of these calls when you don't have to
create a new line?  Seems wasteful to me, as is:

> +

That empty line, why?

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 1/1] staging: dgnc: take lock when storing value in dgnc_po ll_tick

2015-09-22 Thread Salah Triki
dgnc_poll_tick is declared global, so dgnc_driver_pollrate_store needs to take 
the
lock dgnc_poll_lock before modifying this variable. dgnc_poll_lock is the
appropriate lock, since it is intended for poll scheduling and dgnc_poll_tick
contains the poll rate. dgnc_poll_lock needs to be declare not static and
extern in order to be visible for dgnc_driver_pollrate_store.

Signed-off-by: Salah Triki 
---
 drivers/staging/dgnc/dgnc_driver.c | 2 +-
 drivers/staging/dgnc/dgnc_driver.h | 1 +
 drivers/staging/dgnc/dgnc_sysfs.c  | 9 -
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 7546aff..f03e8b3 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -64,6 +64,7 @@ static const struct file_operations dgnc_BoardFops = {
 uint   dgnc_NumBoards;
 struct dgnc_board  *dgnc_Board[MAXBOARDS];
 DEFINE_SPINLOCK(dgnc_global_lock);
+DEFINE_SPINLOCK(dgnc_poll_lock);
 uint   dgnc_Major;
 intdgnc_poll_tick = 20;/* Poll interval - 20 ms */
 
@@ -75,7 +76,6 @@ static struct class *dgnc_class;
 /*
  * Poller stuff
  */
-static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
 static ulong   dgnc_poll_time; /* Time of next poll */
 static uintdgnc_poll_stop; /* Used to tell poller to stop */
 static struct timer_list dgnc_poll_timer;
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 06ece51..6784d81 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -389,6 +389,7 @@ struct channel_t {
  */
 extern uintdgnc_Major; /* Our driver/mgmt major */
 extern int dgnc_poll_tick; /* Poll interval - 20 ms */
+extern spinlock_t  dgnc_poll_lock; /* Poll scheduling lock */
 extern spinlock_t  dgnc_global_lock;   /* Driver global spinlock */
 extern uintdgnc_NumBoards; /* Total number of boards */
 extern struct dgnc_board   *dgnc_Board[MAXBOARDS]; /* Array of board 
structs */
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 44db870..48b6056 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -56,11 +56,18 @@ static ssize_t dgnc_driver_pollrate_show(struct 
device_driver *ddp, char *buf)
 static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp,
  const char *buf, size_t count)
 {
+   unsigned long flags;
+   int tick;
int ret;
 
-   ret = sscanf(buf, "%d\n", &dgnc_poll_tick);
+   ret = sscanf(buf, "%d\n", &tick);
if (ret != 1)
return -EINVAL;
+
+   spin_lock_irqsave(&dgnc_poll_lock, flags);
+   dgnc_poll_tick = tick;
+   spin_unlock_irqrestore(&dgnc_poll_lock, flags);
+
return count;
 }
 static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show,
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3 0/1] staging: dgnc: take lock when storing value in dgnc_poll_tick

2015-09-22 Thread Salah Triki
The global variable dgnc_poll_tick is read in the function dgnc_poll_handler 
and modified in  dgnc_driver_pollrate_store. The read access is protected by 
spin_lock_irqsave whereas the write is not. The protection of write access 
is needed, since it is possible to have multiple programs that try to modify, 
simultaneously, dngc_poll_tick. The following patch corrects this bug.

Salah Triki (1):
  staging: dgnc: take lock when storing value in dgnc_poll_tick

 drivers/staging/dgnc/dgnc_driver.c | 2 +-
 drivers/staging/dgnc/dgnc_driver.h | 1 +
 drivers/staging/dgnc/dgnc_sysfs.c  | 9 -
 3 files changed, 10 insertions(+), 2 deletions(-)

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v11 2/4] fpga manager: add sysfs interface document

2015-09-22 Thread Moritz Fischer
On Tue, Sep 22, 2015 at 8:21 AM,   wrote:
> From: Alan Tull 
>
> Add documentation under drivers/staging for new fpga manager's
> sysfs interface.
>
Reviewed-by: Moritz Fischer 
> Signed-off-by: Alan Tull 
> ---
> v5  : (actually second version, but keeping version numbers
>   aligned with rest of patch series)
>   Move document to drivers/staging/fpga/Documentation/ABI
>
> v6  : No change in this patch for v6 of the patch set
> v7  : No change in this patch for v7 of the patch set
> v8  : No change in this patch for v8 of the patch set
>
> v9  : Remove 'firmware' and 'reset' files
>   Update state strings
>
> v10 : Clarifications about state attribute
>   Move to Documentation/ABI/testing/
>
> v11 : No change in this patch for v11 of the patch set
> ---
>  Documentation/ABI/testing/sysfs-class-fpga-manager |   37 
> 
>  1 file changed, 37 insertions(+)
>  create mode 100644 Documentation/ABI/testing/sysfs-class-fpga-manager
>
> diff --git a/Documentation/ABI/testing/sysfs-class-fpga-manager 
> b/Documentation/ABI/testing/sysfs-class-fpga-manager
> new file mode 100644
> index 000..23056c5
> --- /dev/null
> +++ b/Documentation/ABI/testing/sysfs-class-fpga-manager
> @@ -0,0 +1,37 @@
> +What:  /sys/class/fpga_manager//name
> +Date:  August 2015
> +KernelVersion: 4.3
> +Contact:   Alan Tull 
> +Description:   Name of low level fpga manager driver.
> +
> +What:  /sys/class/fpga_manager//state
> +Date:  August 2015
> +KernelVersion: 4.3
> +Contact:   Alan Tull 
> +Description:   Read fpga manager state as a string.
> +   The intent is to provide enough detail that if something goes
> +   wrong during FPGA programming (something that the driver can't
> +   fix) then userspace can know, i.e. if the firmware request
> +   fails, that could be due to not being able to find the 
> firmware
> +   file.
> +
> +   This is a superset of FPGA states and fpga manager driver
> +   states.  The fpga manager driver is walking through these 
> steps
> +   to get the FPGA into a known operating state.  It's a 
> sequence,
> +   though some steps may get skipped.  Valid FPGA states will 
> vary
> +   by manufacturer; this is a superset.
> +
> +   * unknown   = can't determine state
> +   * power off = FPGA power is off
> +   * power up  = FPGA reports power is up
> +   * reset = FPGA held in reset state
> +   * firmware request  = firmware class request in progress
> +   * firmware request error = firmware request failed
> +   * write init= preparing FPGA for programming
> +   * write init error  = Error while preparing FPGA for
> + programming
> +   * write = FPGA ready to receive image data
> +   * write error   = Error while programming
> +   * write complete= Doing post programming steps
> +   * write complete error  = Error while doing post programming
> +   * operating = FPGA is programmed and operating
> --
> 1.7.9.5
>

Cheers,

Moritz
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v11 1/4] usage documentation for FPGA manager core

2015-09-22 Thread Moritz Fischer
Hi Alan,

On Tue, Sep 22, 2015 at 8:21 AM,   wrote:
> From: Alan Tull 
>
> Add a document on the new FPGA manager core.
>

Reviewed-by: Moritz Fischer 

> Signed-off-by: Alan Tull 
> ---
> v9:  initial version where this patch was added
>
> v10: requested cleanups to formatting and otherwise
>  s/fpga/FPGA/g
>  rewrite implementation section to not reference socfpga.c by name
>  other rewrites
>  Moved to Documentation/fpga/
>
> v11: s/with image/with an image/
>  s/on the path/in the path/
> ---
>  Documentation/fpga/fpga-mgr.txt |  171 
> +++
>  1 file changed, 171 insertions(+)
>  create mode 100644 Documentation/fpga/fpga-mgr.txt
>
> diff --git a/Documentation/fpga/fpga-mgr.txt b/Documentation/fpga/fpga-mgr.txt
> new file mode 100644
> index 000..ce3e84f
> --- /dev/null
> +++ b/Documentation/fpga/fpga-mgr.txt
> @@ -0,0 +1,171 @@
> +FPGA Manager Core
> +
> +Alan Tull 2015
> +
> +Overview
> +
> +
> +The FPGA manager core exports a set of functions for programming an FPGA with
> +an image.  The API is manufacturer agnostic.  All manufacturer specifics are
> +hidden away in a low level driver which registers a set of ops with the core.
> +The FPGA image data itself is very manufacturer specific, but for our 
> purposes
> +it's just binary data.  The FPGA manager core won't parse it.
> +
> +
> +API Functions:
> +==
> +
> +To program the FPGA from a file or from a buffer:
> +-
> +
> +   int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags,
> + const char *buf, size_t count);
> +
> +Load the FPGA from an image which exists as a buffer in memory.
> +
> +   int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
> +  const char *image_name);
> +
> +Load the FPGA from an image which exists as a file.  The image file must be 
> on
> +the firmware search path (see the firmware class documentation).
> +
> +For both these functions, flags == 0 for normal full reconfiguration or
> +FPGA_MGR_PARTIAL_RECONFIG for partial reconfiguration.  If successful, the 
> FPGA
> +ends up in operating mode.  Return 0 on success or a negative error code.
> +
> +
> +To get/put a reference to a FPGA manager:
> +-
> +
> +   struct fpga_manager *of_fpga_mgr_get(struct device_node *node);
> +
> +   void fpga_mgr_put(struct fpga_manager *mgr);
> +
> +Given a DT node, get an exclusive reference to a FPGA manager or release
> +the reference.
> +
> +
> +To register or unregister the low level FPGA-specific driver:
> +-
> +
> +   int fpga_mgr_register(struct device *dev, const char *name,
> + const struct fpga_manager_ops *mops,
> + void *priv);
> +
> +   void fpga_mgr_unregister(struct device *dev);
> +
> +Use of these two functions is described below in "How To Support a new FPGA
> +device."
> +
> +
> +How to write an image buffer to a supported FPGA
> +
> +/* Include to get the API */
> +#include 
> +
> +/* device node that specifies the FPGA manager to use */
> +struct device_node *mgr_node = ...
> +
> +/* FPGA image is in this buffer.  count is size of the buffer. */
> +char *buf = ...
> +int count = ...
> +
> +/* flags indicates whether to do full or partial reconfiguration */
> +int flags = 0;
> +
> +int ret;
> +
> +/* Get exclusive control of FPGA manager */
> +struct fpga_manager *mgr = of_fpga_mgr_get(mgr_node);
> +
> +/* Load the buffer to the FPGA */
> +ret = fpga_mgr_buf_load(mgr, flags, buf, count);
> +
> +/* Release the FPGA manager */
> +fpga_mgr_put(mgr);
> +
> +
> +How to write an image file to a supported FPGA
> +==
> +/* Include to get the API */
> +#include 
> +
> +/* device node that specifies the FPGA manager to use */
> +struct device_node *mgr_node = ...
> +
> +/* FPGA image is in this file which is in the firmware search path */
> +const char *path = "fpga-image-9.rbf"
> +
> +/* flags indicates whether to do full or partial reconfiguration */
> +int flags = 0;
> +
> +int ret;
> +
> +/* Get exclusive control of FPGA manager */
> +struct fpga_manager *mgr = of_fpga_mgr_get(mgr_node);
> +
> +/* Get the firmware image (path) and load it to the FPGA */
> +ret = fpga_mgr_firmware_load(mgr, flags, path);
> +
> +/* Release the FPGA manager */
> +fpga_mgr_put(mgr);
> +
> +
> +How to support a new FPGA device
> +
> +To add another FPGA manager, write a driver that implements a set of ops.  
> The
> +probe function calls fpga_mgr_register(), such as:
> +
> +static const struct fpga_manager_ops socfpga_fpga_ops = {
> +   .write_init = socfpga_fpga_ops_configure_init,
> +   .write = socfpga_fpga_ops_configure_write,
> +   

Re: [PATCH v11 3/4] add FPGA manager core

2015-09-22 Thread Josh Cartwright
On Tue, Sep 22, 2015 at 10:21:10AM -0500, at...@opensource.altera.com wrote:
> From: Alan Tull 
> 
> API to support programming FPGA's.
> 
> The following functions are exported as GPL:
> * fpga_mgr_buf_load
>Load fpga from image in buffer
> 
> * fpga_mgr_firmware_load
>Request firmware and load it to the FPGA.
> 
> * fpga_mgr_register
> * fpga_mgr_unregister
>FPGA device drivers can be added by calling
>fpga_mgr_register() to register a set of
>fpga_manager_ops to do device specific stuff.
> 
> * of_fpga_mgr_get
> * fpga_mgr_put
>Get/put a reference to a fpga manager.
> 
> The following sysfs files are created:
> * /sys/class/fpga_manager//name
>   Name of low level driver.

Don't 'struct device's already have a name?  Why do you need another name
attribute?

> 
> * /sys/class/fpga_manager//state
>   State of fpga manager
> 
> Signed-off-by: Alan Tull 
> Acked-by: Michal Simek 
[..]
> +++ b/drivers/fpga/fpga-mgr.c
> @@ -0,0 +1,382 @@
[..]
> +int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags, const char *buf,
> +   size_t count)
> +{
> + struct device *dev = &mgr->dev;
> + int ret;
> +
> + if (!mgr)
> + return -ENODEV;

This seems overly defensive.

[..]
> +int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
> +const char *image_name)
> +{
> + struct device *dev = &mgr->dev;
> + const struct firmware *fw;
> + int ret;
> +
> + if (!mgr)
> + return -ENODEV;

Again; I'm of the opinion this is needlessly defensive.

> +
> + dev_info(dev, "writing %s to %s\n", image_name, mgr->name);
> +
> + mgr->state = FPGA_MGR_STATE_FIRMWARE_REQ;
> +
> + ret = request_firmware(&fw, image_name, dev);
> + if (ret) {
> + mgr->state = FPGA_MGR_STATE_FIRMWARE_REQ_ERR;
> + dev_err(dev, "Error requesting firmware %s\n", image_name);
> + return ret;
> + }
> +
> + ret = fpga_mgr_buf_load(mgr, flags, fw->data, fw->size);
> + if (ret)
> + return ret;
> +
> + release_firmware(fw);
> +
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(fpga_mgr_firmware_load);
> +
> +static const char * const state_str[] = {
> + [FPGA_MGR_STATE_UNKNOWN] =  "unknown",
> + [FPGA_MGR_STATE_POWER_OFF] ="power off",
> + [FPGA_MGR_STATE_POWER_UP] = "power up",
> + [FPGA_MGR_STATE_RESET] ="reset",
> +
> + /* requesting FPGA image from firmware */
> + [FPGA_MGR_STATE_FIRMWARE_REQ] = "firmware request",
> + [FPGA_MGR_STATE_FIRMWARE_REQ_ERR] = "firmware request error",
> +
> + /* Preparing FPGA to receive image */
> + [FPGA_MGR_STATE_WRITE_INIT] =   "write init",
> + [FPGA_MGR_STATE_WRITE_INIT_ERR] =   "write init error",
> +
> + /* Writing image to FPGA */
> + [FPGA_MGR_STATE_WRITE] ="write",
> + [FPGA_MGR_STATE_WRITE_ERR] ="write error",
> +
> + /* Finishing configuration after image has been written */
> + [FPGA_MGR_STATE_WRITE_COMPLETE] =   "write complete",
> + [FPGA_MGR_STATE_WRITE_COMPLETE_ERR] =   "write complete error",
> +
> + /* FPGA reports to be in normal operating mode */
> + [FPGA_MGR_STATE_OPERATING] ="operating",
> +};

Is it really necessary to expose the whole FPGA manager state machine to
userspace?  Is the only justification "for debugging"?

If so, that seems pretty short-sighted, as it then makes the state
machine part of the stable usermode API.  It even makes less sense given
this patchsets current state: configuration of the FPGA is not something
that userspace is directly triggering.

> +
> +static ssize_t name_show(struct device *dev,
> +  struct device_attribute *attr, char *buf)
> +{
> + struct fpga_manager *mgr = to_fpga_manager(dev);
> +
> + return sprintf(buf, "%s\n", mgr->name);
> +}
> +
> +static ssize_t state_show(struct device *dev,
> +   struct device_attribute *attr, char *buf)
> +{
> + struct fpga_manager *mgr = to_fpga_manager(dev);
> +
> + return sprintf(buf, "%s\n", state_str[mgr->state]);
> +}

Is it possible that the state of the FPGA has changed since the last
time we've done an update?  Should the lower-level drivers' state()
callback be invoked here?

> +
> +static DEVICE_ATTR_RO(name);
> +static DEVICE_ATTR_RO(state);
> +
> +static struct attribute *fpga_mgr_attrs[] = {
> + &dev_attr_name.attr,
> + &dev_attr_state.attr,
> + NULL,
> +};
> +ATTRIBUTE_GROUPS(fpga_mgr);
> +
> +static int fpga_mgr_of_node_match(struct device *dev, const void *data)
> +{
> + return dev->of_node == data;
> +}
> +
> +/**
> + * of_fpga_mgr_get - get an exclusive reference to a fpga mgr
> + * @node:device node
> + *
> + * Given a device node, get an exclusive reference to a fpga mgr.
> + *
> + * Return: fpga manager struct or IS_ERR() condition containing error code.
> + */

[PATCH v2 6/6] staging: fsl-mc: up-rev dprc binary interface to v4.0

2015-09-22 Thread J. German Rivera
Add cmd_flags parameter to all dprc APIs to comply
with the dprc 4.0 MC interface. Updated MC version
major number.  Pass irq args in struct instead of
separate args.

dprc 4.0 uses MC-relative offsets to specify object regions,
instead of physical addresses. So, translate_mc_addr() and
struct fsl_mc_addr_translation_range need to be updated
accordingly.

Update commands for 4.0: add new commands 'set/get
obj irq', 'set obj label', 'get obj descriptor'.
Remove 'get portal paddr'.

Signed-off-by: J. German Rivera 
---
 drivers/staging/fsl-mc/bus/dprc-cmd.h   |   7 +-
 drivers/staging/fsl-mc/bus/dprc-driver.c|   8 +-
 drivers/staging/fsl-mc/bus/dprc.c   | 464 +++-
 drivers/staging/fsl-mc/bus/mc-bus.c |  50 ++-
 drivers/staging/fsl-mc/include/dprc.h   | 313 +++
 drivers/staging/fsl-mc/include/mc-private.h |  15 +-
 6 files changed, 688 insertions(+), 169 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dprc-cmd.h 
b/drivers/staging/fsl-mc/bus/dprc-cmd.h
index 0920248..6552c20 100644
--- a/drivers/staging/fsl-mc/bus/dprc-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dprc-cmd.h
@@ -41,7 +41,7 @@
 #define _FSL_DPRC_CMD_H

 /* DPRC Version */
-#define DPRC_VER_MAJOR 3
+#define DPRC_VER_MAJOR 4
 #define DPRC_VER_MINOR 0

 /* Command IDs */
@@ -72,12 +72,15 @@
 #define DPRC_CMDID_GET_RES_COUNT   0x15B
 #define DPRC_CMDID_GET_RES_IDS 0x15C
 #define DPRC_CMDID_GET_OBJ_REG 0x15E
+#define DPRC_CMDID_SET_OBJ_IRQ 0x15F
+#define DPRC_CMDID_GET_OBJ_IRQ 0x160
+#define DPRC_CMDID_SET_OBJ_LABEL   0x161
+#define DPRC_CMDID_GET_OBJ_DESC0x162

 #define DPRC_CMDID_CONNECT 0x167
 #define DPRC_CMDID_DISCONNECT  0x168
 #define DPRC_CMDID_GET_POOL0x169
 #define DPRC_CMDID_GET_POOL_COUNT  0x16A
-#define DPRC_CMDID_GET_PORTAL_PADDR0x16B

 #define DPRC_CMDID_GET_CONNECTION  0x16C

diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c 
b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 35c06cf..7faf23b4 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -262,6 +262,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev)
struct dprc_obj_desc *child_obj_desc_array = NULL;

error = dprc_get_obj_count(mc_bus_dev->mc_io,
+  0,
   mc_bus_dev->mc_handle,
   &num_child_objects);
if (error < 0) {
@@ -289,6 +290,7 @@ int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev)
&child_obj_desc_array[i];

error = dprc_get_obj(mc_bus_dev->mc_io,
+0,
 mc_bus_dev->mc_handle,
 i, obj_desc);
if (error < 0) {
@@ -399,7 +401,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
return error;
}

-   error = dprc_open(mc_dev->mc_io, mc_dev->obj_desc.id,
+   error = dprc_open(mc_dev->mc_io, 0, mc_dev->obj_desc.id,
  &mc_dev->mc_handle);
if (error < 0) {
dev_err(&mc_dev->dev, "dprc_open() failed: %d\n", error);
@@ -419,7 +421,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev)
return 0;

 error_cleanup_open:
-   (void)dprc_close(mc_dev->mc_io, mc_dev->mc_handle);
+   (void)dprc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);

 error_cleanup_mc_io:
fsl_destroy_mc_io(mc_dev->mc_io);
@@ -447,7 +449,7 @@ static int dprc_remove(struct fsl_mc_device *mc_dev)

device_for_each_child(&mc_dev->dev, NULL, __fsl_mc_device_remove);
dprc_cleanup_all_resource_pools(mc_dev);
-   error = dprc_close(mc_dev->mc_io, mc_dev->mc_handle);
+   error = dprc_close(mc_dev->mc_io, 0, mc_dev->mc_handle);
if (error < 0)
dev_err(&mc_dev->dev, "dprc_close() failed: %d\n", error);

diff --git a/drivers/staging/fsl-mc/bus/dprc.c 
b/drivers/staging/fsl-mc/bus/dprc.c
index 19b26e6..a1cdafd 100644
--- a/drivers/staging/fsl-mc/bus/dprc.c
+++ b/drivers/staging/fsl-mc/bus/dprc.c
@@ -34,13 +34,16 @@
 #include "../include/dprc.h"
 #include "dprc-cmd.h"

-int dprc_open(struct fsl_mc_io *mc_io, int container_id, uint16_t *token)
+int dprc_open(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ int container_id,
+ uint16_t *token)
 {
struct mc_command cmd = { 0 };
int err;

/* prepare command */
-   cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, MC_CMD_PRI_LOW,
+   cmd.header = mc_encode_cmd_header(DPRC_CMDID_OPEN, cmd_flags,
  

[PATCH v2 3/6] staging: fsl-mc: up-rev dpbp binary interface to v2.0

2015-09-22 Thread J. German Rivera
Add cmd_flags parameter to all dpbp APIs to comply
with the dpbp 2.0 MC interface. Updated MC version
major number. Pass irq args in struct instead of
separate args.

Signed-off-by: J. German Rivera 
---
 drivers/staging/fsl-mc/bus/dpbp.c | 136 --
 drivers/staging/fsl-mc/include/dpbp-cmd.h |   2 +-
 drivers/staging/fsl-mc/include/dpbp.h |  91 +++-
 3 files changed, 162 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpbp.c 
b/drivers/staging/fsl-mc/bus/dpbp.c
index d99ab6d..0004e65 100644
--- a/drivers/staging/fsl-mc/bus/dpbp.c
+++ b/drivers/staging/fsl-mc/bus/dpbp.c
@@ -34,14 +34,19 @@
 #include "../include/dpbp.h"
 #include "../include/dpbp-cmd.h"

-int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, uint16_t *token)
+int dpbp_open(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ int dpbp_id,
+ uint16_t *token)
 {
struct mc_command cmd = { 0 };
int err;

/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_OPEN,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);
+
cmd.params[0] |= mc_enc(0, 32, dpbp_id);

/* send command to mc*/
@@ -56,12 +61,14 @@ int dpbp_open(struct fsl_mc_io *mc_io, int dpbp_id, 
uint16_t *token)
 }
 EXPORT_SYMBOL(dpbp_open);

-int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_close(struct fsl_mc_io *mc_io,
+  uint32_t cmd_flags,
+  uint16_t token)
 {
struct mc_command cmd = { 0 };

/* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, MC_CMD_PRI_HIGH,
+   cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, cmd_flags,
  token);

/* send command to mc*/
@@ -70,6 +77,7 @@ int dpbp_close(struct fsl_mc_io *mc_io, uint16_t token)
 EXPORT_SYMBOL(dpbp_close);

 int dpbp_create(struct fsl_mc_io *mc_io,
+   uint32_t cmd_flags,
const struct dpbp_cfg *cfg,
uint16_t *token)
 {
@@ -80,7 +88,8 @@ int dpbp_create(struct fsl_mc_io *mc_io,

/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_CREATE,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);

/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -93,24 +102,29 @@ int dpbp_create(struct fsl_mc_io *mc_io,
return 0;
 }

-int dpbp_destroy(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_destroy(struct fsl_mc_io *mc_io,
+uint32_t cmd_flags,
+uint16_t token)
 {
struct mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_DESTROY,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);

/* send command to mc*/
return mc_send_command(mc_io, &cmd);
 }

-int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_enable(struct fsl_mc_io *mc_io,
+   uint32_t cmd_flags,
+   uint16_t token)
 {
struct mc_command cmd = { 0 };

/* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, MC_CMD_PRI_LOW,
+   cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags,
  token);

/* send command to mc*/
@@ -118,25 +132,31 @@ int dpbp_enable(struct fsl_mc_io *mc_io, uint16_t token)
 }
 EXPORT_SYMBOL(dpbp_enable);

-int dpbp_disable(struct fsl_mc_io *mc_io, uint16_t token)
+int dpbp_disable(struct fsl_mc_io *mc_io,
+uint32_t cmd_flags,
+uint16_t token)
 {
struct mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);

/* send command to mc*/
return mc_send_command(mc_io, &cmd);
 }
 EXPORT_SYMBOL(dpbp_disable);

-int dpbp_is_enabled(struct fsl_mc_io *mc_io, uint16_t token, int *en)
+int dpbp_is_enabled(struct fsl_mc_io *mc_io,
+   uint32_t cmd_flags,
+   uint16_t token,
+   int *en)
 {
struct mc_command cmd = { 0 };
int err;
/* prepare command */
-   cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, MC_CMD_PRI_LOW,
+   cmd.header = mc_encode_cmd_header(DPBP_CMDID_IS_ENABLED, cmd_flags,
  token);

/* send command to mc*/
@@ -150,53 +170,58 @@ int dpbp_is_enabled(struct fsl_mc_io 

[PATCH v2 4/6] staging: fsl-mc: up-rev dpmcp binary interface to v2.0

2015-09-22 Thread J. German Rivera
Add cmd_flags parameter to all dpbp APIs to comply
with the dpmcp 2.0 MC interface. Updated version
major number. Pass irq args in struct instead of
separate args.

Signed-off-by: J. German Rivera 
---
 drivers/staging/fsl-mc/bus/dpmcp-cmd.h|   2 +-
 drivers/staging/fsl-mc/bus/dpmcp.c| 123 ++
 drivers/staging/fsl-mc/bus/dpmcp.h| 123 +++---
 drivers/staging/fsl-mc/bus/mc-allocator.c |   6 +-
 4 files changed, 157 insertions(+), 97 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h 
b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
index 57f326b..6cc0fed 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
+++ b/drivers/staging/fsl-mc/bus/dpmcp-cmd.h
@@ -34,7 +34,7 @@

 /* DPMCP Version */
 #define DPMCP_VER_MAJOR2
-#define DPMCP_VER_MINOR0
+#define DPMCP_VER_MINOR1

 /* Command IDs */
 #define DPMCP_CMDID_CLOSE  0x800
diff --git a/drivers/staging/fsl-mc/bus/dpmcp.c 
b/drivers/staging/fsl-mc/bus/dpmcp.c
index 6b9da5b..ee63380 100644
--- a/drivers/staging/fsl-mc/bus/dpmcp.c
+++ b/drivers/staging/fsl-mc/bus/dpmcp.c
@@ -34,14 +34,18 @@
 #include "dpmcp.h"
 #include "dpmcp-cmd.h"

-int dpmcp_open(struct fsl_mc_io *mc_io, int dpmcp_id, uint16_t *token)
+int dpmcp_open(struct fsl_mc_io *mc_io,
+  uint32_t cmd_flags,
+  int dpmcp_id,
+  uint16_t *token)
 {
struct mc_command cmd = { 0 };
int err;

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMCP_CMDID_OPEN,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);
cmd.params[0] |= mc_enc(0, 32, dpmcp_id);

/* send command to mc*/
@@ -55,12 +59,15 @@ int dpmcp_open(struct fsl_mc_io *mc_io, int dpmcp_id, 
uint16_t *token)
return err;
 }

-int dpmcp_close(struct fsl_mc_io *mc_io, uint16_t token)
+int dpmcp_close(struct fsl_mc_io *mc_io,
+   uint32_t cmd_flags,
+   uint16_t token)
 {
struct mc_command cmd = { 0 };

/* prepare command */
-   cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CLOSE, MC_CMD_PRI_HIGH,
+   cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CLOSE,
+ cmd_flags,
  token);

/* send command to mc*/
@@ -68,15 +75,17 @@ int dpmcp_close(struct fsl_mc_io *mc_io, uint16_t token)
 }

 int dpmcp_create(struct fsl_mc_io *mc_io,
+uint32_t cmd_flags,
 const struct dpmcp_cfg *cfg,
-   uint16_t *token)
+uint16_t *token)
 {
struct mc_command cmd = { 0 };
int err;

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CREATE,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);
cmd.params[0] |= mc_enc(0, 32, cfg->portal_id);

/* send command to mc*/
@@ -90,65 +99,71 @@ int dpmcp_create(struct fsl_mc_io *mc_io,
return 0;
 }

-int dpmcp_destroy(struct fsl_mc_io *mc_io, uint16_t token)
+int dpmcp_destroy(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
+ uint16_t token)
 {
struct mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMCP_CMDID_DESTROY,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);

/* send command to mc*/
return mc_send_command(mc_io, &cmd);
 }

-int dpmcp_reset(struct fsl_mc_io *mc_io, uint16_t token)
+int dpmcp_reset(struct fsl_mc_io *mc_io,
+   uint32_t cmd_flags,
+   uint16_t token)
 {
struct mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMCP_CMDID_RESET,
- MC_CMD_PRI_LOW, token);
+ cmd_flags,
+ token);

/* send command to mc*/
return mc_send_command(mc_io, &cmd);
 }

 int dpmcp_set_irq(struct fsl_mc_io *mc_io,
+ uint32_t cmd_flags,
  uint16_t token,
-uint8_t irq_index,
-uint64_t irq_addr,
-uint32_t irq_val,
-int user_irq_id)
+ uint8_t irq_index,
+ struct dpmcp_irq_cfg  *irq_cfg)
 {
struct mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMCP_CMDID_SET_IRQ,
- MC_CMD_PRI_LOW, token);
+ cmd_fla

[PATCH v2 2/6] staging: fsl-mc: uprev dpmng binary interface to v8.0

2015-09-22 Thread J. German Rivera
Add cmd_flags parameter to all dpmng APIs to comply
with 8.0 MC firmware interface. Updated MC version
major number.
---
 drivers/staging/fsl-mc/bus/dpmng.c | 14 ++
 drivers/staging/fsl-mc/bus/mc-bus.c|  4 ++--
 drivers/staging/fsl-mc/include/dpmng.h | 14 ++
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/fsl-mc/bus/dpmng.c 
b/drivers/staging/fsl-mc/bus/dpmng.c
index 58328e8..1aeca05 100644
--- a/drivers/staging/fsl-mc/bus/dpmng.c
+++ b/drivers/staging/fsl-mc/bus/dpmng.c
@@ -34,14 +34,17 @@
 #include "../include/dpmng.h"
 #include "dpmng-cmd.h"

-int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info)
+int mc_get_version(struct fsl_mc_io *mc_io,
+  uint32_t cmd_flags,
+  struct mc_version *mc_ver_info)
 {
struct mc_command cmd = { 0 };
int err;

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);

/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
@@ -56,14 +59,17 @@ int mc_get_version(struct fsl_mc_io *mc_io, struct 
mc_version *mc_ver_info)
return 0;
 }

-int dpmng_get_container_id(struct fsl_mc_io *mc_io, int *container_id)
+int dpmng_get_container_id(struct fsl_mc_io *mc_io,
+  uint32_t cmd_flags,
+  int *container_id)
 {
struct mc_command cmd = { 0 };
int err;

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_CONT_ID,
- MC_CMD_PRI_LOW, 0);
+ cmd_flags,
+ 0);

/* send command to mc*/
err = mc_send_command(mc_io, &cmd);
diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c 
b/drivers/staging/fsl-mc/bus/mc-bus.c
index b3a60a0..f3718a3 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -630,7 +630,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
if (error < 0)
return error;

-   error = mc_get_version(mc_io, &mc_version);
+   error = mc_get_version(mc_io, 0, &mc_version);
if (error != 0) {
dev_err(&pdev->dev,
"mc_get_version() failed with error %d\n", error);
@@ -661,7 +661,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
if (error < 0)
goto error_cleanup_mc_io;

-   error = dpmng_get_container_id(mc_io, &container_id);
+   error = dpmng_get_container_id(mc_io, 0, &container_id);
if (error < 0) {
dev_err(&pdev->dev,
"dpmng_get_container_id() failed: %d\n", error);
diff --git a/drivers/staging/fsl-mc/include/dpmng.h 
b/drivers/staging/fsl-mc/include/dpmng.h
index 1b052b8..4a0996c 100644
--- a/drivers/staging/fsl-mc/include/dpmng.h
+++ b/drivers/staging/fsl-mc/include/dpmng.h
@@ -41,11 +41,11 @@ struct fsl_mc_io;
 /**
  * Management Complex firmware version information
  */
-#define MC_VER_MAJOR 6
+#define MC_VER_MAJOR 8
 #define MC_VER_MINOR 0

 /**
- * struct mc_versoin
+ * struct mc_version
  * @major: Major version number: incremented on API compatibility changes
  * @minor: Minor version number: incremented on API additions (that are
  * backward compatible); reset when major version is incremented
@@ -62,19 +62,25 @@ struct mc_version {
  * mc_get_version() - Retrieves the Management Complex firmware
  * version information
  * @mc_io: Pointer to opaque I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
  * @mc_ver_info:   Returned version information structure
  *
  * Return: '0' on Success; Error code otherwise.
  */
-int mc_get_version(struct fsl_mc_io *mc_io, struct mc_version *mc_ver_info);
+int mc_get_version(struct fsl_mc_io*mc_io,
+  uint32_t cmd_flags,
+  struct mc_version*mc_ver_info);

 /**
  * dpmng_get_container_id() - Get container ID associated with a given portal.
  * @mc_io: Pointer to MC portal's I/O object
+ * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_'
  * @container_id:  Requested container ID
  *
  * Return: '0' on Success; Error code otherwise.
  */
-int dpmng_get_container_id(struct fsl_mc_io *mc_io, int *container_id);
+int dpmng_get_container_id(struct fsl_mc_io*mc_io,
+  uint32_t cmd_flags,
+  int  *container_id);

 #endif /* __FSL_DPMNG_H */
--
2.3.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/d

[PATCH v2 1/6] staging: fsl-mc: Add new flags field to MC command header

2015-09-22 Thread J. German Rivera
The Management Complex (MC) binary interface added a new "flags"
field to the command header.
Add the definitions for this field in preparation for adding the
new cmd_flags parameter to all MC interface APIs.

Signed-off-by: J. German Rivera 
---
 drivers/staging/fsl-mc/include/mc-cmd.h | 30 --
 1 file changed, 24 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/fsl-mc/include/mc-cmd.h 
b/drivers/staging/fsl-mc/include/mc-cmd.h
index 32501e0..af7de6e 100644
--- a/drivers/staging/fsl-mc/include/mc-cmd.h
+++ b/drivers/staging/fsl-mc/include/mc-cmd.h
@@ -67,14 +67,31 @@ enum mc_cmd_status {
MC_CMD_STATUS_INVALID_STATE = 0xC /* Invalid state */
 };

+/*
+ * MC command flags
+ */
+
+/* High priority flag */
+#define MC_CMD_FLAG_PRI0x8000
+/* Command completion flag */
+#define MC_CMD_FLAG_INTR_DIS   0x0100
+
+/*
+ * TODO Remove following two defines after completion of flib 8.0.0
+ * integration
+ */
+#define MC_CMD_PRI_LOW 0 /*!< Low Priority command indication */
+#define MC_CMD_PRI_HIGH1 /*!< High Priority command indication 
*/
+
 #define MC_CMD_HDR_CMDID_O 52  /* Command ID field offset */
 #define MC_CMD_HDR_CMDID_S 12  /* Command ID field size */
 #define MC_CMD_HDR_TOKEN_O 38  /* Token field offset */
 #define MC_CMD_HDR_TOKEN_S 10  /* Token field size */
 #define MC_CMD_HDR_STATUS_O16  /* Status field offset */
 #define MC_CMD_HDR_STATUS_S8   /* Status field size*/
-#define MC_CMD_HDR_PRI_O   15  /* Priority field offset */
-#define MC_CMD_HDR_PRI_S   1   /* Priority field size */
+#define MC_CMD_HDR_FLAGS_O 0   /* Flags field offset */
+#define MC_CMD_HDR_FLAGS_S 32  /* Flags field size*/
+#define MC_CMD_HDR_FLAGS_MASK  0xFF00FF00 /* Command flags mask */

 #define MC_CMD_HDR_READ_STATUS(_hdr) \
((enum mc_cmd_status)mc_dec((_hdr), \
@@ -83,8 +100,8 @@ enum mc_cmd_status {
 #define MC_CMD_HDR_READ_TOKEN(_hdr) \
((uint16_t)mc_dec((_hdr), MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S))

-#define MC_CMD_PRI_LOW 0 /* Low Priority command indication */
-#define MC_CMD_PRI_HIGH1 /* High Priority command indication */
+#define MC_CMD_HDR_READ_FLAGS(_hdr) \
+   ((uint32_t)mc_dec((_hdr), MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S))

 #define MC_EXT_OP(_ext, _param, _offset, _width, _type, _arg) \
((_ext)[_param] |= mc_enc((_offset), (_width), _arg))
@@ -96,14 +113,15 @@ enum mc_cmd_status {
(_arg = (_type)mc_dec(_cmd.params[_param], (_offset), (_width)))

 static inline uint64_t mc_encode_cmd_header(uint16_t cmd_id,
-   uint8_t priority,
+   uint32_t cmd_flags,
uint16_t token)
 {
uint64_t hdr;

hdr = mc_enc(MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S, cmd_id);
+   hdr |= mc_enc(MC_CMD_HDR_FLAGS_O, MC_CMD_HDR_FLAGS_S,
+  (cmd_flags & MC_CMD_HDR_FLAGS_MASK));
hdr |= mc_enc(MC_CMD_HDR_TOKEN_O, MC_CMD_HDR_TOKEN_S, token);
-   hdr |= mc_enc(MC_CMD_HDR_PRI_O, MC_CMD_HDR_PRI_S, priority);
hdr |= mc_enc(MC_CMD_HDR_STATUS_O, MC_CMD_HDR_STATUS_S,
   MC_CMD_STATUS_READY);

--
2.3.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 0/6] staging: fsl-mc: up-rev version of MC interface code

2015-09-22 Thread J. German Rivera
The DPAA2 management complex has a versioned binary interface
that has to be kept in sync with the DPAA2 drivers. This patch
series uprevs the APIs that build MC commands and parse results.
This uprev is needed to support object interrupts.

MC binary interface changes
   -overall version from 6.0 to 8.0
   -dprc version from 3.0 to 4.0
   -dpbp and dpmcp versions from 2.0 to 2.1
   -new dprc commands -- set/get obj irq, set obj label,
get obj descriptor
   -removed commands -- get portal paddr
   -object regions are reported as region offsets not physical
addresses

build/parse API changes
   -flags arg is added to all APIs for future extensibility,
hardcoded priority bit is now a flag
   -IRQ-related args are consolidated into an irq_cfg struct

Changes in v2:
Split single patch into a patch series as requested by Greg K-H.
The new patch series consists of the following patches:

Patch 1: Add new flags field to MC command header
Patch 2: uprev binary interface for dpmng objects to v8.0
Patch 3: up-rev binary interface for dpbp objects to v2.0
Patch 4: up-rev binary interface for dpmcp objects to v2.0
Patch 5: up-rev binary interface for dpcon objects to v2.0
Patch 6: up-rev binary interface for dprc objects to v4.0
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 5/6] staging: fsl-mc: up-rev dpcon binary interface to v2.0

2015-09-22 Thread J. German Rivera
dpcon object minor version number updated to match latest
MC firmware. This change is needed because the dpcon
object binds to the allocator and the current driver match
logic uses object version numbers.

Signed-off-by: J. German Rivera 
---
 drivers/staging/fsl-mc/include/dpcon-cmd.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/fsl-mc/include/dpcon-cmd.h 
b/drivers/staging/fsl-mc/include/dpcon-cmd.h
index c878d33..2617024 100644
--- a/drivers/staging/fsl-mc/include/dpcon-cmd.h
+++ b/drivers/staging/fsl-mc/include/dpcon-cmd.h
@@ -34,7 +34,7 @@

 /* DPCON Version */
 #define DPCON_VER_MAJOR2
-#define DPCON_VER_MINOR0
+#define DPCON_VER_MINOR1

 /* Command IDs */
 #define DPCON_CMDID_CLOSE  0x800
--
2.3.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v11 4/4] fpga manager: add driver for socfpga fpga manager

2015-09-22 Thread Josh Cartwright
On Tue, Sep 22, 2015 at 10:21:11AM -0500, at...@opensource.altera.com wrote:
> From: Alan Tull 
> 
> Add driver to fpga manager framework to allow configuration
> of FPGA in Altera SoCFPGA parts.
> 
> Signed-off-by: Alan Tull 
> Acked-by: Michal Simek 
> Acked-by: Moritz Fischer 
[..]
> +++ b/drivers/fpga/Kconfig
> @@ -11,4 +11,14 @@ config FPGA
> kernel.  The FPGA framework adds a FPGA manager class and FPGA
> manager drivers.
>  
> +if FPGA

FPGA is unconditionally set here, otherwise drivers/fpga/Kconfig
wouldn't even be considered.

> +
> +config FPGA_MGR_SOCFPGA
> + tristate "Altera SOCFPGA FPGA Manager"
> + depends on ARCH_SOCFPGA
> + help
> +   FPGA manager driver support for Altera SOCFPGA.
> +
> +endif # FPGA
> +
>  endmenu
> diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
> index 3313c52..ba6c5c5 100644
> --- a/drivers/fpga/Makefile
> +++ b/drivers/fpga/Makefile
> @@ -6,3 +6,4 @@
>  obj-$(CONFIG_FPGA)   += fpga-mgr.o
>  
>  # FPGA Manager Drivers
> +obj-$(CONFIG_FPGA_MGR_SOCFPGA)   += socfpga.o
> diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c
> new file mode 100644
> index 000..706b80d
> --- /dev/null
> +++ b/drivers/fpga/socfpga.c
[..]
> +/*
> + * Step 9: write data to the FPGA data register
> + */
> +static int socfpga_fpga_ops_configure_write(struct fpga_manager *mgr,
> + const char *buf, size_t count)
> +{
> + struct socfpga_fpga_priv *priv = mgr->priv;
> + u32 *buffer_32 = (u32 *)buf;

Seems sketchy from an endianess perspective, but it may be okay if
SOCFPGA doesn't support BE (which my follow up question would be: why
not?).  Same thing applies with seemingly cavalier usages of the
__raw_readl/writel variants.

  Josh


signature.asc
Description: PGP signature
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: lustre: make non-exported functions static

2015-09-22 Thread Anton Gerasimov
Declare non-exported functions in pack_generic.c as static.

Signed-off-by: Anton Gerasimov 
---
 drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c 
b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
index f138061..dd31215 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
@@ -442,8 +442,8 @@ void *lustre_msg_buf(struct lustre_msg *m, int n, int 
min_size)
 }
 EXPORT_SYMBOL(lustre_msg_buf);
 
-int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment,
-unsigned int newlen, int move_data)
+static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment,
+   unsigned int newlen, int move_data)
 {
char *tail = NULL, *newpos;
int tail_len = 0, n;
@@ -1929,7 +1929,7 @@ void lustre_swab_fid2path(struct getinfo_fid2path *gf)
 }
 EXPORT_SYMBOL(lustre_swab_fid2path);
 
-void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent)
+static void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent)
 {
__swab64s(&fm_extent->fe_logical);
__swab64s(&fm_extent->fe_physical);
@@ -2405,7 +2405,7 @@ void lustre_swab_hsm_state_set(struct hsm_state_set *hss)
 }
 EXPORT_SYMBOL(lustre_swab_hsm_state_set);
 
-void lustre_swab_hsm_extent(struct hsm_extent *extent)
+static void lustre_swab_hsm_extent(struct hsm_extent *extent)
 {
__swab64s(&extent->offset);
__swab64s(&extent->length);
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: lustre: include header with local ptlrpc declarations

2015-09-22 Thread Anton Gerasimov
Include the header with declaations of variables that are shared between
several sources in ptlrpc module into the appropriate source files.

Signed-off-by: Anton Gerasimov 
---
 drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 2 ++
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
index ce1c563d..0f3c693 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
@@ -47,6 +47,8 @@
 #include "../include/lustre_net.h"
 #include "../include/lustre_sec.h"
 
+#include "ptlrpc_internal.h"
+
 static struct ptlrpc_sec_policy null_policy;
 static struct ptlrpc_sec   null_sec;
 static struct ptlrpc_cli_ctxnull_cli_ctx;
diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c 
b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
index b2313af..40f720c 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
@@ -43,6 +43,8 @@
 #include "../include/obd_class.h"
 #include "../include/lustre_net.h"
 #include "../include/lustre_disk.h"
+#include "ptlrpc_internal.h"
+
 void lustre_assert_wire_constants(void)
 {
 /* Wire protocol assertions generated by 'wirecheck'
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: lustre: add shared variables to the header

2015-09-22 Thread Anton Gerasimov
This patch adds declarations for variables used in several files
across the ptlrpc module to the local header.

Signed-off-by: Anton Gerasimov 
---
 drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h 
b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
index 34c7e28..4e35b14 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
@@ -47,6 +47,10 @@ struct ldlm_res_id;
 struct ptlrpc_request_set;
 extern int test_req_buffer_pressure;
 extern struct mutex ptlrpc_all_services_mutex;
+extern struct list_head ptlrpc_all_services;
+
+extern struct mutex ptlrpcd_mutex;
+extern struct mutex pinger_mutex;
 
 int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait);
 /* ptlrpcd.c */
@@ -110,6 +114,8 @@ struct nrs_core {
 
 };
 
+extern struct nrs_core nrs_core;
+
 int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc);
 void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc);
 
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/3] staging: lustre: fix (non-)static symbols issues

2015-09-22 Thread Anton Gerasimov
This series of patches eliminates some sparse warnings concerning
static variables in lustre rtlrpc module where it seemed reasonable.
Symbols that are really local to a source file are made static and
declarations added to a header for symbols that are shared between
source files.

Anton Gerasimov (3):
  staging: lustre: add shared variables to the header
  staging: lustre: include header with local ptlrpc declarations
  staging: lustre: make non-exported functions static

 drivers/staging/lustre/lustre/ptlrpc/pack_generic.c| 8 
 drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++
 drivers/staging/lustre/lustre/ptlrpc/sec_null.c| 2 ++
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c| 2 ++
 4 files changed, 14 insertions(+), 4 deletions(-)

-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] storvsc: get rid of homegrown copy_{to,from}_bounce_buffer()

2015-09-22 Thread Christoph Hellwig
On Tue, Sep 22, 2015 at 06:27:50PM +0200, Vitaly Kuznetsov wrote:
> Storvsc driver needs to ensure there are no 'holes' in the presented
> sg list (all segments in the middle of the list need to be of PAGE_SIZE).

I think it should instead set a virt_boundary.  That's what we added for
the NVMe driver which has the same requirements, and Sagi recently also
switched iSER to it after we ensured that flag is handled correctly by
the SG_IO ioctl.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/4] staging: rtl8188eu: don't cast when calling rtw_set_fixed_ie()

2015-09-22 Thread Luca Ceresoli
The 'pbuf' and 'source' arguments to rtw_set_fixed_ie() are (void *), the
explicit typecasts are not needed. They just make code less readable.

Also fix checkpatch issues in the lines touched:
  ERROR: space prohibited before that ',' (ctx:WxW)
  WARNING: line over 80 characters
  CHECK: Unnecessary parentheses around 

Note: some of the modified lines are still over 80 characters because they
are not fixable by just adding newlines. They will be fixed in a later
patch.

Signed-off-by: Luca Ceresoli 
Cc: Larry Finger 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 60 ++-
 1 file changed, 40 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index 4258a5e8ed68..e31eae9b0583 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -812,17 +812,20 @@ static void issue_auth(struct adapter *padapter, struct 
sta_info *psta,
le_val16 = 0;
}
 
-   pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned 
char *)&le_val16, &(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, &le_val16,
+ &pattrib->pktlen);
 
/*  setting auth seq number */
val16 = (u16)psta->auth_seq;
le_val16 = cpu_to_le16(val16);
-   pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned 
char *)&le_val16, &(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, &le_val16,
+ &pattrib->pktlen);
 
/*  setting status code... */
val16 = status;
le_val16 = cpu_to_le16(val16);
-   pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char 
*)&le_val16, &(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_,
+ &le_val16, &pattrib->pktlen);
 
/*  added challenging text... */
if ((psta->auth_seq == 2) && (psta->state & WIFI_FW_AUTH_STATE) 
&& (use_shared_key == 1))
@@ -844,23 +847,27 @@ static void issue_auth(struct adapter *padapter, struct 
sta_info *psta,
if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & 
WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) {
val32 = (pmlmeinfo->iv++) | (pmlmeinfo->key_index << 
30);
le_tmp32 = cpu_to_le32(val32);
-   pframe = rtw_set_fixed_ie(pframe, 4, (unsigned char 
*)&le_tmp32, &(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, 4, &le_tmp32,
+ &pattrib->pktlen);
 
pattrib->iv_len = 4;
}
 
le_tmp16 = cpu_to_le16(val16);
-   pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, (unsigned 
char *)&le_tmp16, &(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, _AUTH_ALGM_NUM_, &le_tmp16,
+ &pattrib->pktlen);
 
/*  setting auth seq number */
val16 = pmlmeinfo->auth_seq;
le_tmp16 = cpu_to_le16(val16);
-   pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, (unsigned 
char *)&le_tmp16, &(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, _AUTH_SEQ_NUM_, &le_tmp16,
+ &pattrib->pktlen);
 
 
/*  setting status code... */
le_tmp16 = cpu_to_le16(status);
-   pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, (unsigned char 
*)&le_tmp16, &(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, &le_tmp16,
+ &pattrib->pktlen);
 
/*  then checking to see if sending challenging text... */
if ((pmlmeinfo->auth_seq == 3) && (pmlmeinfo->state & 
WIFI_FW_AUTH_STATE) && (use_shared_key == 1)) {
@@ -944,13 +951,14 @@ static void issue_asocrsp(struct adapter *padapter, 
unsigned short status,
/* capability */
val = *(unsigned short *)rtw_get_capability_from_ie(ie);
 
-   pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_ , (unsigned char *)&val, 
&(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, _CAPABILITY_, &val, &pattrib->pktlen);
 
lestatus = cpu_to_le16(status);
-   pframe = rtw_set_fixed_ie(pframe , _STATUS_CODE_ , (unsigned char 
*)&lestatus, &(pattrib->pktlen));
+   pframe = rtw_set_fixed_ie(pframe, _STATUS_CODE_, &lestatus,
+ &pattrib->pktlen);
 
leval = cpu_to_le16(pstat->aid | BIT(14) | BIT(15));
-   pframe = rtw_set_fixed_ie(pframe, _ASOC_ID_ , (unsigned char *)&leval, 
&(pattrib->pktlen)

[PATCH 4/4] staging: rtl8188eu: issue_action_BA(): extract ADDBA_req pointer

2015-09-22 Thread Luca Ceresoli
pmlmeinfo->ADDBA_req is accessed three times in this function, but it
contributes to generating lines above 80 characters that are not easy to
split in a nice way.

Extract a pointer to it to make code slightly more concise and fix some
lines over 80 characters.

Signed-off-by: Luca Ceresoli 
Cc: Larry Finger 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index e31eae9b0583..0270755ec546 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -1719,13 +1719,17 @@ static void issue_action_BA(struct adapter *padapter, 
unsigned char *raddr,
  &pattrib->pktlen);
break;
case 1: /* ADDBA rsp */
+   {
+   struct ADDBA_request *ADDBA_req = &pmlmeinfo->ADDBA_req;
+
pframe = rtw_set_fixed_ie(pframe, 1,
- 
&pmlmeinfo->ADDBA_req.dialog_token,
+ &ADDBA_req->dialog_token,
  &pattrib->pktlen);
pframe = rtw_set_fixed_ie(pframe, 2, &status,
  &pattrib->pktlen);
 
-   BA_para_set = 
le16_to_cpu(pmlmeinfo->ADDBA_req.BA_para_set) & 0x3f;
+   BA_para_set = le16_to_cpu(ADDBA_req->BA_para_set) &
+ 0x3f;
rtw_hal_get_def_var(padapter, 
HW_VAR_MAX_RX_AMPDU_FACTOR, &max_rx_ampdu_factor);
switch (max_rx_ampdu_factor) {
case MAX_AMPDU_FACTOR_64K:
@@ -1754,9 +1758,10 @@ static void issue_action_BA(struct adapter *padapter, 
unsigned char *raddr,
pframe = rtw_set_fixed_ie(pframe, 2, &(le_tmp),
  &pattrib->pktlen);
pframe = rtw_set_fixed_ie(pframe, 2,
- 
&pmlmeinfo->ADDBA_req.BA_timeout_value,
+ &ADDBA_req->BA_timeout_value,
  &pattrib->pktlen);
break;
+   }
case 2:/* DELBA */
BA_para_set = (status & 0x1F) << 3;
le_tmp = cpu_to_le16(BA_para_set);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/4] staging: rtl8188eu: rtw_set_fixed_ie(): accept void* parameters

2015-09-22 Thread Luca Ceresoli
rtw_set_ie() is a memcpy-like function, taking addresses of memory buffers
among its parameters. Similarly to memcpy, change the parameters to be
void*. This will allow to get rid of typecasts whenever it is called.

Signed-off-by: Luca Ceresoli 
Cc: Larry Finger 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/rtl8188eu/core/rtw_ieee80211.c | 8 
 drivers/staging/rtl8188eu/include/ieee80211.h  | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c 
b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
index c3c582881a09..39325a3a2fa2 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ieee80211.c
@@ -130,12 +130,12 @@ int rtw_check_network_type(unsigned char *rate, int 
ratelen, int channel)
}
 }
 
-u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len, unsigned char 
*source,
-   unsigned int *frlen)
+u8 *rtw_set_fixed_ie(void *pbuf, unsigned int len, void *source,
+unsigned int *frlen)
 {
-   memcpy((void *)pbuf, (void *)source, len);
+   memcpy(pbuf, source, len);
*frlen = *frlen + len;
-   return pbuf + len;
+   return ((u8 *)pbuf) + len;
 }
 
 /*  rtw_set_ie will update frame length */
diff --git a/drivers/staging/rtl8188eu/include/ieee80211.h 
b/drivers/staging/rtl8188eu/include/ieee80211.h
index 6400f75707bd..f8f5eb6b7976 100644
--- a/drivers/staging/rtl8188eu/include/ieee80211.h
+++ b/drivers/staging/rtl8188eu/include/ieee80211.h
@@ -1092,8 +1092,8 @@ enum parse_res rtw_ieee802_11_parse_elems(u8 *start, uint 
len,
  struct rtw_ieee802_11_elems *elems,
  int show_errors);
 
-u8 *rtw_set_fixed_ie(unsigned char *pbuf, unsigned int len,
-unsigned char *source, unsigned int *frlen);
+u8 *rtw_set_fixed_ie(void *pbuf, unsigned int len,
+void *source, unsigned int *frlen);
 u8 *rtw_set_ie(u8 *pbuf, int index, uint len, u8 *source, uint *frlen);
 
 enum secondary_ch_offset {
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/4] staging: rtl8188eu: remove useless comment

2015-09-22 Thread Luca Ceresoli
This comment gives pretty much the same information as the name of the
function that it immediately precedes.

Signed-off-by: Luca Ceresoli 
Cc: Larry Finger 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index dd820185110f..4258a5e8ed68 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -3483,7 +3483,6 @@ static unsigned int OnAssocRsp(struct adapter *padapter,
pmlmeinfo->state &= (~WIFI_FW_ASSOC_STATE);
pmlmeinfo->state |= WIFI_FW_ASSOC_SUCCESS;
 
-   /* Update Basic Rate Table for spec, 2010-12-28 , by thomas */
UpdateBrateTbl(padapter, pmlmeinfo->network.SupportedRates);
 
 report_assoc_result:
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: rtl8712_recv.c: Fix typo error "cacluated"

2015-09-22 Thread Punit Vara
This patch is to the rtl8712_rercv.c that fixes up typo error in word
"calculated"

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/rtl8712_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c 
b/drivers/staging/rtl8712/rtl8712_recv.c
index 2da2548..97f45a0 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -864,7 +864,7 @@ static void query_rx_phy_status(struct _adapter *padapter,
total_rssi += rssi;
}
/*
-* (2)PWDB, Average PWDB cacluated by hardware (for
+* (2)PWDB, Average PWDB calculated by hardware (for
 * rate adaptive)
 */
rx_pwr_all = (((pphy_head[PHY_STAT_PWDB_ALL_SHT]) >> 1) & 0x7f)
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: lustre: make non-exported functions static

2015-09-22 Thread Anton Gerasimov
Declare non-exported functions in pack_generic.c as static.

Signed-off-by: Anton Gerasimov 
---
 drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c 
b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
index f138061..dd31215 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/pack_generic.c
@@ -442,8 +442,8 @@ void *lustre_msg_buf(struct lustre_msg *m, int n, int 
min_size)
 }
 EXPORT_SYMBOL(lustre_msg_buf);
 
-int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment,
-unsigned int newlen, int move_data)
+static int lustre_shrink_msg_v2(struct lustre_msg_v2 *msg, int segment,
+   unsigned int newlen, int move_data)
 {
char *tail = NULL, *newpos;
int tail_len = 0, n;
@@ -1929,7 +1929,7 @@ void lustre_swab_fid2path(struct getinfo_fid2path *gf)
 }
 EXPORT_SYMBOL(lustre_swab_fid2path);
 
-void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent)
+static void lustre_swab_fiemap_extent(struct ll_fiemap_extent *fm_extent)
 {
__swab64s(&fm_extent->fe_logical);
__swab64s(&fm_extent->fe_physical);
@@ -2405,7 +2405,7 @@ void lustre_swab_hsm_state_set(struct hsm_state_set *hss)
 }
 EXPORT_SYMBOL(lustre_swab_hsm_state_set);
 
-void lustre_swab_hsm_extent(struct hsm_extent *extent)
+static void lustre_swab_hsm_extent(struct hsm_extent *extent)
 {
__swab64s(&extent->offset);
__swab64s(&extent->length);
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: lustre: include header with local ptlrpc declarations

2015-09-22 Thread Anton Gerasimov
Include the header with declaations of variables that are shared between
several sources in ptlrpc module into the appropriate source files.

Signed-off-by: Anton Gerasimov 
---
 drivers/staging/lustre/lustre/ptlrpc/sec_null.c | 2 ++
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
index ce1c563d..0f3c693 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec_null.c
@@ -47,6 +47,8 @@
 #include "../include/lustre_net.h"
 #include "../include/lustre_sec.h"
 
+#include "ptlrpc_internal.h"
+
 static struct ptlrpc_sec_policy null_policy;
 static struct ptlrpc_sec   null_sec;
 static struct ptlrpc_cli_ctxnull_cli_ctx;
diff --git a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c 
b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
index b2313af..40f720c 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/wiretest.c
@@ -43,6 +43,8 @@
 #include "../include/obd_class.h"
 #include "../include/lustre_net.h"
 #include "../include/lustre_disk.h"
+#include "ptlrpc_internal.h"
+
 void lustre_assert_wire_constants(void)
 {
 /* Wire protocol assertions generated by 'wirecheck'
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: lustre: add shared variables to the header

2015-09-22 Thread Anton Gerasimov
This patch adds declarations for variables used in several files
across the ptlrpc module to the local header.

Signed-off-by: Anton Gerasimov 
---
 drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h 
b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
index 34c7e28..4e35b14 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h
@@ -47,6 +47,10 @@ struct ldlm_res_id;
 struct ptlrpc_request_set;
 extern int test_req_buffer_pressure;
 extern struct mutex ptlrpc_all_services_mutex;
+extern struct list_head ptlrpc_all_services;
+
+extern struct mutex ptlrpcd_mutex;
+extern struct mutex pinger_mutex;
 
 int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait);
 /* ptlrpcd.c */
@@ -110,6 +114,8 @@ struct nrs_core {
 
 };
 
+extern struct nrs_core nrs_core;
+
 int ptlrpc_service_nrs_setup(struct ptlrpc_service *svc);
 void ptlrpc_service_nrs_cleanup(struct ptlrpc_service *svc);
 
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/3] staging: lustre: fix (non-)static symbols issues

2015-09-22 Thread Anton Gerasimov
This series of patches eliminates some sparse warnings concerning
static variables in lustre rtlrpc module where it seemed reasonable.
Symbols that are really local to a source file are made static and
declarations added to a header for symbols that are shared between
source files.

Anton Gerasimov (3):
  staging: lustre: add shared variables to the header
  staging: lustre: include header with local ptlrpc declarations
  staging: lustre: make non-exported functions static

 drivers/staging/lustre/lustre/ptlrpc/pack_generic.c| 8 
 drivers/staging/lustre/lustre/ptlrpc/ptlrpc_internal.h | 6 ++
 drivers/staging/lustre/lustre/ptlrpc/sec_null.c| 2 ++
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c| 2 ++
 4 files changed, 14 insertions(+), 4 deletions(-)

-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: rtl8723au: Mark type casts to __le32 as intentional

2015-09-22 Thread Larry Finger

On 09/22/2015 02:24 AM, Lars Svensson wrote:

Fixing Sparse warnings about intentional type casts in rtw_security.c
as below.

   CHECK   drivers/staging/rtl8723au/core/rtw_security.c
drivers/staging/rtl8723au/core/rtw_security.c:248:22: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:249:24: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:776:22: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:777:24: \
warning: cast to restricted __le32

Signed-off-by: Lars Svensson 
---
  drivers/staging/rtl8723au/core/rtw_security.c | 15 ++-
  1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c 
b/drivers/staging/rtl8723au/core/rtw_security.c
index 3d40bab..311dfc1 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -213,6 +213,7 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
  {
/*  exclude ICV */
u32 actual_crc, expected_crc;
+   __le32 crc_le;
struct arc4context mycontext;
int length;
u32 keylength;
@@ -245,8 +246,10 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
arcfour_encrypt(&mycontext, payload, payload, length);

/* calculate icv and compare the icv */
-   actual_crc = le32_to_cpu(getcrc32(payload, length - 4));
-   expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4]));
+   crc_le = (__force __le32)getcrc32(payload, length - 4);
+   actual_crc = le32_to_cpu(crc_le);
+   crc_le = (__force __le32)get_unaligned_le32(&payload[length - 4]);
+   expected_crc = le32_to_cpu(crc_le);

if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
@@ -717,6 +720,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
u8 rc4key[16];
u8 ttkey[16];
u32 actual_crc, expected_crc;
+   __le32 crc_le;
struct arc4context mycontext;
int length;
u32 prwskeylen;
@@ -772,9 +776,10 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
/* 4 decrypt payload include icv */
arcfour_init(&mycontext, rc4key, 16);
arcfour_encrypt(&mycontext, payload, payload, length);
-
-   actual_crc = le32_to_cpu(getcrc32(payload, length - 4));
-   expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4]));
+   crc_le = (__force __le32)getcrc32(payload, length - 4);
+   actual_crc = le32_to_cpu(crc_le);
+   crc_le = (__force __le32)get_unaligned_le32(&payload[length - 4]);
+   expected_crc = le32_to_cpu(crc_le);

if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,



You may have silenced the Sparse warnings, but the code was not wrong. Your 
version is also correct; however, you end up with some really ugly casts.


Here is my analysis of these two, identical sections:

The output of getcrc32() is an unsigned, 4-byte quantity that has the endianess 
of the cpu. Therefore, the le32_to_cpu() conversion is suspect for a big-endian 
machine. Those statements should be be a simple "actual_crc = getcrc32().


The expected crc comes from a byte string that is in little-endian order. For 
that reason, it needs to be converted on big-endian machines, which is exactly 
what get_unaligned_le32() does. Thus, the second statement in each block becomes 
"expected_crc = get_unaligned_le32()".


Both the original code and your patch byte swap both quantities, thus they get 
the correct result. at least if all you are doing is to compare the two results.


The *complete* patch to fix the Sparse warnings is

Index: wireless-drivers-next-new/drivers/staging/rtl8723au/core/rtw_security.c
===
--- wireless-drivers-next-new.orig/drivers/staging/rtl8723au/core/rtw_security.c
+++ wireless-drivers-next-new/drivers/staging/rtl8723au/core/rtw_security.c
@@ -245,8 +245,8 @@ void rtw_wep_decrypt23a(struct rtw_adapt
arcfour_encrypt(&mycontext, payload, payload, length);

/* calculate icv and compare the icv */
-   actual_crc = le32_to_cpu(getcrc32(payload, length - 4));
-   expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4]));
+   actual_crc = getcrc32(payload, length - 4);
+   expected_crc = get_unaligned_le32(&payload[length - 4]);

if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
@@ -773,8 +773,8 @@ int rtw_tkip_decrypt23a(struct rtw_adapt
arcfour_init(&mycontext, rc4key, 16);
arcfour_encrypt(&mycontext, payload, payload, length);

-   actual_crc = le32_to_cpu(getcrc32(payload, length - 4));
-   expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4]));
+   actual_crc = getcrc32(payload, length - 4);
+   e

[PATCH] Staging: rtl8712: rtl8712_recv.c: Coding Style warnings fix for block comments

2015-09-22 Thread Punit Vara
This patch is to the rtl8712_recv.c file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/rtl8712_recv.c | 111 ++---
 1 file changed, 74 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c 
b/drivers/staging/rtl8712/rtl8712_recv.c
index 4fa2540..2da2548 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -162,8 +162,10 @@ static void update_recvframe_attrib_from_recvstat(struct 
rx_pkt_attrib *pattrib,
 
drvinfo_sz = (le32_to_cpu(prxstat->rxdw0)&0x000f)>>16;
drvinfo_sz <<= 3;
-   /*TODO:
-* Offset 0 */
+   /*
+* TODO:
+* Offset 0
+*/
pattrib->bdecrypted = ((le32_to_cpu(prxstat->rxdw0) & BIT(27)) >> 27)
 ? 0 : 1;
pattrib->crc_err = (le32_to_cpu(prxstat->rxdw0) & BIT(14)) >> 14;
@@ -208,8 +210,10 @@ static union recv_frame *recvframe_defrag(struct _adapter 
*adapter,
pfhdr = &prframe->u.hdr;
curfragnum = 0;
if (curfragnum != pfhdr->attrib.frag_num) {
-   /*the first fragment number must be 0
-*free the whole queue*/
+   /*
+* the first fragment number must be 0
+* free the whole queue
+*/
r8712_free_recvframe(prframe, pfree_recv_queue);
r8712_free_recvframe_queue(defrag_q, pfree_recv_queue);
return NULL;
@@ -222,19 +226,25 @@ static union recv_frame *recvframe_defrag(struct _adapter 
*adapter,
pnfhdr = &pnextrframe->u.hdr;
/*check the fragment sequence  (2nd ~n fragment frame) */
if (curfragnum != pnfhdr->attrib.frag_num) {
-   /* the fragment number must increase  (after decache)
-* release the defrag_q & prframe */
+   /*
+* the fragment number must increase  (after decache)
+* release the defrag_q & prframe
+*/
r8712_free_recvframe(prframe, pfree_recv_queue);
r8712_free_recvframe_queue(defrag_q, pfree_recv_queue);
return NULL;
}
curfragnum++;
-   /* copy the 2nd~n fragment frame's payload to the first fragment
-* get the 2nd~last fragment frame's payload */
+   /*
+* copy the 2nd~n fragment frame's payload to the first fragment
+* get the 2nd~last fragment frame's payload
+*/
wlanhdr_offset = pnfhdr->attrib.hdrlen + pnfhdr->attrib.iv_len;
recvframe_pull(pnextrframe, wlanhdr_offset);
-   /* append  to first fragment frame's tail (if privacy frame,
-* pull the ICV) */
+   /*
+* append  to first fragment frame's tail (if privacy frame,
+* pull the ICV)
+*/
recvframe_pull_tail(prframe, pfhdr->attrib.icv_len);
memcpy(pfhdr->rx_tail, pnfhdr->rx_data, pnfhdr->len);
recvframe_put(prframe, pnfhdr->len);
@@ -276,8 +286,10 @@ union recv_frame *r8712_recvframe_chk_defrag(struct 
_adapter *padapter,
if ((ismfrag == 0) && (fragnum == 0))
prtnframe = precv_frame;/*isn't a fragment frame*/
if (ismfrag == 1) {
-   /* 0~(n-1) fragment frame
-* enqueue to defraf_g */
+   /*
+* 0~(n-1) fragment frame
+* enqueue to defraf_g
+*/
if (pdefrag_q != NULL) {
if (fragnum == 0) {
/*the first fragment*/
@@ -292,16 +304,20 @@ union recv_frame *r8712_recvframe_chk_defrag(struct 
_adapter *padapter,
list_add_tail(&pfhdr->list, phead);
prtnframe = NULL;
} else {
-   /* can't find this ta's defrag_queue, so free this
-* recv_frame */
+   /*
+* can't find this ta's defrag_queue, so free this
+* recv_frame
+*/
r8712_free_recvframe(precv_frame, pfree_recv_queue);
prtnframe = NULL;
}
 
}
if ((ismfrag == 0) && (fragnum != 0)) {
-   /* the last fragment frame
-* enqueue the last fragment */
+   /*
+* the last fragment frame
+* enqueue the last fragment
+*/
if (pdefrag_q != NULL) {
phead = &pdefrag_q->queue;
list

[PATCH] Staging: rtl8712: rtl8712_led.c: Coding style warnings fix for block comments

2015-09-22 Thread Punit Vara
This is patch to the rtl8712_led.c that fixes up following
warnings reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/rtl8712_led.c | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_led.c 
b/drivers/staging/rtl8712/rtl8712_led.c
index ada8d5d..1460b07 100644
--- a/drivers/staging/rtl8712/rtl8712_led.c
+++ b/drivers/staging/rtl8712/rtl8712_led.c
@@ -56,9 +56,11 @@ enum _LED_STATE_871x {
LED_BLINK_NORMAL = 3,
LED_BLINK_SLOWLY = 4,
LED_POWER_ON_BLINK = 5,
-   LED_SCAN_BLINK = 6, /* LED is blinking during scanning period,
+   LED_SCAN_BLINK = 6, /*
+* LED is blinking during scanning period,
 * the # of times to blink is depend on time
-* for scanning. */
+* for scanning.
+*/
LED_NO_LINK_BLINK = 7, /* LED is blinking during no link state. */
LED_BLINK_StartToBlink = 8,/* Customized for Sercomm Printer
* Server case */
@@ -109,8 +111,10 @@ static void InitLed871x(struct _adapter *padapter, struct 
LED_871x *pLed,
 static void DeInitLed871x(struct LED_871x *pLed)
 {
del_timer_sync(&pLed->BlinkTimer);
-   /* We should reset bLedBlinkInProgress if we cancel
-* the LedControlTimer, */
+   /*
+* We should reset bLedBlinkInProgress if we cancel
+* the LedControlTimer,
+*/
pLed->bLedBlinkInProgress = false;
 }
 
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: Coding style warning fix for block comment

2015-09-22 Thread Punit Vara
This is the patch to rtl8712_cmdctrl_bitdef.h file that fixes up
following warning reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h 
b/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h
index 8dffe10..b7dda90 100644
--- a/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h
+++ b/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h
@@ -21,7 +21,8 @@
 #define __RTL8712_CMDCTRL_BITDEF_H__
 
 /*
- * 2. Command Control Registers (Offset: 0x0040 - 0x004F)*/
+ * 2. Command Control Registers (Offset: 0x0040 - 0x004F)
+ */
 /*--*/
 /*   8192S (CMD) command register bits (Offset 0x40, 16 bits)*/
 /*--*/
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: rtl8712_hal.h: Coding style warnings fix for block comments

2015-09-22 Thread Punit Vara
This is the patch to rtl8712_hal.h file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/rtl8712_hal.h | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_hal.h 
b/drivers/staging/rtl8712/rtl8712_hal.h
index 4c51fa3..5585c5b 100644
--- a/drivers/staging/rtl8712/rtl8712_hal.h
+++ b/drivers/staging/rtl8712/rtl8712_hal.h
@@ -67,13 +67,17 @@ struct fw_priv {   /*8-bytes alignment required*/
/*--- long word 0 */
unsigned char signature_0;  /*0x12: CE product, 0x92: IT product*/
unsigned char signature_1;  /*0x87: CE product, 0x81: IT product*/
-   unsigned char hci_sel; /*0x81: PCI-AP, 01:PCIe, 02: 92S-U, 0x82: USB-AP,
-   * 0x12: 72S-U, 03:SDIO*/
+   unsigned char hci_sel; /*
+   * 0x81: PCI-AP, 01:PCIe, 02: 92S-U, 0x82:
+   * USB-AP,0x12: 72S-U, 03:SDIO
+   */
unsigned char chip_version; /*the same value as register value*/
unsigned char customer_ID_0; /*customer  ID low byte*/
unsigned char customer_ID_1; /*customer  ID high byte*/
-   unsigned char rf_config;  /*0x11:  1T1R, 0x12: 1T2R, 0x92: 1T2R turbo,
-* 0x22: 2T2R*/
+   unsigned char rf_config;  /*
+  * 0x11:  1T1R, 0x12: 1T2R, 0x92: 1T2R turbo,
+  * 0x22: 2T2R
+  */
unsigned char usb_ep_num;  /* 4: 4EP, 6: 6EP, 11: 11EP*/
/*--- long word 1 */
unsigned char regulatory_class_0; /*regulatory class bit map 0*/
@@ -96,8 +100,10 @@ struct fw_priv {   /*8-bytes alignment required*/
/*--- long word 3 */
unsigned char qos_en;/*1: QoS enable*/
unsigned char bw_40MHz_en;   /*1: 40MHz BW enable*/
-   unsigned char AMSDU2AMPDU_en;   /*1: 4181 convert AMSDU to AMPDU,
-  * 0: disable*/
+   unsigned char AMSDU2AMPDU_en;   /*
+* 1: 4181 convert AMSDU to AMPDU,
+* 0: disable
+*/
unsigned char AMPDU_en;   /*1: 11n AMPDU enable*/
unsigned char rate_control_offload; /*1: FW offloads,0: driver handles*/
unsigned char aggregation_offload;  /*1: FW offloads,0: driver handles*/
@@ -125,8 +131,10 @@ struct fw_priv {   /*8-bytes alignment required*/
 
 struct fw_hdr {/*8-byte alignment required*/
unsigned short  signature;
-   unsigned short  version;/*0x8000 ~ 0x8FFF for FPGA version,
-*0x ~ 0x7FFF for ASIC version,*/
+   unsigned short  version;/*
+* 0x8000 ~ 0x8FFF for FPGA version,
+* 0x ~ 0x7FFF for ASIC version,
+*/
unsigned intdmem_size;/*define the size of boot loader*/
unsigned intimg_IMEM_size; /*define the size of FW in IMEM*/
unsigned intimg_SRAM_size; /*define the size of FW in SRAM*/
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 13/13] Staging: rtl8712: Coding style warning fix for block comment

2015-09-22 Thread Punit Vara
This patch is to rtl8712_gp_bitdef.h file that fixes up following
warning reported by checkpatch :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/rtl8712_gp_bitdef.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_gp_bitdef.h 
b/drivers/staging/rtl8712/rtl8712_gp_bitdef.h
index 138ea45..266b6172d 100644
--- a/drivers/staging/rtl8712/rtl8712_gp_bitdef.h
+++ b/drivers/staging/rtl8712/rtl8712_gp_bitdef.h
@@ -62,9 +62,11 @@
 
 
/**/
 
-#defineGPIOMUX_EN  BIT(3)  /* When this bit is set to "1",
+#defineGPIOMUX_EN  BIT(3)  /*
+* When this bit is set to "1",
 * GPIO PINs will switch to MAC
-* GPIO Function*/
+* GPIO Function
+*/
 #defineGPIOSEL_GPIO0   /* UART or JTAG or pure GPIO*/
 #defineGPIOSEL_PHYDBG  1   /* PHYDBG*/
 #defineGPIOSEL_BT  2   /* BT_coex*/
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: Coding style warning fix for block comment

2015-09-22 Thread Punit Vara
This is the patch to recv_linux.c file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h 
b/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h
index 8dffe10..b7dda90 100644
--- a/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h
+++ b/drivers/staging/rtl8712/rtl8712_cmdctrl_bitdef.h
@@ -21,7 +21,8 @@
 #define __RTL8712_CMDCTRL_BITDEF_H__
 
 /*
- * 2. Command Control Registers (Offset: 0x0040 - 0x004F)*/
+ * 2. Command Control Registers (Offset: 0x0040 - 0x004F)
+ */
 /*--*/
 /*   8192S (CMD) command register bits (Offset 0x40, 16 bits)*/
 /*--*/
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: rtl8712_cmd.c: Coding style warnings fix for block comments

2015-09-22 Thread Punit Vara
This patch is to the rtl8712_cmd.c file that fixes up warnings
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/rtl8712_cmd.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl8712_cmd.c 
b/drivers/staging/rtl8712/rtl8712_cmd.c
index 007f0a3..a8b6d20 100644
--- a/drivers/staging/rtl8712/rtl8712_cmd.c
+++ b/drivers/staging/rtl8712/rtl8712_cmd.c
@@ -63,20 +63,26 @@ static void check_hw_pbc(struct _adapter *padapter)
if (tmp1byte == 0xff)
return;
if (tmp1byte&HAL_8192S_HW_GPIO_WPS_BIT) {
-   /* Here we only set bPbcPressed to true
-* After trigger PBC, the variable will be set to false */
+   /*
+* Here we only set bPbcPressed to true
+* After trigger PBC, the variable will be set to false
+*/
DBG_8712("CheckPbcGPIO - PBC is pressed \n");
-   /* 0 is the default value and it means the application monitors
-* the HW PBC doesn't provide its pid to driver. */
+   /*
+* 0 is the default value and it means the application monitors
+* the HW PBC doesn't provide its pid to driver.
+*/
if (padapter->pid == 0)
return;
kill_pid(find_vpid(padapter->pid), SIGUSR1, 1);
}
 }
 
-/* query rx phy status from fw.
+/*
+ * query rx phy status from fw.
  * Adhoc mode: beacon.
- * Infrastructure mode: beacon , data. */
+ * Infrastructure mode: beacon , data.
+ */
 static void query_fw_rx_phy_status(struct _adapter *padapter)
 {
u32 val32 = 0;
@@ -254,10 +260,12 @@ static struct cmd_obj *cmd_hdl_filter(struct _adapter 
*padapter,
break;
case GEN_CMD_CODE(_JoinBss):
r8712_joinbss_reset(padapter);
-   /* Before set JoinBss_CMD to FW, driver must ensure FW is in
+   /*
+* Before set JoinBss_CMD to FW, driver must ensure FW is in
 * PS_MODE_ACTIVE. Directly write rpwm to radio on and assign
 * new pwr_mode to Driver, instead of use workitem to change
-* state. */
+* state.
+*/
if (padapter->pwrctrlpriv.pwr_mode > PS_MODE_ACTIVE) {
padapter->pwrctrlpriv.pwr_mode = PS_MODE_ACTIVE;
_enter_pwrlock(&(padapter->pwrctrlpriv.lock));
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: recv_linux.c: Coding style warning fix for block comment

2015-09-22 Thread Punit Vara
This is the patch to recv_linux.c file that fixes up following warning
reported by checkpatch.pl :

-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/recv_linux.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/recv_linux.c 
b/drivers/staging/rtl8712/recv_linux.c
index 4201ce7..c4eef1c 100644
--- a/drivers/staging/rtl8712/recv_linux.c
+++ b/drivers/staging/rtl8712/recv_linux.c
@@ -126,8 +126,10 @@ void r8712_recv_indicatepkt(struct _adapter *padapter,
skb->dev = padapter->pnetdev;
skb->protocol = eth_type_trans(skb, padapter->pnetdev);
netif_rx(skb);
-   precv_frame->u.hdr.pkt = NULL; /* pointers to NULL before
-   * r8712_free_recvframe() */
+   precv_frame->u.hdr.pkt = NULL; /*
+   * pointers to NULL before
+   * r8712_free_recvframe()
+   */
r8712_free_recvframe(precv_frame, pfree_recv_queue);
return;
 _recv_indicatepkt_drop:
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: os_intfs.c: Coding style warning fix for block comment

2015-09-22 Thread Punit Vara
This patch is to the os_intfs.c that fixes up warning
reported by checkpatch.pl :

-Block commens use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/os_intfs.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8712/os_intfs.c 
b/drivers/staging/rtl8712/os_intfs.c
index 5d551a1..ebbcd9b0 100644
--- a/drivers/staging/rtl8712/os_intfs.c
+++ b/drivers/staging/rtl8712/os_intfs.c
@@ -365,8 +365,10 @@ static void enable_video_mode(struct _adapter *padapter, 
int cbw40_value)
u32  intcmd = 0xf4000500;   /* enable bit8, bit10*/
 
if (cbw40_value) {
-   /* if the driver supports the 40M bandwidth,
-* we can enable the bit 9.*/
+   /*
+* if the driver supports the 40M bandwidth,
+* we can enable the bit 9.
+*/
intcmd |= 0x200;
}
r8712_fw_cmd(padapter, intcmd);
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCHv3 3/3] drm: bridge: anx78xx: Add anx78xx driver support by analogix.

2015-09-22 Thread Dan Carpenter
On Thu, Sep 10, 2015 at 06:35:52PM +0200, Enric Balletbo i Serra wrote:
> diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx.h 
> b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h
> new file mode 100644
> index 000..4f6dd1d
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx.h
> @@ -0,0 +1,44 @@
> +/*
> + * Copyright(c) 2015, Analogix Semiconductor. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#ifndef __ANX78xx_H
> +#define __ANX78xx_H
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define AUX_ERR  1
> +#define AUX_OK   0

Get rid of these.  They aren't used much and we could easily use normal
error codes instead.

> +
> +struct anx78xx_platform_data {
> + struct gpio_desc *gpiod_pd;
> + struct gpio_desc *gpiod_reset;
> + spinlock_t lock;
> +};
> +
> +struct anx78xx {
> + struct i2c_client *client;
> + struct anx78xx_platform_data *pdata;
> + struct delayed_work work;
> + struct workqueue_struct *workqueue;
> + struct mutex lock;
> +};
> +
> +void anx78xx_poweron(struct anx78xx *data);
> +void anx78xx_poweroff(struct anx78xx *data);
> +
> +#endif
> diff --git a/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c 
> b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c
> new file mode 100644
> index 000..b92d2bc
> --- /dev/null
> +++ b/drivers/gpu/drm/bridge/anx78xx/anx78xx_main.c
> @@ -0,0 +1,241 @@
> +/*
> + * Copyright(c) 2015, Analogix Semiconductor. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + *
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "anx78xx.h"
> +#include "slimport_tx_drv.h"
> +
> +void anx78xx_poweron(struct anx78xx *anx78xx)
> +{
> + struct device *dev = &anx78xx->client->dev;
> + struct anx78xx_platform_data *pdata = anx78xx->pdata;
> +
> + gpiod_set_value_cansleep(pdata->gpiod_reset, 0);
> + usleep_range(1000, 2000);
> +
> + gpiod_set_value_cansleep(pdata->gpiod_pd, 0);
> + usleep_range(1000, 2000);
> +
> + gpiod_set_value_cansleep(pdata->gpiod_reset, 1);
> +
> + dev_dbg(dev, "power on\n");

Remove these debug printks.  Use ftrace instead.

> +}
> +
> +void anx78xx_poweroff(struct anx78xx *anx78xx)
> +{
> + struct device *dev = &anx78xx->client->dev;
> + struct anx78xx_platform_data *pdata = anx78xx->pdata;
> +
> + gpiod_set_value_cansleep(pdata->gpiod_reset, 0);
> + usleep_range(1000, 2000);
> +
> + gpiod_set_value_cansleep(pdata->gpiod_pd, 1);
> + usleep_range(1000, 2000);
> +
> + dev_dbg(dev, "power down\n");

Delete.

> +}
> +
> +static int anx78xx_init_gpio(struct anx78xx *anx78xx)
> +{
> + struct device *dev = &anx78xx->client->dev;
> + struct anx78xx_platform_data *pdata = anx78xx->pdata;
> + int ret;
> +
> + /* gpio for chip power down */
> + pdata->gpiod_pd = devm_gpiod_get(dev, "pd", GPIOD_OUT_HIGH);
> + if (IS_ERR(pdata->gpiod_pd)) {
> + dev_err(dev, "unable to claim pd gpio\n");
> + ret = PTR_ERR(pdata->gpiod_pd);
> + return ret;


The ret variable isn't necessary in this function.

> + }
> +
> + /* gpio for chip reset */
> + pdata->gpiod_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR(pdata->gpiod_reset)) {
> + dev_err(dev, "unable to claim reset gpio\n");
> + ret = PTR_ERR(pdata->gpiod_reset);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int anx78xx_system_init(struct anx78xx *anx78xx)
> +{
> + struct device *dev = &anx78xx->client->dev;
> + int ret;
> +
> + ret = sp_chip_detect(anx78xx);

Make sp_chip_detect() use normal error codes.

> + if (ret == 0) {
> + anx78xx_poweroff(anx78xx);
> + dev_err(dev, "failed to detect anx78xx\n");
> + return -ENODEV;
> + }
> +
> + sp_tx_variable_init();
> + return 0;
> +}
> +
> +static void anx78xx_work_func(struct work_struct *work)
> +{
> + struct anx78xx *anx78xx = co

[PATCH] Staging: rtl8712: ieee80211.h: Coding style warnings fix for block comments

2015-09-22 Thread Punit Vara
This patch is to the ieee80211.h that fixes up following
warnings reported by checkpatch.pl :

-Block comments use * on subsequent lines
-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/ieee80211.h | 59 +
 1 file changed, 33 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.h 
b/drivers/staging/rtl8712/ieee80211.h
index 6e813a9..bc1040d 100644
--- a/drivers/staging/rtl8712/ieee80211.h
+++ b/drivers/staging/rtl8712/ieee80211.h
@@ -119,13 +119,15 @@ struct ieee_param {
 };
 
 #define IEEE80211_DATA_LEN 2304
-/* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
-   6.2.1.1.2.
-
-   The figure in section 7.1.2 suggests a body size of up to 2312
-   bytes is allowed, which is a bit confusing, I suspect this
-   represents the 2304 bytes of real data, plus a possible 8 bytes of
-   WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro) */
+/*
+ * Maximum size for the MA-UNITDATA primitive, 802.11 standard section
+ * 6.2.1.1.2.
+ *
+ * The figure in section 7.1.2 suggests a body size of up to 2312
+ * bytes is allowed, which is a bit confusing, I suspect this
+ * represents the 2304 bytes of real data, plus a possible 8 bytes of
+ * WEP IV and ICV. (this interpretation suggested by Ramiro Barreiro)
+ */
 
 #define IEEE80211_HLEN 30
 #define IEEE80211_FRAME_LEN(IEEE80211_DATA_LEN + IEEE80211_HLEN)
@@ -403,9 +405,11 @@ struct ieee80211_snap_hdr {
 
 
 
-/* NOTE: This data is for statistical purposes; not all hardware provides this
+/*
+ * NOTE: This data is for statistical purposes; not all hardware provides this
  *   information for frames received.  Not setting these will not cause
- *   any adverse affects. */
+ *   any adverse affects.
+ */
 struct ieee80211_rx_stats {
s8 rssi;
u8 signal;
@@ -417,10 +421,12 @@ struct ieee80211_rx_stats {
u16 len;
 };
 
-/* IEEE 802.11 requires that STA supports concurrent reception of at least
+/*
+ * IEEE 802.11 requires that STA supports concurrent reception of at least
  * three fragmented frames. This define can be increased to support more
  * concurrent frames, but it should be noted that each entry can consume about
- * 2 kB of RAM and increasing cache size will slow down frame reassembly. */
+ * 2 kB of RAM and increasing cache size will slow down frame reassembly.
+ */
 #define IEEE80211_FRAG_CACHE_LEN 4
 
 struct ieee80211_frag_entry {
@@ -510,19 +516,18 @@ struct ieee80211_security {
 } __packed;
 
 /*
-
- 802.11 data frame from AP
-
-  ,---.
-Bytes |  2   |  2   |6|6|6|  2   | 0..2312 |   4  |
-  |--|--|-|-|-|--|-|--|
-Desc. | ctrl | dura |  DA/RA  |   TA|SA   | Sequ |  frame  |  fcs |
-  |  | tion | (BSSID) | | | ence |  data   |  |
-  `---'
-
-Total: 28-2340 bytes
-
-*/
+ *
+ *   802.11 data frame from AP
+ *
+ * 
,---.
+ *   Bytes |  2   |  2   |6|6|6|  2   | 0..2312 |   4  
|
+ * 
|--|--|-|-|-|--|-|--|
+ *   Desc. | ctrl | dura |  DA/RA  |   TA|SA   | Sequ |  frame  |  fcs 
|
+ * |  | tion | (BSSID) | | | ence |  data   |  
|
+ * 
`---'
+ *
+ *   Total: 28-2340 bytes
+ */
 
 struct ieee80211_header_data {
u16 frame_ctl;
@@ -625,10 +630,12 @@ struct ieee80211_txb {
 /* SWEEP TABLE ENTRIES NUMBER*/
 #define MAX_SWEEP_TAB_ENTRIES42
 #define MAX_SWEEP_TAB_ENTRIES_PER_PACKET  7
-/* MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
+/*
+ * MAX_RATES_LENGTH needs to be 12.  The spec says 8, and many APs
  * only use 8, and then use extended rates for the remaining supported
  * rates.  Other APs, however, stick all of their supported rates on the
- * main rates information element... */
+ * main rates information element...
+ */
 #define MAX_RATES_LENGTH  ((u8)12)
 #define MAX_RATES_EX_LENGTH   ((u8)16)
 #define MAX_NETWORK_COUNT  128
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: ieee80211.c Coding style warnings fix for block comment

2015-09-22 Thread Punit Vara
This patch is to the ieee80211.c that fixes up following
warnings reported by checkpatch.pl :
-Block comments use * on subsequent lines
-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/ieee80211.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8712/ieee80211.c 
b/drivers/staging/rtl8712/ieee80211.c
index c5527c1..6b25938 100644
--- a/drivers/staging/rtl8712/ieee80211.c
+++ b/drivers/staging/rtl8712/ieee80211.c
@@ -107,9 +107,10 @@ u8 *r8712_set_ie(u8 *pbuf, sint index, uint len, u8 
*source, uint *frlen)
return pbuf + len + 2;
 }
 
-/*
-index: the information element id index, limit is the limit for search
--*/
+/* 
+ * index: the information element id index, limit is the limit for search
+ * 
+ */
 u8 *r8712_get_ie(u8 *pbuf, sint index, sint *len, sint limit)
 {
sint tmp, i;
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: Coding style warnings fix for block comment

2015-09-22 Thread Punit Vara
This patch is to the drv_types.h that fixes up following warnings
reported by checkpatch.pl :

-Block comments use  a trailing */ on a separate line
-Block comments use * on subsequent lines

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/drv_types.h | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8712/drv_types.h 
b/drivers/staging/rtl8712/drv_types.h
index e62543d..3d64fee 100644
--- a/drivers/staging/rtl8712/drv_types.h
+++ b/drivers/staging/rtl8712/drv_types.h
@@ -23,11 +23,12 @@
  * Larry Finger 
  *
  
**/
-/*-
-
-   For type defines and data structure defines
-
*/
+/* -
+ *
+ * For type defines and data structure defines
+ *
+ * -
+ */
 #ifndef __DRV_TYPES_H__
 #define __DRV_TYPES_H__
 
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8712: Coding style warnings fix for block comments

2015-09-22 Thread Punit Vara
This patch is to the hal_init.c that fixes up following warning
reported by checkpatch.pl :

-Block comments use * subsequent lines
-Block comments use a trailing */ on a separate line

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/hal_init.c | 24 
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8712/hal_init.c 
b/drivers/staging/rtl8712/hal_init.c
index 0a1c631..87e7ab3 100644
--- a/drivers/staging/rtl8712/hal_init.c
+++ b/drivers/staging/rtl8712/hal_init.c
@@ -296,8 +296,10 @@ static u8 rtl8712_dl_fw(struct _adapter *padapter)
goto exit_fail;
 
tmp8 = r8712_read8(padapter, 0x1025000A);
-   if (tmp8 & BIT(4)) /* When boot from EEPROM,
-   & FW need more time to read EEPROM */
+   if (tmp8 & BIT(4)) /*
+   * When boot from EEPROM,
+   * & FW need more time to read EEPROM
+   */
i = 60;
else/* boot from EFUSE */
i = 30;
@@ -330,8 +332,10 @@ uint rtl8712_hal_init(struct _adapter *padapter)
netdev_info(padapter->pnetdev, "1 RCR=0x%x\n",
r8712_read32(padapter, RCR));
val32 = r8712_read32(padapter, RCR);
-   r8712_write32(padapter, RCR, (val32 | BIT(26))); /* Enable RX TCP
-   Checksum offload */
+   r8712_write32(padapter, RCR, (val32 | BIT(26))); /*
+ * Enable RX TCP
+ * Checksum offload
+ */
netdev_info(padapter->pnetdev, "2 RCR=0x%x\n",
r8712_read32(padapter, RCR));
val32 = r8712_read32(padapter, RCR);
@@ -344,8 +348,10 @@ uint rtl8712_hal_init(struct _adapter *padapter)
   BIT(0)); /* page = 128bytes */
r8712_write8(padapter, 0x102500BD, r8712_read8(padapter, 0x102500BD) |
   BIT(7)); /* enable usb rx aggregation */
-   r8712_write8(padapter, 0x102500D9, 1); /* TH=1 => means that invalidate
-   *  usb rx aggregation */
+   r8712_write8(padapter, 0x102500D9, 1); /*
+   * TH=1 => means that invalidate
+   * usb rx aggregation
+   */
r8712_write8(padapter, 0x1025FE5B, 0x04); /* 1.7ms/4 */
/* Fix the RX FIFO issue(USB error) */
r8712_write8(padapter, 0x1025fe5C, r8712_read8(padapter, 0x1025fe5C)
@@ -365,8 +371,10 @@ uint rtl8712_hal_deinit(struct _adapter *padapter)
r8712_write8(padapter, SYS_CLKR+1, 0x38); /* Switch Control Path */
r8712_write8(padapter, SYS_FUNC_EN+1, 0x70);
r8712_write8(padapter, PMC_FSM, 0x06);  /* Enable Loader Data Keep */
-   r8712_write8(padapter, SYS_ISO_CTRL, 0xF9); /* Isolation signals from
-* CORE, PLL */
+   r8712_write8(padapter, SYS_ISO_CTRL, 0xF9); /*
+* Isolation signals from
+* CORE, PLL
+*/
r8712_write8(padapter, SYS_ISO_CTRL+1, 0xe8); /* Enable EFUSE 1.2V */
r8712_write8(padapter, AFE_PLL_CTRL, 0x00); /* Disable AFE PLL. */
r8712_write8(padapter, LDOA15_CTRL, 0x54);  /* Disable A15V */
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/6] Staging: rtl8712: Coding style warnings fix for block comment

2015-09-22 Thread Punit Vara
This patch is to the drv_types.h that fixes up following warnings
reported by checkpatch.pl :

-Block comments use  a trailing */ on a separate line
-Block comments use * on subsequent lines

Signed-off-by: Punit Vara 
---
 drivers/staging/rtl8712/drv_types.h | 11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8712/drv_types.h 
b/drivers/staging/rtl8712/drv_types.h
index e62543d..3d64fee 100644
--- a/drivers/staging/rtl8712/drv_types.h
+++ b/drivers/staging/rtl8712/drv_types.h
@@ -23,11 +23,12 @@
  * Larry Finger 
  *
  
**/
-/*-
-
-   For type defines and data structure defines
-
*/
+/* -
+ *
+ * For type defines and data structure defines
+ *
+ * -
+ */
 #ifndef __DRV_TYPES_H__
 #define __DRV_TYPES_H__
 
-- 
2.5.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: dgap: remove unused variable

2015-09-22 Thread Dan Carpenter
On Thu, Sep 10, 2015 at 05:24:59PM +0530, Sudip Mukherjee wrote:
> Removed them but kept one call to ioread8() as it might affect the
> hardware.

Just leave the extra variable until someone has the hardware and can
verify the right fix.  Static checker warnings are good, don't silence
them just to silence them.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] MAINTAINERS: Remove myself as nvec co-maintainer

2015-09-22 Thread Julian Andres Klode
On Sun, Sep 13, 2015 at 05:23:27PM +0200, Julian Andres Klode wrote:
> My device broke a long time ago, so I do not have any
> chance of testing things or any reason to continue
> maintaining it.
> 
> Signed-off-by: Julian Andres Klode 
> Cc: Marc Dietrich 
> ---
>  MAINTAINERS | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index b60e2b2..1b2bbc3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9720,7 +9720,6 @@ S:  Maintained
>  F:   drivers/staging/lustre
>  
>  STAGING - NVIDIA COMPLIANT EMBEDDED CONTROLLER INTERFACE (nvec)
> -M:   Julian Andres Klode 
>  M:   Marc Dietrich 
>  L:   ac...@lists.launchpad.net (moderated for non-subscribers)
>  L:   linux-te...@vger.kernel.org
> -- 
> 2.5.1

Friendly ping. I'm not sure who should take this patch,
maybe Greg?

-- 
Julian Andres Klode  - Debian Developer, Ubuntu Member

See http://wiki.debian.org/JulianAndresKlode and http://jak-linux.org/.

Be friendly, do not top-post, and follow RFC 1855 "Netiquette".
- If you don't I might ignore you.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 0/2] staging: comedi: comedi_buf.c: Documentation changes

2015-09-22 Thread Hartley Sweeten
On Tuesday, September 22, 2015 10:03 AM, Ian Abbott wrote:
> 1) staging: comedi: comedi_buf.c: tweak existing kernel-doc
> 2) staging: comedi: comedi_buf.c: document remaining exported functions
>
>  drivers/staging/comedi/comedi_buf.c | 106 
> ++--
>  1 file changed, 88 insertions(+), 18 deletions(-)

Thanks,

Reviewed-by: H Hartley Sweeten 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH 00/11] staging: comedi: comedidev.h: Documentation changes

2015-09-22 Thread Hartley Sweeten
On Monday, September 21, 2015 10:53 AM, Ian Abbott wrote:
> This series fixes an incorrectly formatted block comment, adds more
> kernel-doc documenation and tweaks the existing documentation for
> consistency and to document return values of inline functions.
>
> 01) staging: comedi: comedidev.h: reformat copyright comment
> 02) staging: comedi: comedidev.h: use enum for COMEDI_CB_... constants
> 03) staging: comedi: comedidev.h: tweak kernel-doc for struct
> comedi_async
> 04) staging: comedi: comedidev.h: document struct comedi_driver
> 05) staging: comedi: comedidev.h: document struct comedi_device
> 06) staging: comedi: comedidev.h: document struct comedi_subdevice
> 07) staging: comedi: comedidev.h: document struct comedi_buf_map
> 08) staging: comedi: comedidev.h: document struct comedi_lrange
> 09) staging: comedi: comedidev.h: tweak struct comedi_async
> documentation
> 10) staging: comedi: comedidev.h: tweak docs for inline functions
> 11) staging: comedi: comedidev.h: document remaining inline functions
>
>  drivers/staging/comedi/comedidev.h | 617 
> +++--
>  1 file changed, 516 insertions(+), 101 deletions(-)

Thanks,

Reviewed-by: H Hartley Sweeten 

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] staging: comedi: comedi_buf.c: document remaining exported functions

2015-09-22 Thread Ian Abbott
Add kernel-doc headers to the remaining functions marked for export.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_buf.c | 69 ++---
 1 file changed, 65 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/comedi_buf.c 
b/drivers/staging/comedi/comedi_buf.c
index 63553d9..d45a4b6 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -253,7 +253,17 @@ static unsigned int comedi_buf_write_n_available(struct 
comedi_subdevice *s)
return free_end - async->buf_write_alloc_count;
 }
 
-/* allocates chunk for the writer from free buffer space */
+/**
+ * comedi_buf_write_alloc() - Reserve buffer space for writing
+ * @s: COMEDI subdevice.
+ * @nbytes: Maximum space to reserve in bytes.
+ *
+ * Reserve up to @nbytes bytes of space to be written in the COMEDI acquisition
+ * data buffer associated with the subdevice.  The amount reserved is limited
+ * by the space available.
+ *
+ * Return: The amount of space reserved in bytes.
+ */
 unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s,
unsigned int nbytes)
 {
@@ -329,7 +339,21 @@ unsigned int comedi_buf_write_n_allocated(struct 
comedi_subdevice *s)
return async->buf_write_alloc_count - async->buf_write_count;
 }
 
-/* transfers a chunk from writer to filled buffer space */
+/**
+ * comedi_buf_write_free() - Free buffer space after it is written
+ * @s: COMEDI subdevice.
+ * @nbytes: Maximum space to free in bytes.
+ *
+ * Free up to @nbytes bytes of space previously reserved for writing in the
+ * COMEDI acquisition data buffer associated with the subdevice.  The amount of
+ * space freed is limited to the amount that was reserved.  The freed space is
+ * assumed to have been filled with sample data by the writer.
+ *
+ * If the samples in the freed space need to be "munged", do so here.  The
+ * freed space becomes available for allocation by the reader.
+ *
+ * Return: The amount of space freed in bytes.
+ */
 unsigned int comedi_buf_write_free(struct comedi_subdevice *s,
   unsigned int nbytes)
 {
@@ -349,6 +373,17 @@ unsigned int comedi_buf_write_free(struct comedi_subdevice 
*s,
 }
 EXPORT_SYMBOL_GPL(comedi_buf_write_free);
 
+/**
+ * comedi_buf_read_n_available() - Determine amount of readable buffer space
+ * @s: COMEDI subdevice.
+ *
+ * Determine the amount of readable buffer space in the COMEDI acquisition data
+ * buffer associated with the subdevice.  The readable buffer space is that
+ * which has been freed by the writer and "munged" to the sample data format
+ * expected by COMEDI if necessary.
+ *
+ * Return: The amount of readable buffer space.
+ */
 unsigned int comedi_buf_read_n_available(struct comedi_subdevice *s)
 {
struct comedi_async *async = s->async;
@@ -369,7 +404,21 @@ unsigned int comedi_buf_read_n_available(struct 
comedi_subdevice *s)
 }
 EXPORT_SYMBOL_GPL(comedi_buf_read_n_available);
 
-/* allocates a chunk for the reader from filled (and munged) buffer space */
+/**
+ * comedi_buf_read_alloc() - Reserve buffer space for reading
+ * @s: COMEDI subdevice.
+ * @nbytes: Maximum space to reserve in bytes.
+ *
+ * Reserve up to @nbytes bytes of previously written and "munged" buffer space
+ * for reading in the COMEDI acquisition data buffer associated with the
+ * subdevice.  The amount reserved is limited to the space available.  The
+ * reader can read from the reserved space and then free it.  A reader is also
+ * allowed to read from the space before reserving it as long as it determines
+ * the amount of readable data available, but the space needs to be marked as
+ * reserved before it can be freed.
+ *
+ * Return: The amount of space reserved in bytes.
+ */
 unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s,
   unsigned int nbytes)
 {
@@ -397,7 +446,19 @@ static unsigned int comedi_buf_read_n_allocated(struct 
comedi_async *async)
return async->buf_read_alloc_count - async->buf_read_count;
 }
 
-/* transfers control of a chunk from reader to free buffer space */
+/**
+ * comedi_buf_read_free() - Free buffer space after it has been read
+ * @s: COMEDI subdevice.
+ * @nbytes: Maximum space to free in bytes.
+ *
+ * Free up to @nbytes bytes of buffer space previously reserved for reading in
+ * the COMEDI acquisition data buffer associated with the subdevice.  The
+ * amount of space freed is limited to the amount that was reserved.
+ *
+ * The freed space becomes available for allocation by the writer.
+ *
+ * Return: The amount of space freed in bytes.
+ */
 unsigned int comedi_buf_read_free(struct comedi_subdevice *s,
  unsigned int nbytes)
 {
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/2] staging: comedi: comedi_buf.c: Documentation changes

2015-09-22 Thread Ian Abbott
1) staging: comedi: comedi_buf.c: tweak existing kernel-doc
2) staging: comedi: comedi_buf.c: document remaining exported functions

 drivers/staging/comedi/comedi_buf.c | 106 ++--
 1 file changed, 88 insertions(+), 18 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/2] staging: comedi: comedi_buf.c: tweak existing kernel-doc

2015-09-22 Thread Ian Abbott
Expand the kernel-doc descriptions of those exported functions that
already have kernel-doc comments.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/comedi_buf.c | 37 +++--
 1 file changed, 23 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/comedi/comedi_buf.c 
b/drivers/staging/comedi/comedi_buf.c
index 19e7b22..63553d9 100644
--- a/drivers/staging/comedi/comedi_buf.c
+++ b/drivers/staging/comedi/comedi_buf.c
@@ -469,15 +469,21 @@ static void comedi_buf_memcpy_from(struct 
comedi_subdevice *s,
 }
 
 /**
- * comedi_buf_write_samples - write sample data to comedi buffer
- * @s: comedi_subdevice struct
- * @data: samples
- * @nsamples: number of samples
+ * comedi_buf_write_samples() - Write sample data to COMEDI buffer
+ * @s: COMEDI subdevice.
+ * @data: Pointer to source samples.
+ * @nsamples: Number of samples to write.
  *
- * Writes nsamples to the comedi buffer associated with the subdevice, marks
- * it as written and updates the acquisition scan progress.
+ * Write up to @nsamples samples to the COMEDI acquisition data buffer
+ * associated with the subdevice, mark it as written and update the
+ * acquisition scan progress.  If there is not enough room for the specified
+ * number of samples, the number of samples written is limited to the number
+ * that will fit and the %COMEDI_CB_OVERFLOW event flag is set to cause the
+ * acquisition to terminate with an overrun error.  Set the %COMEDI_CB_BLOCK
+ * event flag if any samples are written to cause waiting tasks to be woken
+ * when the event flags are processed.
  *
- * Returns the amount of data written in bytes.
+ * Return: The amount of data written in bytes.
  */
 unsigned int comedi_buf_write_samples(struct comedi_subdevice *s,
  const void *data, unsigned int nsamples)
@@ -513,15 +519,18 @@ unsigned int comedi_buf_write_samples(struct 
comedi_subdevice *s,
 EXPORT_SYMBOL_GPL(comedi_buf_write_samples);
 
 /**
- * comedi_buf_read_samples - read sample data from comedi buffer
- * @s: comedi_subdevice struct
- * @data: destination
- * @nsamples: maximum number of samples to read
+ * comedi_buf_read_samples() - Read sample data from COMEDI buffer
+ * @s: COMEDI subdevice.
+ * @data: Pointer to destination.
+ * @nsamples: Maximum number of samples to read.
  *
- * Reads up to nsamples from the comedi buffer associated with the subdevice,
- * marks it as read and updates the acquisition scan progress.
+ * Read up to @nsamples samples from the COMEDI acquisition data buffer
+ * associated with the subdevice, mark it as read and update the acquisition
+ * scan progress.  Limit the number of samples read to the number available.
+ * Set the %COMEDI_CB_BLOCK event flag if any samples are read to cause waiting
+ * tasks to be woken when the event flags are processed.
  *
- * Returns the amount of data read in bytes.
+ * Return: The amount of data read in bytes.
  */
 unsigned int comedi_buf_read_samples(struct comedi_subdevice *s,
 void *data, unsigned int nsamples)
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] storvsc: get rid of homegrown copy_{to,from}_bounce_buffer()

2015-09-22 Thread Vitaly Kuznetsov
Storvsc driver needs to ensure there are no 'holes' in the presented
sg list (all segments in the middle of the list need to be of PAGE_SIZE).
When a hole is detected storvsc driver creates a 'bounce sgl' without
holes and copies data over with its own copy_{to,from}_bounce_buffer()
functions. Scsi layer already has scsi_sg_copy_{to,from}_buffer()
functions to linearize a list, the only difference is that already
existent functions create a flat buffer instead of a new list but we can
cope.

Reported-by: Radim Krčmář 
Signed-off-by: Vitaly Kuznetsov 
---
 drivers/scsi/storvsc_drv.c | 281 ++---
 1 file changed, 36 insertions(+), 245 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 40c43ae..31e8c67 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -393,8 +393,8 @@ static void storvsc_on_channel_callback(void *context);
 struct storvsc_cmd_request {
struct scsi_cmnd *cmd;
 
-   unsigned int bounce_sgl_count;
-   struct scatterlist *bounce_sgl;
+   unsigned int bounce_len;
+   void *bounce_buf;
 
struct hv_device *device;
 
@@ -586,21 +586,6 @@ get_in_err:
 
 }
 
-static void destroy_bounce_buffer(struct scatterlist *sgl,
- unsigned int sg_count)
-{
-   int i;
-   struct page *page_buf;
-
-   for (i = 0; i < sg_count; i++) {
-   page_buf = sg_page((&sgl[i]));
-   if (page_buf != NULL)
-   __free_page(page_buf);
-   }
-
-   kfree(sgl);
-}
-
 static int do_bounce_buffer(struct scatterlist *sgl, unsigned int sg_count)
 {
int i;
@@ -628,199 +613,6 @@ static int do_bounce_buffer(struct scatterlist *sgl, 
unsigned int sg_count)
return -1;
 }
 
-static struct scatterlist *create_bounce_buffer(struct scatterlist *sgl,
-   unsigned int sg_count,
-   unsigned int len,
-   int write)
-{
-   int i;
-   int num_pages;
-   struct scatterlist *bounce_sgl;
-   struct page *page_buf;
-   unsigned int buf_len = ((write == WRITE_TYPE) ? 0 : PAGE_SIZE);
-
-   num_pages = ALIGN(len, PAGE_SIZE) >> PAGE_SHIFT;
-
-   bounce_sgl = kcalloc(num_pages, sizeof(struct scatterlist), GFP_ATOMIC);
-   if (!bounce_sgl)
-   return NULL;
-
-   sg_init_table(bounce_sgl, num_pages);
-   for (i = 0; i < num_pages; i++) {
-   page_buf = alloc_page(GFP_ATOMIC);
-   if (!page_buf)
-   goto cleanup;
-   sg_set_page(&bounce_sgl[i], page_buf, buf_len, 0);
-   }
-
-   return bounce_sgl;
-
-cleanup:
-   destroy_bounce_buffer(bounce_sgl, num_pages);
-   return NULL;
-}
-
-/* Assume the original sgl has enough room */
-static unsigned int copy_from_bounce_buffer(struct scatterlist *orig_sgl,
-   struct scatterlist *bounce_sgl,
-   unsigned int orig_sgl_count,
-   unsigned int bounce_sgl_count)
-{
-   int i;
-   int j = 0;
-   unsigned long src, dest;
-   unsigned int srclen, destlen, copylen;
-   unsigned int total_copied = 0;
-   unsigned long bounce_addr = 0;
-   unsigned long dest_addr = 0;
-   unsigned long flags;
-   struct scatterlist *cur_dest_sgl;
-   struct scatterlist *cur_src_sgl;
-
-   local_irq_save(flags);
-   cur_dest_sgl = orig_sgl;
-   cur_src_sgl = bounce_sgl;
-   for (i = 0; i < orig_sgl_count; i++) {
-   dest_addr = (unsigned long)
-   kmap_atomic(sg_page(cur_dest_sgl)) +
-   cur_dest_sgl->offset;
-   dest = dest_addr;
-   destlen = cur_dest_sgl->length;
-
-   if (bounce_addr == 0)
-   bounce_addr = (unsigned long)kmap_atomic(
-   sg_page(cur_src_sgl));
-
-   while (destlen) {
-   src = bounce_addr + cur_src_sgl->offset;
-   srclen = cur_src_sgl->length - cur_src_sgl->offset;
-
-   copylen = min(srclen, destlen);
-   memcpy((void *)dest, (void *)src, copylen);
-
-   total_copied += copylen;
-   cur_src_sgl->offset += copylen;
-   destlen -= copylen;
-   dest += copylen;
-
-   if (cur_src_sgl->offset == cur_src_sgl->length) {
-   /* full */
-   kunmap_atomic((void *)bounce_addr);
-   j++;
-
-   /*
-* It is possible that the number of elements
- 

[PATCH v11 2/4] fpga manager: add sysfs interface document

2015-09-22 Thread atull
From: Alan Tull 

Add documentation under drivers/staging for new fpga manager's
sysfs interface.

Signed-off-by: Alan Tull 
---
v5  : (actually second version, but keeping version numbers
  aligned with rest of patch series)
  Move document to drivers/staging/fpga/Documentation/ABI

v6  : No change in this patch for v6 of the patch set
v7  : No change in this patch for v7 of the patch set
v8  : No change in this patch for v8 of the patch set

v9  : Remove 'firmware' and 'reset' files
  Update state strings

v10 : Clarifications about state attribute
  Move to Documentation/ABI/testing/

v11 : No change in this patch for v11 of the patch set
---
 Documentation/ABI/testing/sysfs-class-fpga-manager |   37 
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-fpga-manager

diff --git a/Documentation/ABI/testing/sysfs-class-fpga-manager 
b/Documentation/ABI/testing/sysfs-class-fpga-manager
new file mode 100644
index 000..23056c5
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-class-fpga-manager
@@ -0,0 +1,37 @@
+What:  /sys/class/fpga_manager//name
+Date:  August 2015
+KernelVersion: 4.3
+Contact:   Alan Tull 
+Description:   Name of low level fpga manager driver.
+
+What:  /sys/class/fpga_manager//state
+Date:  August 2015
+KernelVersion: 4.3
+Contact:   Alan Tull 
+Description:   Read fpga manager state as a string.
+   The intent is to provide enough detail that if something goes
+   wrong during FPGA programming (something that the driver can't
+   fix) then userspace can know, i.e. if the firmware request
+   fails, that could be due to not being able to find the firmware
+   file.
+
+   This is a superset of FPGA states and fpga manager driver
+   states.  The fpga manager driver is walking through these steps
+   to get the FPGA into a known operating state.  It's a sequence,
+   though some steps may get skipped.  Valid FPGA states will vary
+   by manufacturer; this is a superset.
+
+   * unknown   = can't determine state
+   * power off = FPGA power is off
+   * power up  = FPGA reports power is up
+   * reset = FPGA held in reset state
+   * firmware request  = firmware class request in progress
+   * firmware request error = firmware request failed
+   * write init= preparing FPGA for programming
+   * write init error  = Error while preparing FPGA for
+ programming
+   * write = FPGA ready to receive image data
+   * write error   = Error while programming
+   * write complete= Doing post programming steps
+   * write complete error  = Error while doing post programming
+   * operating = FPGA is programmed and operating
-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v11 4/4] fpga manager: add driver for socfpga fpga manager

2015-09-22 Thread atull
From: Alan Tull 

Add driver to fpga manager framework to allow configuration
of FPGA in Altera SoCFPGA parts.

Signed-off-by: Alan Tull 
Acked-by: Michal Simek 
Acked-by: Moritz Fischer 
---
v2: fpga_manager struct now contains struct device
fpga_manager_register parameters now take device

v3: skip a version to align versions

v4: move to drivers/staging

v5: fix array_size.cocci warnings
fix platform_no_drv_owner.cocci warnings
Remove .owner = THIS_MODULE
include asm/irq.h
clean up list of includes
use altera_fpga_reset for ops
use enum fpga_mgr_states or u32 as needed
use devm_request_irq
check irq <= 0 instead of == NO_IRQ
Use ARRAY_SIZE
rename altera -> socfpga
static const socfpga_fpga_ops
header moved to linux/fpga/ folder
remove ifdef'ed code
use platform_get_resource and platform_get_irq
move .probe and .remove lines adjacent
use module_platform_driver
use __maybe_unused
only need to 'if (IS_ENABLED(CONFIG_REGULATOR))' in one fn
fix "unsigned 'mode' is never < 0"

v6: return error for (unused) default of case statement

v7: PTR_ERR should access the value just tested by IS_ERR

v8: change compatible string to be more chip specific

v9: update copyright year
remove suspend/resume support and regulators
use updated fn names for register/unregister
use updated params for write_init
check for partial reconfiguration request

v10: make tristate in Kconfig
 clean up include
 add flags param to write_complete()
 move do drivers/fpga

v11: No code change in this patch for v11 of the patch set
 Adding Moritz' ACK
---
 drivers/fpga/Kconfig   |   10 +
 drivers/fpga/Makefile  |1 +
 drivers/fpga/socfpga.c |  616 
 3 files changed, 627 insertions(+)
 create mode 100644 drivers/fpga/socfpga.c

diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
index f1f1f6d..dfc1f1e 100644
--- a/drivers/fpga/Kconfig
+++ b/drivers/fpga/Kconfig
@@ -11,4 +11,14 @@ config FPGA
  kernel.  The FPGA framework adds a FPGA manager class and FPGA
  manager drivers.
 
+if FPGA
+
+config FPGA_MGR_SOCFPGA
+   tristate "Altera SOCFPGA FPGA Manager"
+   depends on ARCH_SOCFPGA
+   help
+ FPGA manager driver support for Altera SOCFPGA.
+
+endif # FPGA
+
 endmenu
diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
index 3313c52..ba6c5c5 100644
--- a/drivers/fpga/Makefile
+++ b/drivers/fpga/Makefile
@@ -6,3 +6,4 @@
 obj-$(CONFIG_FPGA) += fpga-mgr.o
 
 # FPGA Manager Drivers
+obj-$(CONFIG_FPGA_MGR_SOCFPGA) += socfpga.o
diff --git a/drivers/fpga/socfpga.c b/drivers/fpga/socfpga.c
new file mode 100644
index 000..706b80d
--- /dev/null
+++ b/drivers/fpga/socfpga.c
@@ -0,0 +1,616 @@
+/*
+ * FPGA Manager Driver for Altera SOCFPGA
+ *
+ *  Copyright (C) 2013-2015 Altera Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see .
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* Register offsets */
+#define SOCFPGA_FPGMGR_STAT_OFST   0x0
+#define SOCFPGA_FPGMGR_CTL_OFST0x4
+#define SOCFPGA_FPGMGR_DCLKCNT_OFST0x8
+#define SOCFPGA_FPGMGR_DCLKSTAT_OFST   0xc
+#define SOCFPGA_FPGMGR_GPIO_INTEN_OFST 0x830
+#define SOCFPGA_FPGMGR_GPIO_INTMSK_OFST0x834
+#define SOCFPGA_FPGMGR_GPIO_INTTYPE_LEVEL_OFST 0x838
+#define SOCFPGA_FPGMGR_GPIO_INT_POL_OFST   0x83c
+#define SOCFPGA_FPGMGR_GPIO_INTSTAT_OFST   0x840
+#define SOCFPGA_FPGMGR_GPIO_RAW_INTSTAT_OFST   0x844
+#define SOCFPGA_FPGMGR_GPIO_PORTA_EOI_OFST 0x84c
+#define SOCFPGA_FPGMGR_GPIO_EXT_PORTA_OFST 0x850
+
+/* Register bit defines */
+/* SOCFPGA_FPGMGR_STAT register mode field values */
+#define SOCFPGA_FPGMGR_STAT_POWER_UP   0x0 /*ramping*/
+#define SOCFPGA_FPGMGR_STAT_RESET  0x1
+#define SOCFPGA_FPGMGR_STAT_CFG0x2
+#define SOCFPGA_FPGMGR_STAT_INIT   0x3
+#define SOCFPGA_FPGMGR_STAT_USER_MODE  0x4
+#define SOCFPGA_FPGMGR_STAT_UNKNOWN 

[PATCH v11 1/4] usage documentation for FPGA manager core

2015-09-22 Thread atull
From: Alan Tull 

Add a document on the new FPGA manager core.

Signed-off-by: Alan Tull 
---
v9:  initial version where this patch was added

v10: requested cleanups to formatting and otherwise
 s/fpga/FPGA/g
 rewrite implementation section to not reference socfpga.c by name
 other rewrites
 Moved to Documentation/fpga/

v11: s/with image/with an image/
 s/on the path/in the path/
---
 Documentation/fpga/fpga-mgr.txt |  171 +++
 1 file changed, 171 insertions(+)
 create mode 100644 Documentation/fpga/fpga-mgr.txt

diff --git a/Documentation/fpga/fpga-mgr.txt b/Documentation/fpga/fpga-mgr.txt
new file mode 100644
index 000..ce3e84f
--- /dev/null
+++ b/Documentation/fpga/fpga-mgr.txt
@@ -0,0 +1,171 @@
+FPGA Manager Core
+
+Alan Tull 2015
+
+Overview
+
+
+The FPGA manager core exports a set of functions for programming an FPGA with
+an image.  The API is manufacturer agnostic.  All manufacturer specifics are
+hidden away in a low level driver which registers a set of ops with the core.
+The FPGA image data itself is very manufacturer specific, but for our purposes
+it's just binary data.  The FPGA manager core won't parse it.
+
+
+API Functions:
+==
+
+To program the FPGA from a file or from a buffer:
+-
+
+   int fpga_mgr_buf_load(struct fpga_manager *mgr, u32 flags,
+ const char *buf, size_t count);
+
+Load the FPGA from an image which exists as a buffer in memory.
+
+   int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
+  const char *image_name);
+
+Load the FPGA from an image which exists as a file.  The image file must be on
+the firmware search path (see the firmware class documentation).
+
+For both these functions, flags == 0 for normal full reconfiguration or
+FPGA_MGR_PARTIAL_RECONFIG for partial reconfiguration.  If successful, the FPGA
+ends up in operating mode.  Return 0 on success or a negative error code.
+
+
+To get/put a reference to a FPGA manager:
+-
+
+   struct fpga_manager *of_fpga_mgr_get(struct device_node *node);
+
+   void fpga_mgr_put(struct fpga_manager *mgr);
+
+Given a DT node, get an exclusive reference to a FPGA manager or release
+the reference.
+
+
+To register or unregister the low level FPGA-specific driver:
+-
+
+   int fpga_mgr_register(struct device *dev, const char *name,
+ const struct fpga_manager_ops *mops,
+ void *priv);
+
+   void fpga_mgr_unregister(struct device *dev);
+
+Use of these two functions is described below in "How To Support a new FPGA
+device."
+
+
+How to write an image buffer to a supported FPGA
+
+/* Include to get the API */
+#include 
+
+/* device node that specifies the FPGA manager to use */
+struct device_node *mgr_node = ...
+
+/* FPGA image is in this buffer.  count is size of the buffer. */
+char *buf = ...
+int count = ...
+
+/* flags indicates whether to do full or partial reconfiguration */
+int flags = 0;
+
+int ret;
+
+/* Get exclusive control of FPGA manager */
+struct fpga_manager *mgr = of_fpga_mgr_get(mgr_node);
+
+/* Load the buffer to the FPGA */
+ret = fpga_mgr_buf_load(mgr, flags, buf, count);
+
+/* Release the FPGA manager */
+fpga_mgr_put(mgr);
+
+
+How to write an image file to a supported FPGA
+==
+/* Include to get the API */
+#include 
+
+/* device node that specifies the FPGA manager to use */
+struct device_node *mgr_node = ...
+
+/* FPGA image is in this file which is in the firmware search path */
+const char *path = "fpga-image-9.rbf"
+
+/* flags indicates whether to do full or partial reconfiguration */
+int flags = 0;
+
+int ret;
+
+/* Get exclusive control of FPGA manager */
+struct fpga_manager *mgr = of_fpga_mgr_get(mgr_node);
+
+/* Get the firmware image (path) and load it to the FPGA */
+ret = fpga_mgr_firmware_load(mgr, flags, path);
+
+/* Release the FPGA manager */
+fpga_mgr_put(mgr);
+
+
+How to support a new FPGA device
+
+To add another FPGA manager, write a driver that implements a set of ops.  The
+probe function calls fpga_mgr_register(), such as:
+
+static const struct fpga_manager_ops socfpga_fpga_ops = {
+   .write_init = socfpga_fpga_ops_configure_init,
+   .write = socfpga_fpga_ops_configure_write,
+   .write_complete = socfpga_fpga_ops_configure_complete,
+   .state = socfpga_fpga_ops_state,
+};
+
+static int socfpga_fpga_probe(struct platform_device *pdev)
+{
+   struct device *dev = &pdev->dev;
+   struct socfpga_fpga_priv *priv;
+   int ret;
+
+   priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+   if (!priv)
+   return -ENOMEM;
+
+   /* 

[PATCH v11 0/4] FPGA Manager Framework

2015-09-22 Thread atull
From: Alan Tull 

This patch set adds the FPGA manager core which exports API functions that
write an image to a FPGA

I'm holding off on the DT overlay support a little for now.

The core's API is minimal to start with: only 6 functions.  This gives a
manufacturer-agnostic interface for programming FPGA's such that higher
level interfaces (such as DT Overlays) can be shared.

Alan Tull (4):
  usage documentation for FPGA manager core
  fpga manager: add sysfs interface document
  add FPGA manager core
  fpga manager: add driver for socfpga fpga manager

 Documentation/ABI/testing/sysfs-class-fpga-manager |   37 ++
 Documentation/fpga/fpga-mgr.txt|  171 ++
 drivers/Kconfig|2 +
 drivers/Makefile   |1 +
 drivers/fpga/Kconfig   |   24 +
 drivers/fpga/Makefile  |9 +
 drivers/fpga/fpga-mgr.c|  382 
 drivers/fpga/socfpga.c |  616 
 include/linux/fpga/fpga-mgr.h  |  127 
 9 files changed, 1369 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-fpga-manager
 create mode 100644 Documentation/fpga/fpga-mgr.txt
 create mode 100644 drivers/fpga/Kconfig
 create mode 100644 drivers/fpga/Makefile
 create mode 100644 drivers/fpga/fpga-mgr.c
 create mode 100644 drivers/fpga/socfpga.c
 create mode 100644 include/linux/fpga/fpga-mgr.h

-- 
1.7.9.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v11 3/4] add FPGA manager core

2015-09-22 Thread atull
From: Alan Tull 

API to support programming FPGA's.

The following functions are exported as GPL:
* fpga_mgr_buf_load
   Load fpga from image in buffer

* fpga_mgr_firmware_load
   Request firmware and load it to the FPGA.

* fpga_mgr_register
* fpga_mgr_unregister
   FPGA device drivers can be added by calling
   fpga_mgr_register() to register a set of
   fpga_manager_ops to do device specific stuff.

* of_fpga_mgr_get
* fpga_mgr_put
   Get/put a reference to a fpga manager.

The following sysfs files are created:
* /sys/class/fpga_manager//name
  Name of low level driver.

* /sys/class/fpga_manager//state
  State of fpga manager

Signed-off-by: Alan Tull 
Acked-by: Michal Simek 
---
v2: s/mangager/manager/
check for invalid request_nr
add fpga reset interface
rework the state code
remove FPGA_MGR_FAIL flag
add _ERR states to fpga manager states enum
low level state op now returns a state enum value
initialize framework state from driver state op
remove unused fpga read stuff
merge sysfs.c into fpga-mgr.c
move suspend/resume from bus.c to fpga-mgr.c

v3: Add struct device to fpga_manager (not as a pointer)
Add to_fpga_manager
Don't get irq in fpga-mgr.c (let low level driver do it)
remove from struct fpga_manager: nr, np, parent
get rid of fpga_mgr_get_new_minor()
simplify fpga_manager_register:
  reorder parameters
  use dev instead of pdev
get rid of code that used to make more sense when this
  was a char driver, don't alloc_chrdev_region
use a mutex instead of flags

v4: Move to drivers/staging

v5: Make some things be static
Kconfig: add 'if FPGA'
Makefile: s/fpga-mgr-core.o/fpga-mgr.o/
clean up includes
use enum fpga_mgr_states instead of int
static const char *state_str
use DEVICE_ATTR_RO/RW/WO and ATTRIBUTE_GROUPS
return -EINVAL instead of BUG_ON
move ida_simple_get after kzalloc
clean up fpga_mgr_remove
fpga-mgr.h: remove '#if IS_ENABLED(CONFIG_FPGA)'
add kernel-doc documentation
Move header to new include/linux/fpga folder
static const struct fpga_mgr_ops
dev_info msg simplified

v6: no statically allocated string for image_name
kernel doc fixes
changes regarding enabling SYSFS for fpga mgr
Makefile cleanup

v7: no change in this patch for v7 of the patchset

v8: no change in this patch for v8 of the patchset

v9: remove writable attributes 'firmware' and 'reset'
remove suspend/resume support for now
remove list of fpga managers; use class device iterators instead
simplify locking by giving out only one ref exclusively
add device tree support
add flags
par down API into fewer functions
update copyright year
rename some functions for clarity
clean up unnecessary #includes
add some error messages
write_init may need to look at buffer header, so add to params

v10: Make this a tristate in Kconfig
 pass flags parameter to write_complete
 use BIT(0) in macro
 move to drivers/fpga
 fpga_manager_get/put call module_try_get/module_put

v11: Set state to 'operating' after successfully programming the FPGA
---
 drivers/Kconfig   |2 +
 drivers/Makefile  |1 +
 drivers/fpga/Kconfig  |   14 ++
 drivers/fpga/Makefile |8 +
 drivers/fpga/fpga-mgr.c   |  382 +
 include/linux/fpga/fpga-mgr.h |  127 ++
 6 files changed, 534 insertions(+)
 create mode 100644 drivers/fpga/Kconfig
 create mode 100644 drivers/fpga/Makefile
 create mode 100644 drivers/fpga/fpga-mgr.c
 create mode 100644 include/linux/fpga/fpga-mgr.h

diff --git a/drivers/Kconfig b/drivers/Kconfig
index 6e973b8..2683346 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -184,4 +184,6 @@ source "drivers/android/Kconfig"
 
 source "drivers/nvdimm/Kconfig"
 
+source "drivers/fpga/Kconfig"
+
 endmenu
diff --git a/drivers/Makefile b/drivers/Makefile
index b64b49f..832a6e0 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -165,3 +165,4 @@ obj-$(CONFIG_RAS)   += ras/
 obj-$(CONFIG_THUNDERBOLT)  += thunderbolt/
 obj-$(CONFIG_CORESIGHT)+= hwtracing/coresight/
 obj-$(CONFIG_ANDROID)  += android/
+obj-$(CONFIG_FPGA) += fpga/
diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig
new file mode 100644
index 000..f1f1f6d
--- /dev/null
+++ b/drivers/fpga/Kconfig
@@ -0,0 +1,14 @@
+#
+# FPGA framework configuration
+#
+
+menu "FPGA Configuration Support"
+
+config FPGA
+   tristate "FPGA Configuration Framework"
+   help
+ Say Y here if you want support for configuring FPGAs from the
+ kernel.  The FPGA framework adds a FPGA manager class and FPGA
+ manager drivers.
+
+endmenu
diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile
new file mode 100644
index 000..3313c52
--- /dev/null
+++ b/drivers/fpga/Makefile
@@ -0,0 +1,8 @@
+#
+# Makefile for the fpga fra

[PATCH] staging: wicl1000: remove duplicated operand in OR operation

2015-09-22 Thread Javier Martinez Canillas
The IEEE80211_STYPE_PROBE_REQ flag appears twice in the expression
and coccicheck complains with:

wilc_wfi_cfgoperations.h:80:3-38: duplicated argument to & or |

Signed-off-by: Javier Martinez Canillas 

---

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 4d37c4e859e9..25490c2af1e9 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -80,7 +80,6 @@ static const struct ieee80211_txrx_stypes
BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
-   BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
BIT(IEEE80211_STYPE_DISASSOC >> 4) |
BIT(IEEE80211_STYPE_AUTH >> 4) |
BIT(IEEE80211_STYPE_DEAUTH >> 4)
-- 
2.4.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] staging: dgnc: take lock when storing value in dgnc_poll_tick

2015-09-22 Thread Greg KH
On Tue, Sep 22, 2015 at 11:48:05AM +0100, Salah Triki wrote:
> >On Wed, 2 Sep 2015 18:15:29 -0700, Greg KH wrote:
> >>On Tue, Aug 25, 2015 at 08:09:47PM +0100, Salah Triki wrote:
> >> poll_tick is declared global, so dgnc_driver_pollrate_store needs to
> >> take
> >> the lock dgnc_poll_lock before modifying this variable. dgnc_poll_lock
> >> the
> >> appropriate lock, since it is intended for poll scheduling and
> >> dgnc_poll_tick
> >> contains the poll rate. dgnc_poll_lock needs to be declared not static
> >> and
> >> extern in order to be visible for dgnc_driver_pollrate_store.
> >
> >So you only lock it if you change the value?  That's not the way to do
> >this type of change :(
> 
> The reads access to dgnc_poll_tick are protected.

protected with what?  I don't see the patch here and do not even
remember what it contained to be able to answer this, sorry.

Please resend if you think it is correct.

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rtl8723au: Mark type casts to __le32 as intentional

2015-09-22 Thread Lars Svensson
Fixing Sparse warnings about intentional type casts in rtw_security.c
as below.

  CHECK   drivers/staging/rtl8723au/core/rtw_security.c
drivers/staging/rtl8723au/core/rtw_security.c:248:22: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:249:24: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:776:22: \
warning: cast to restricted __le32
drivers/staging/rtl8723au/core/rtw_security.c:777:24: \
warning: cast to restricted __le32

Signed-off-by: Lars Svensson 
---
 drivers/staging/rtl8723au/core/rtw_security.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c 
b/drivers/staging/rtl8723au/core/rtw_security.c
index 3d40bab..311dfc1 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -213,6 +213,7 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
 {
/*  exclude ICV */
u32 actual_crc, expected_crc;
+   __le32 crc_le;
struct arc4context mycontext;
int length;
u32 keylength;
@@ -245,8 +246,10 @@ void rtw_wep_decrypt23a(struct rtw_adapter *padapter,
arcfour_encrypt(&mycontext, payload, payload, length);
 
/* calculate icv and compare the icv */
-   actual_crc = le32_to_cpu(getcrc32(payload, length - 4));
-   expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4]));
+   crc_le = (__force __le32)getcrc32(payload, length - 4);
+   actual_crc = le32_to_cpu(crc_le);
+   crc_le = (__force __le32)get_unaligned_le32(&payload[length - 4]);
+   expected_crc = le32_to_cpu(crc_le);
 
if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
@@ -717,6 +720,7 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
u8 rc4key[16];
u8 ttkey[16];
u32 actual_crc, expected_crc;
+   __le32 crc_le;
struct arc4context mycontext;
int length;
u32 prwskeylen;
@@ -772,9 +776,10 @@ int rtw_tkip_decrypt23a(struct rtw_adapter *padapter,
/* 4 decrypt payload include icv */
arcfour_init(&mycontext, rc4key, 16);
arcfour_encrypt(&mycontext, payload, payload, length);
-
-   actual_crc = le32_to_cpu(getcrc32(payload, length - 4));
-   expected_crc = le32_to_cpu(get_unaligned_le32(&payload[length - 4]));
+   crc_le = (__force __le32)getcrc32(payload, length - 4);
+   actual_crc = le32_to_cpu(crc_le);
+   crc_le = (__force __le32)get_unaligned_le32(&payload[length - 4]);
+   expected_crc = le32_to_cpu(crc_le);
 
if (actual_crc != expected_crc) {
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
-- 
2.4.2

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] x86: hyperv: fix build in !CONFIG_KEXEC_CORE case

2015-09-22 Thread Vitaly Kuznetsov
Recent changes in Hyper-V driver ("Drivers: hv: vmbus: add special crash
handler") broke the build when CONFIG_KEXEC_CORE is not set:

arch/x86/built-in.o: In function `hv_machine_crash_shutdown':
arch/x86/kernel/cpu/mshyperv.c:112: undefined reference to 
`native_machine_crash_shutdown'

Decorate all kexec related code with #ifdef CONFIG_KEXEC_CORE.

Reported-by: Jim Davis 
Reported-by: Stephen Hemminger 
Signed-off-by: Vitaly Kuznetsov 
---
Previously I tried solving the issue by defining native_machine_crash_shutdown
in !CONFIG_KEXEC_CORE case: https://lkml.org/lkml/2015/8/11/417. This was to
avoid having #ifdefs in C code [Greg KH]. Such approach, however, raised a
question on bloating kernel with unneeded stuff [Ingo Molnar].
---
 arch/x86/kernel/cpu/mshyperv.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 381c8b9..6cec20a 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -98,6 +98,7 @@ void hv_remove_crash_handler(void)
 EXPORT_SYMBOL_GPL(hv_remove_crash_handler);
 #endif
 
+#ifdef CONFIG_KEXEC_CORE
 static void hv_machine_shutdown(void)
 {
if (kexec_in_progress && hv_kexec_handler)
@@ -111,7 +112,7 @@ static void hv_machine_crash_shutdown(struct pt_regs *regs)
hv_crash_handler(regs);
native_machine_crash_shutdown(regs);
 }
-
+#endif
 
 static uint32_t  __init ms_hyperv_platform(void)
 {
@@ -186,8 +187,10 @@ static void __init ms_hyperv_init_platform(void)
no_timer_check = 1;
 #endif
 
+#ifdef CONFIG_KEXEC_CORE
machine_ops.shutdown = hv_machine_shutdown;
machine_ops.crash_shutdown = hv_machine_crash_shutdown;
+#endif
mark_tsc_unstable("running on Hyper-V");
 }
 
-- 
2.4.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 8/9] staging: wilc1000: rename ParseNetworkInfo

2015-09-22 Thread Chaehyun Lim
This patch replaces ParseNetworkInfo with parse_network_info to avoid
camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 2 +-
 drivers/staging/wilc1000/coreconfigurator.h | 2 +-
 drivers/staging/wilc1000/host_interface.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index bdf775a..3c71b9f 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -360,7 +360,7 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
  *  @date  1 Mar 2012
  *  @version   1.0
  */
-s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
+s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 {
s32 s32Error = 0;
tstrNetworkInfo *pstrNetworkInfo = NULL;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index e2b7b09..c2bd6fc 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -145,7 +145,7 @@ typedef struct wid_site_survey_reslts {
 
 s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
-s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
+s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
 
 s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c4ef274..e7fc648 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -2269,7 +2269,7 @@ static s32 Handle_RcvdNtwrkInfo(tstrWILC_WFIDrv 
*drvHandler,
/*if there is a an ongoing scan request*/
if (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult) {
PRINT_D(HOSTINF_DBG, "State: Scanning, parsing network 
information received\n");
-   ParseNetworkInfo(pstrRcvdNetworkInfo->pu8Buffer, 
&pstrNetworkInfo);
+   parse_network_info(pstrRcvdNetworkInfo->pu8Buffer, 
&pstrNetworkInfo);
if ((pstrNetworkInfo == NULL)
|| (pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult == 
NULL)) {
PRINT_ER("driver is null\n");
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/9] staging: wilc1000: replace kmalloc with kzalloc

2015-09-22 Thread Chaehyun Lim
This patch replaces kmalloc with kzalloc because it is initialized by 0
immediately after allcating memory.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 3813767..d8b8c3d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -439,12 +439,10 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u32 u32Tsf_Lo;
u32 u32Tsf_Hi;
 
-   pstrNetworkInfo = kmalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
+   pstrNetworkInfo = kzalloc(sizeof(tstrNetworkInfo), GFP_KERNEL);
if (!pstrNetworkInfo)
return -ENOMEM;
 
-   memset((void *)(pstrNetworkInfo), 0, sizeof(tstrNetworkInfo));
-
pstrNetworkInfo->s8rssi = pu8WidVal[0];
 
/* Assign a pointer to msa "Mac Header Start Address" */
@@ -559,12 +557,10 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
u8 *pu8IEs = NULL;
u16 u16IEsLen = 0;
 
-   pstrConnectRespInfo = kmalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
+   pstrConnectRespInfo = kzalloc(sizeof(tstrConnectRespInfo), GFP_KERNEL);
if (!pstrConnectRespInfo)
return -ENOMEM;
 
-   memset((void *)(pstrConnectRespInfo), 0, sizeof(tstrConnectRespInfo));
-
/* u16AssocRespLen = pu8Buffer[0]; */
u16AssocRespLen = (u16)u32BufferLen;
 
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 9/9] staging: wilc1000: parse_network_info: remove s32Error

2015-09-22 Thread Chaehyun Lim
s32Error is defined, but not used anywhere in this function.
Then just delete it and return 0 at the end of this function.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 3c71b9f..68e3c7f 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -362,7 +362,6 @@ u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
  */
 s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo)
 {
-   s32 s32Error = 0;
tstrNetworkInfo *pstrNetworkInfo = NULL;
u8 u8MsgType = 0;
u8 u8MsgID = 0;
@@ -466,7 +465,7 @@ s32 parse_network_info(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
 
*ppstrNetworkInfo = pstrNetworkInfo;
 
-   return s32Error;
+   return 0;
 }
 
 /**
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/9] staging: wilc1000: remove CoreConfiguratorDeInit

2015-09-22 Thread Chaehyun Lim
This patch removes CoreConfiguratorDeInit function, which is not doing
anything else except printing a PRINT_D message and returning a
s32Error. It is also removed the codes that is calling this function.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 20 
 drivers/staging/wilc1000/coreconfigurator.h |  2 --
 drivers/staging/wilc1000/host_interface.c   |  2 --
 3 files changed, 24 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index e563c9b..9676044 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -700,26 +700,6 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s 
*pstrSurveyResults)
 }
 #endif
 
-/**
- *  @brief  Deinitializes the Core Configurator
- *  @details
- *  @return Error code indicating success/failure
- *  @note
- *  @authormabubakr
- *  @date  1 Mar 2012
- *  @version   1.0
- */
-
-s32 CoreConfiguratorDeInit(void)
-{
-   s32 s32Error = 0;
-
-   PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit()\n");
-
-
-   return s32Error;
-}
-
 /*Using the global handle of the driver*/
 extern wilc_wlan_oup_t *gpstrWlanOps;
 /**
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 88a697b..a255e45 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -156,8 +156,6 @@ typedef struct wid_site_survey_reslts {
 } wid_site_survey_reslts_s;
 #endif
 
-s32 CoreConfiguratorDeInit(void);
-
 s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
  u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index db93940..86dbe46 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6525,8 +6525,6 @@ s32 host_int_deinit(tstrWILC_WFIDrv *hWFIDrv)
 
pstrWFIDrv->strWILC_UsrScanReq.pfUserScanResult = NULL;
}
-   /*deinit configurator and simulator*/
-   CoreConfiguratorDeInit();
 
pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
 
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/9] staging: wilc1000: rename SendConfigPkt

2015-09-22 Thread Chaehyun Lim
This patch replaces SendConfigPkt with send_config_pkt to aovid
camelcase.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c |   4 +-
 drivers/staging/wilc1000/coreconfigurator.h |   4 +-
 drivers/staging/wilc1000/host_interface.c   | 204 ++--
 3 files changed, 106 insertions(+), 106 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 9676044..3813767 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -717,8 +717,8 @@ extern wilc_wlan_oup_t *gpstrWlanOps;
  *  @date  1 Mar 2012
  *  @version   1.0
  */
-s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
- u32 u32WIDsCount, bool bRespRequired, u32 drvHandler)
+s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
+   u32 u32WIDsCount, bool bRespRequired, u32 drvHandler)
 {
s32 counter = 0, ret = 0;
 
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index a255e45..7227c0f 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -156,8 +156,8 @@ typedef struct wid_site_survey_reslts {
 } wid_site_survey_reslts_s;
 #endif
 
-s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
- u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
+s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
+   u32 u32WIDsCount, bool bRespRequired, u32 drvHandler);
 s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo **ppstrNetworkInfo);
 s32 DeallocateNetworkInfo(tstrNetworkInfo *pstrNetworkInfo);
 
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 86dbe46..c4ef274 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -645,8 +645,8 @@ static s32 Handle_SetChannel(tstrWILC_WFIDrv *drvHandler,
 
PRINT_D(HOSTINF_DBG, "Setting channel\n");
/*Sending Cfg*/
-   s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true,
-get_id_from_handler(pstrWFIDrv));
+   s32Error = send_config_pkt(SET_CFG, &strWID, 1, true,
+  get_id_from_handler(pstrWFIDrv));
if (s32Error) {
PRINT_ER("Failed to set channel\n");
return -EINVAL;
@@ -681,8 +681,8 @@ static s32 Handle_SetWfiDrvHandler(tstrWILC_WFIDrv 
*drvHandler,
 
/*Sending Cfg*/
 
-   s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true,
-pstrHostIfSetDrvHandler->u32Address);
+   s32Error = send_config_pkt(SET_CFG, &strWID, 1, true,
+  pstrHostIfSetDrvHandler->u32Address);
 
if (pstrWFIDrv == NULL)
up(&hSemDeinitDrvHandle);
@@ -723,8 +723,8 @@ static s32 Handle_SetOperationMode(tstrWILC_WFIDrv 
*drvHandler,
/*Sending Cfg*/
PRINT_INFO(HOSTINF_DBG, "pstrWFIDrv= %p\n", pstrWFIDrv);
 
-   s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true,
-get_id_from_handler(pstrWFIDrv));
+   s32Error = send_config_pkt(SET_CFG, &strWID, 1, true,
+  get_id_from_handler(pstrWFIDrv));
 
 
if ((pstrHostIfSetOperationMode->u32Mode) == IDLE_MODE)
@@ -769,8 +769,8 @@ s32 Handle_set_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 
*pu8IPAddr, u8 idx)
strWID.ps8WidVal = (u8 *)pu8IPAddr;
strWID.s32ValueSize = IP_ALEN;
 
-   s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true,
-get_id_from_handler(pstrWFIDrv));
+   s32Error = send_config_pkt(SET_CFG, &strWID, 1, true,
+  get_id_from_handler(pstrWFIDrv));
 
 
host_int_get_ipaddress(drvHandler, firmwareIPAddress, idx);
@@ -808,8 +808,8 @@ s32 Handle_get_IPAddress(tstrWILC_WFIDrv *drvHandler, u8 
*pu8IPAddr, u8 idx)
strWID.ps8WidVal = kmalloc(IP_ALEN, GFP_KERNEL);
strWID.s32ValueSize = IP_ALEN;
 
-   s32Error = SendConfigPkt(GET_CFG, &strWID, 1, true,
-get_id_from_handler(pstrWFIDrv));
+   s32Error = send_config_pkt(GET_CFG, &strWID, 1, true,
+  get_id_from_handler(pstrWFIDrv));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", strWID.ps8WidVal);
 
@@ -865,8 +865,8 @@ static s32 Handle_SetMacAddress(tstrWILC_WFIDrv *drvHandler,
strWID.s32ValueSize = ETH_ALEN;
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", strWID.ps8WidVal);
/*Sending Cfg*/
-   s32Error = SendConfigPkt(SET_CFG, &strWID, 1, true,
-get_id_from_handler(pstrWFIDrv));
+   s32Error = send_config_pkt(SET_CFG, &strWID, 1, true,
+  get_id_from_handler(pstrWFIDrv));
if (s32Error) {
PRINT_ER("Failed to set mac add

[PATCH 4/9] staging: wilc1000: replace kmalloc/memcpy with kmemdup

2015-09-22 Thread Chaehyun Lim
This patch replaces kmalloc followed by memset and memcpy with kmemdup.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 12 +++-
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index d8b8c3d..875b769 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -488,13 +488,10 @@ s32 ParseNetworkInfo(u8 *pu8MsgBuffer, tstrNetworkInfo 
**ppstrNetworkInfo)
u16IEsLen = u16RxLen - (MAC_HDR_LEN + TIME_STAMP_LEN + 
BEACON_INTERVAL_LEN + CAP_INFO_LEN);
 
if (u16IEsLen > 0) {
-   pstrNetworkInfo->pu8IEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
+   pstrNetworkInfo->pu8IEs = kmemdup(pu8IEs, u16IEsLen,
+ GFP_KERNEL);
if (!pstrNetworkInfo->pu8IEs)
return -ENOMEM;
-
-   memset((void *)(pstrNetworkInfo->pu8IEs), 0, u16IEsLen);
-
-   memcpy(pstrNetworkInfo->pu8IEs, pu8IEs, u16IEsLen);
}
pstrNetworkInfo->u16IEsLen = u16IEsLen;
 
@@ -578,13 +575,10 @@ s32 ParseAssocRespInfo(u8 *pu8Buffer, u32 u32BufferLen,
pu8IEs = &pu8Buffer[CAP_INFO_LEN + STATUS_CODE_LEN + AID_LEN];
u16IEsLen = u16AssocRespLen - (CAP_INFO_LEN + STATUS_CODE_LEN + 
AID_LEN);
 
-   pstrConnectRespInfo->pu8RespIEs = kmalloc(u16IEsLen, 
GFP_KERNEL);
+   pstrConnectRespInfo->pu8RespIEs = kmemdup(pu8IEs, u16IEsLen, 
GFP_KERNEL);
if (!pstrConnectRespInfo->pu8RespIEs)
return -ENOMEM;
 
-   memset((void *)(pstrConnectRespInfo->pu8RespIEs), 0, u16IEsLen);
-
-   memcpy(pstrConnectRespInfo->pu8RespIEs, pu8IEs, u16IEsLen);
pstrConnectRespInfo->u16RespIEsLen = u16IEsLen;
}
 
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/9] staging: wilc1000: replace kmalloc_array/memset with kcalloc

2015-09-22 Thread Chaehyun Lim
This patch replaces kmalloc_array followed by memset with kcalloc.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 875b769..8b56b92 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -644,13 +644,11 @@ s32 ParseSurveyResults(u8 
ppu8RcvdSiteSurveyResults[][MAX_SURVEY_RESULT_FRAG_SIZ
}
}
 
-   pstrSurveyResults = kmalloc_array(u32SurveyResultsCount,
-   sizeof(wid_site_survey_reslts_s), GFP_KERNEL);
+   pstrSurveyResults = kcalloc(u32SurveyResultsCount,
+   sizeof(wid_site_survey_reslts_s), 
GFP_KERNEL);
if (!pstrSurveyResults)
return -ENOMEM;
 
-   memset((void *)(pstrSurveyResults), 0, u32SurveyResultsCount * 
sizeof(wid_site_survey_reslts_s));
-
u32SurveyResultsCount = 0;
 
for (i = 0; i < u32RcvdSurveyResultsNum; i++) {
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/9] staging: wilc1000: remove useless comment

2015-09-22 Thread Chaehyun Lim
This patch removes useless comment in coreconfigurator.c

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 38 -
 drivers/staging/wilc1000/coreconfigurator.h | 29 ++
 2 files changed, 8 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 8b56b92..47a37fa 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -9,26 +9,11 @@
  */
 
 
-/*/
-/* File Includes */
-/*/
 #include "coreconfigurator.h"
 #include 
-/*/
-/* Constants */
-/*/
 #define TAG_PARAM_OFFSET   (MAC_HDR_LEN + TIME_STAMP_LEN + \
BEACON_INTERVAL_LEN + 
CAP_INFO_LEN)
 
-/*/
-/* Function Macros   */
-/*/
-
-
-/*/
-/* Type Definitions  */
-/*/
-
 /* Basic Frame Type Codes (2-bit) */
 typedef enum {
FRAME_TYPE_CONTROL = 0x04,
@@ -130,25 +115,6 @@ typedef struct {
bool bRespRequired;
 } tstrConfigPktInfo;
 
-
-
-/*/
-/* Extern Variable Declarations  */
-/*/
-
-/*/
-/* Global Variables  */
-/*/
-/*/
-/* Static Function Declarations  */
-/*/
-
-
-
-/*/
-/* Functions */
-/*/
-
 /* This function extracts the beacon period field from the beacon or probe   */
 /* response frame.   */
 static inline u16 get_beacon_period(u8 *data)
@@ -688,7 +654,6 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s 
*pstrSurveyResults)
 }
 #endif
 
-/*Using the global handle of the driver*/
 extern wilc_wlan_oup_t *gpstrWlanOps;
 /**
  *  @brief  sends certain Configuration Packet based on the input 
WIDs pstrWIDs
@@ -735,9 +700,6 @@ s32 send_config_pkt(u8 u8Mode, tstrWID *pstrWIDs,
break;
}
}
-   /**
-*  get the value
-**/
counter = 0;
for (counter = 0; counter < u32WIDsCount; counter++) {
pstrWIDs[counter].s32ValueSize = 
gpstrWlanOps->wlan_cfg_get_value(
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 7227c0f..e2b7b09 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -12,10 +12,7 @@
 #define CORECONFIGURATOR_H
 
 #include "wilc_wlan_if.h"
-/*/
-/* Constants */
-/*/
-/* Number of WID Options Supported */
+
 #define NUM_BASIC_SWITCHES  45
 #define NUM_FHSS_SWITCHES   0
 
@@ -24,12 +21,12 @@
 #ifdef MAC_802_11N
 #define NUM_11N_BASIC_SWITCHES  25
 #define NUM_11N_HUT_SWITCHES47
-#else /* MAC_802_11N */
+#else
 #define NUM_11N_BASIC_SWITCHES  0
 #define NUM_11N_HUT_SWITCHES0
-#endif /* MAC_802_11N */
+#endif
 
-#define MAC_HDR_LEN 24  /* No Address4 - non-ESS */
+#define MAC_HDR_LEN 24
 #define MAX_SSID_LEN33
 #define FCS_LEN 4
 #define TIME_STAMP_LEN  8
@@ -39,9 +36,7 @@
 #define AID_

[PATCH 7/9] staging: wilc1000: remove extern declaration

2015-09-22 Thread Chaehyun Lim
This patch removes extern declaration of *gpstrWlanOps in
coreconfigurator.c file. It is defined extern declaration in
wilc_wlan_if.h file and then is included in coreconfigurator.c file.

Signed-off-by: Chaehyun Lim 
---
 drivers/staging/wilc1000/coreconfigurator.c | 2 +-
 drivers/staging/wilc1000/wilc_wlan_if.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 47a37fa..bdf775a 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -10,6 +10,7 @@
 
 
 #include "coreconfigurator.h"
+#include "wilc_wlan_if.h"
 #include 
 #define TAG_PARAM_OFFSET   (MAC_HDR_LEN + TIME_STAMP_LEN + \
BEACON_INTERVAL_LEN + 
CAP_INFO_LEN)
@@ -654,7 +655,6 @@ s32 DeallocateSurveyResults(wid_site_survey_reslts_s 
*pstrSurveyResults)
 }
 #endif
 
-extern wilc_wlan_oup_t *gpstrWlanOps;
 /**
  *  @brief  sends certain Configuration Packet based on the input 
WIDs pstrWIDs
  *  using driver config layer
diff --git a/drivers/staging/wilc1000/wilc_wlan_if.h 
b/drivers/staging/wilc1000/wilc_wlan_if.h
index 5f68b6a..668f1b8 100644
--- a/drivers/staging/wilc1000/wilc_wlan_if.h
+++ b/drivers/staging/wilc1000/wilc_wlan_if.h
@@ -912,6 +912,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t 
*oup);
 void wilc_bus_set_max_speed(void);
 void wilc_bus_set_default_speed(void);
 u32 wilc_get_chipid(u8 update);
+extern wilc_wlan_oup_t *gpstrWlanOps;
 
 
 #endif
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: wicl1000: fix dereference after free in wilc_wlan_cleanup()

2015-09-22 Thread Javier Martinez Canillas
The wilc_wlan_cleanup() function iterates over the list of transmission
buffers freeing all of them and then iterates over the receive buffers
list to free all of them as well.

But on the receive loop a pointer to struct txq_entry_t is dereferenced
instead of the pointer to a struct rxq_entry_t. This not only causes a
dereference to a pointer already freed but also leaks the memory in the
struct rxq_entry_t buffer.

Also, the buffer is allocated when MEMORY_STATIC is not defined no when
MEMORY_DYNAMIC is defined. So use #ifndef MEMORY_STATIC instead as it's
done in the rest of the driver to avoid leaking the buffer memory.

Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Javier Martinez Canillas 

---

Changes in v2:
- Change also the #ifdef MEMORY_DYNAMIC to #ifndef MEMORY_STATIC since buffer
  is allocated when MEMORY_STATIC isn't defined. Suggested by Sudip Mukherjee.

 drivers/staging/wilc1000/wilc_wlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 4c25179c2fec..fc9028d59dcd 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1745,8 +1745,8 @@ static void wilc_wlan_cleanup(void)
rqe = wilc_wlan_rxq_remove();
if (rqe == NULL)
break;
-#ifdef MEMORY_DYNAMIC
-   kfree(tqe->buffer);
+#ifndef MEMORY_STATIC
+   kfree(rqe->buffer);
 #endif
kfree(rqe);
} while (1);
-- 
2.4.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: most: Use NULL instead of 0 in assignment of pointer

2015-09-22 Thread Dan Carpenter
On Sat, Sep 05, 2015 at 09:21:58PM +0200, Anders Fridlund wrote:
> I resent it since no one responded to it for 10 days. From what I came
> to understand that is the common practice. If that is not the case I'm
> sorry (and please let me know so I don't do it again).
> 

10 days is too short.  Especially since the merge window was open.

regards,
dan carpenter


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: wicl1000: fix dereference after free in wilc_wlan_cleanup()

2015-09-22 Thread Javier Martinez Canillas
Hello Sudip,

Thanks a lot for your feedback.

On 09/22/2015 02:16 PM, Sudip Mukherjee wrote:
> On Tue, Sep 22, 2015 at 12:24:50PM +0200, Javier Martinez Canillas wrote:
>> The wilc_wlan_cleanup() function iterates over the list of transmission
>> buffers freeing all of them and then iterates over the receive buffers
>> list to free all of them as well.
>>
>> But on the receive loop a pointer to struct txq_entry_t is dereferenced
>> instead of the pointer to a struct rxq_entry_t. This not only causes a
>> dereference to a pointer already freed but also leaks the memory in the
>> struct rxq_entry_t buffer.
>>
>> Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
>> Signed-off-by: Javier Martinez Canillas 
>>
>> ---
>>
>>  drivers/staging/wilc1000/wilc_wlan.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
>> b/drivers/staging/wilc1000/wilc_wlan.c
>> index 4c25179c2fec..c40f143b00b7 100644
>> --- a/drivers/staging/wilc1000/wilc_wlan.c
>> +++ b/drivers/staging/wilc1000/wilc_wlan.c
>> @@ -1746,7 +1746,7 @@ static void wilc_wlan_cleanup(void)
>>  if (rqe == NULL)
>>  break;
>>  #ifdef MEMORY_DYNAMIC
>> -kfree(tqe->buffer);
>> +kfree(rqe->buffer);
>>  #endif
> MEMORY_DYNAMIC is only used here and no where else. And buffer was
> allocated in the else part of #ifdef MEMORY_STATIC.
> So you should really be using #ifndef MEMORY_STATIC here instead of
> #ifdef MEMORY_DYNAMIC otherwise memory leak will still remain.
>

You are right that #ifndef MEMORY_STATIC should be used instead to fix
the memory leak. I'll post a v2 changing that as well.

> regards
> sudip
>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH RESEND 04/16] staging: rtl8188eu: remove unused macro GEN_DRV_CMD_HANDLER

2015-09-22 Thread Dan Carpenter
On Tue, Sep 01, 2015 at 12:46:43AM +0200, Luca Ceresoli wrote:
> But I don't see what added value this brings to the commit title.
> I really would like to understand why this is a good practice. Can you
> point me to an explanation (links are welcome)?

One thing is that when you look at online email archives the subject is
often a long way away from the body of the email so it's hard to read.

regards,
dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: dgnc: take lock when accessing to dgnc_poll_tick

2015-09-22 Thread Sudip Mukherjee
On Tue, Sep 22, 2015 at 12:55:02PM +0100, Salah Triki wrote:
> On Mon, Sep 21, 2015 at 07:17:08PM +0300, Dan Carpenter wrote:
> > On Sun, Sep 06, 2015 at 08:00:10PM -0700, Greg KH wrote:
> > > On Sat, Sep 05, 2015 at 01:12:01PM +0100, Salah Triki wrote:

> So please ignore this patch and consider instead the patch 
> _[PATCH v3] staging: dgnc: take lock when storing value in dgnc_poll_tick_. 
The one you sent on 25th August? I am sure Greg is not having the patch
you mentioned in his queue now. Please resend again.

regards
sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: wicl1000: fix dereference after free in wilc_wlan_cleanup()

2015-09-22 Thread Sudip Mukherjee
On Tue, Sep 22, 2015 at 12:24:50PM +0200, Javier Martinez Canillas wrote:
> The wilc_wlan_cleanup() function iterates over the list of transmission
> buffers freeing all of them and then iterates over the receive buffers
> list to free all of them as well.
> 
> But on the receive loop a pointer to struct txq_entry_t is dereferenced
> instead of the pointer to a struct rxq_entry_t. This not only causes a
> dereference to a pointer already freed but also leaks the memory in the
> struct rxq_entry_t buffer.
> 
> Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
> Signed-off-by: Javier Martinez Canillas 
> 
> ---
> 
>  drivers/staging/wilc1000/wilc_wlan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
> b/drivers/staging/wilc1000/wilc_wlan.c
> index 4c25179c2fec..c40f143b00b7 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -1746,7 +1746,7 @@ static void wilc_wlan_cleanup(void)
>   if (rqe == NULL)
>   break;
>  #ifdef MEMORY_DYNAMIC
> - kfree(tqe->buffer);
> + kfree(rqe->buffer);
>  #endif
MEMORY_DYNAMIC is only used here and no where else. And buffer was
allocated in the else part of #ifdef MEMORY_STATIC.
So you should really be using #ifndef MEMORY_STATIC here instead of
#ifdef MEMORY_DYNAMIC otherwise memory leak will still remain.

regards
sudip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: dgnc: take lock when accessing to dgnc_poll_tick

2015-09-22 Thread Salah Triki
On Mon, Sep 21, 2015 at 07:17:08PM +0300, Dan Carpenter wrote:
> On Sun, Sep 06, 2015 at 08:00:10PM -0700, Greg KH wrote:
> > On Sat, Sep 05, 2015 at 01:12:01PM +0100, Salah Triki wrote:
> > > poll_tick is declared global, so dgnc_driver_pollrate_* need to
> > > take the lock dgnc_poll_lock before accessing to this variable.
> > 
> > Really?  The scope of a variable doesn't matter if a lock is needed for
> > it or not.
> > 
> > And this patch doesn't really do anything at all, I don't understand why
> > it is needed, please explain.
> > 
> 
> Salah has not replied.  He didn't reply to the previous email, but he
> edited the changelog so maybe that was supposed to count as reply?
> 
> Anyway, all the reads of dgnc_poll_tick are protected, it was only the
> write which wasn't.  It could race.  I think this patch is the right
> thing.
> 
> regards,
> dan carpenter
> 

I changed not only the changelog but also the function 
dgnc_driver_pollrate_show. However, these changes are erroneous as mentioned 
by Greg. So please ignore this patch and consider instead the patch 
_[PATCH v3] staging: dgnc: take lock when storing value in dgnc_poll_tick_. 

best regards,
salah triki
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: dgnc: take lock when accessing to dgnc_poll_tick

2015-09-22 Thread Salah Triki
>On Sun, 6 Sep 2015 20:00:10 -0700, Greg KH wrote:
>>On Sat, Sep 05, 2015 at 01:12:01PM +0100, Salah Triki wrote:
>> poll_tick is declared global, so dgnc_driver_pollrate_* need to
>> take the lock dgnc_poll_lock before accessing to this variable.
>
>Really?  The scope of a variable doesn't matter if a lock is needed for
>it or not.
>
>And this patch doesn't really do anything at all, I don't understand why
>it is needed, please explain.

...
>>  static ssize_t dgnc_driver_pollrate_show(struct device_driver *ddp,
>>  char *buf)
>>  {
>> -return snprintf(buf, PAGE_SIZE, "%dms\n", dgnc_poll_tick);
>> +unsigned long flags;
>> +int tick;
>> +
>> +spin_lock_irqsave(&dgnc_poll_lock, flags);
>
>Why irqsave?  You are never grabbing this lock from within an irq.
>
>I don't think you understand how Linux kernel locks work, or how/where
>they are needed.  Please do a bit more research before creating patches
>like this.
>
>greg k-h

I messed up, please ignore this patch.

best regards
salah triki
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] staging: dgnc: take lock when storing value in dgnc_poll_tick

2015-09-22 Thread Salah Triki
>On Wed, 2 Sep 2015 18:15:29 -0700, Greg KH wrote:
>>On Tue, Aug 25, 2015 at 08:09:47PM +0100, Salah Triki wrote:
>> poll_tick is declared global, so dgnc_driver_pollrate_store needs to
>> take
>> the lock dgnc_poll_lock before modifying this variable. dgnc_poll_lock
>> the
>> appropriate lock, since it is intended for poll scheduling and
>> dgnc_poll_tick
>> contains the poll rate. dgnc_poll_lock needs to be declared not static
>> and
>> extern in order to be visible for dgnc_driver_pollrate_store.
>
>So you only lock it if you change the value?  That's not the way to do
>this type of change :(

The reads access to dgnc_poll_tick are protected.

regards,
salah triki
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: wicl1000: fix dereference after free in wilc_wlan_cleanup()

2015-09-22 Thread Javier Martinez Canillas
The wilc_wlan_cleanup() function iterates over the list of transmission
buffers freeing all of them and then iterates over the receive buffers
list to free all of them as well.

But on the receive loop a pointer to struct txq_entry_t is dereferenced
instead of the pointer to a struct rxq_entry_t. This not only causes a
dereference to a pointer already freed but also leaks the memory in the
struct rxq_entry_t buffer.

Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Javier Martinez Canillas 

---

 drivers/staging/wilc1000/wilc_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 4c25179c2fec..c40f143b00b7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1746,7 +1746,7 @@ static void wilc_wlan_cleanup(void)
if (rqe == NULL)
break;
 #ifdef MEMORY_DYNAMIC
-   kfree(tqe->buffer);
+   kfree(rqe->buffer);
 #endif
kfree(rqe);
} while (1);
-- 
2.4.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: dgnc: take lock when accessing to dgnc_poll_tick

2015-09-22 Thread Dan Carpenter
On Tue, Sep 22, 2015 at 10:25:09AM +0100, Salah Triki wrote:
> I'm sorry for wasting your time.
> 

The patch was correct.  Just respond to reply to review comments so that
people can follow what's going on.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/38] Fixes related to incorrect usage of unsigned types

2015-09-22 Thread Jacek Anaszewski

On 09/22/2015 11:13 AM, Andrzej Hajda wrote:

On 09/21/2015 03:42 PM, David Howells wrote:

Andrzej Hajda  wrote:


Semantic patch finds comparisons of types:
 unsigned < 0
 unsigned >= 0
The former is always false, the latter is always true.
Such comparisons are useless, so theoretically they could be
safely removed, but their presence quite often indicates bugs.


Or someone has left them in because they don't matter and there's the
possibility that the type being tested might be or become signed under some
circumstances.  If the comparison is useless, I'd expect the compiler to just
discard it - for such cases your patch is pointless.

If I have, for example:

unsigned x;

if (x == 0 || x > 27)
give_a_range_error();

I will write this as:

unsigned x;

if (x <= 0 || x > 27)
give_a_range_error();

because it that gives a way to handle x being changed to signed at some point
in the future for no cost.  In which case, your changing the <= to an ==
"because the < part of the case is useless" is arguably wrong.


This is why I have not checked for such cases - I have skipped checks of type
unsigned <= 0
exactly for the reasons above.

However I have left two other checks as they seems to me more suspicious - they
are always true or false. But as Dmitry and Andrew pointed out Linus have quite
strong opinion against removing range checks in such cases as he finds it
clearer. I think it applies to patches 29-36. I am not sure about patches 
26-28,37.


Dropped 30/38 and 31/38 from LED tree then.

--
Best Regards,
Jacek Anaszewski
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 15/16] staging: wilc1000: host_int_init: remove blank line before a close brace.

2015-09-22 Thread Chaehyun Lim
This patch removes blank line before a close brace.
CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/host_interface.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index ee4f169..82db248 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6463,7 +6463,6 @@ _fail_mq_:
wilc_mq_destroy(&gMsgQHostIF);
 _fail_:
return result;
-
 }
 /**
  *  @brief  host_int_deinit
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 12/16] staging: wilc1000: host_int_init: remove multiple blank lines

2015-09-22 Thread Chaehyun Lim
This patch removes multiple blank lines in host_int_init function.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/host_interface.c | 8 
 1 file changed, 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 2150c89..43062c5 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6368,8 +6368,6 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
 
sema_init(&hWaitResponse, 0);
 
-
-
/*Allocate host interface private structure*/
pstrWFIDrv  = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL);
if (!pstrWFIDrv) {
@@ -6402,9 +6400,6 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
sema_init(&(pstrWFIDrv->hSemGetCHNL), 0);
sema_init(&(pstrWFIDrv->hSemInactiveTime), 0);
 
-
-
-
PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count);
 
if (clients_count == 0) {
@@ -6425,7 +6420,6 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
mod_timer(&g_hPeriodicRSSI, jiffies + msecs_to_jiffies(5000));
}
 
-
setup_timer(&pstrWFIDrv->hScanTimer, TimerCB_Scan, 0);
 
setup_timer(&pstrWFIDrv->hConnectTimer, TimerCB_Connect, 0);
@@ -6455,7 +6449,6 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
   pstrWFIDrv->strCfgValues.active_scan_time, 
pstrWFIDrv->strCfgValues.passive_scan_time,
   pstrWFIDrv->strCfgValues.curr_tx_rate);
 
-
up(&(pstrWFIDrv->gtOsCfgValuesSem));
 
clients_count++; /* increase number of created entities */
@@ -6472,7 +6465,6 @@ _fail_mq_:
 _fail_:
return s32Error;
 
-
 }
 /**
  *  @brief  host_int_deinit
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 16/16] staging: wilc1000: host_int_init: remove unnecessary parentheses

2015-09-22 Thread Chaehyun Lim
This patch removes unnecessary parentheses found by checkpatch.pl

Unnecessary parentheses around pstrWFIDrv->hSemTestKeyBlock
Unnecessary parentheses around pstrWFIDrv->hSemTestDisconnectBlock
Unnecessary parentheses around pstrWFIDrv->hSemGetRSSI
Unnecessary parentheses around pstrWFIDrv->hSemGetLINKSPEED
Unnecessary parentheses around pstrWFIDrv->hSemGetCHNL
Unnecessary parentheses around pstrWFIDrv->hSemInactiveTime
Unnecessary parentheses around pstrWFIDrv->gtOsCfgValuesSem
Unnecessary parentheses around pstrWFIDrv->gtOsCfgValuesSem

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/host_interface.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 82db248..db93940 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6393,12 +6393,12 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
sema_init(&hSemHostIntDeinit, 1);
}
 
-   sema_init(&(pstrWFIDrv->hSemTestKeyBlock), 0);
-   sema_init(&(pstrWFIDrv->hSemTestDisconnectBlock), 0);
-   sema_init(&(pstrWFIDrv->hSemGetRSSI), 0);
-   sema_init(&(pstrWFIDrv->hSemGetLINKSPEED), 0);
-   sema_init(&(pstrWFIDrv->hSemGetCHNL), 0);
-   sema_init(&(pstrWFIDrv->hSemInactiveTime), 0);
+   sema_init(&pstrWFIDrv->hSemTestKeyBlock, 0);
+   sema_init(&pstrWFIDrv->hSemTestDisconnectBlock, 0);
+   sema_init(&pstrWFIDrv->hSemGetRSSI, 0);
+   sema_init(&pstrWFIDrv->hSemGetLINKSPEED, 0);
+   sema_init(&pstrWFIDrv->hSemGetCHNL, 0);
+   sema_init(&pstrWFIDrv->hSemInactiveTime, 0);
 
PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count);
 
@@ -6428,7 +6428,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
setup_timer(&pstrWFIDrv->hRemainOnChannel, ListenTimerCB, 0);
 
sema_init(&(pstrWFIDrv->gtOsCfgValuesSem), 1);
-   down(&(pstrWFIDrv->gtOsCfgValuesSem));
+   down(&pstrWFIDrv->gtOsCfgValuesSem);
 
pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
 
@@ -6448,14 +6448,14 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
   pstrWFIDrv->strCfgValues.active_scan_time, 
pstrWFIDrv->strCfgValues.passive_scan_time,
   pstrWFIDrv->strCfgValues.curr_tx_rate);
 
-   up(&(pstrWFIDrv->gtOsCfgValuesSem));
+   up(&pstrWFIDrv->gtOsCfgValuesSem);
 
clients_count++; /* increase number of created entities */
 
return result;
 
 _fail_timer_2:
-   up(&(pstrWFIDrv->gtOsCfgValuesSem));
+   up(&pstrWFIDrv->gtOsCfgValuesSem);
del_timer_sync(&pstrWFIDrv->hConnectTimer);
del_timer_sync(&pstrWFIDrv->hScanTimer);
kthread_stop(HostIFthreadHandler);
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 07/16] staging: wilc1000: make add_virtual_intf static

2015-09-22 Thread Chaehyun Lim
This patch makes add_virtual_intf static. This function is used only at
wilc_wfi_cfgoperation.c file.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0becefb..7d26ccd 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -3321,10 +3321,12 @@ static int change_station(struct wiphy *wiphy, struct 
net_device *dev,
  *  @date  01 JUL 2012
  *  @version   1.0
  */
-struct wireless_dev *add_virtual_intf(struct wiphy *wiphy, const char *name,
- unsigned char name_assign_type,
- enum nl80211_iftype type, u32 *flags,
- struct vif_params *params)
+static struct wireless_dev *add_virtual_intf(struct wiphy *wiphy,
+const char *name,
+unsigned char name_assign_type,
+enum nl80211_iftype type,
+u32 *flags,
+struct vif_params *params)
 {
perInterface_wlan_t *nic;
struct wilc_priv *priv;
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 13/16] staging: wilc1000: host_int_init: remove commented code

2015-09-22 Thread Chaehyun Lim
This patch removes commented code in host_int_init function.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/host_interface.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 43062c5..ce7bb0f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6431,7 +6431,6 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
down(&(pstrWFIDrv->gtOsCfgValuesSem));
 
pstrWFIDrv->enuHostIFstate = HOST_IF_IDLE;
-   /* gWFiDrvHandle->bPendingConnRequest = false; */
 
/*Initialize CFG WIDS Defualt Values*/
 
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 14/16] staging: wilc1000: host_int_init: replace s32Error with result

2015-09-22 Thread Chaehyun Lim
This patch replaces s32Error with result in host_int_init function to
avoid camelcase.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/host_interface.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index ce7bb0f..ee4f169 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6358,7 +6358,7 @@ static u32 clients_count;
 
 s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
 {
-   s32 s32Error = 0;
+   s32 result = 0;
tstrWILC_WFIDrv *pstrWFIDrv;
int err;
 
@@ -6371,13 +6371,13 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
/*Allocate host interface private structure*/
pstrWFIDrv  = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL);
if (!pstrWFIDrv) {
-   s32Error = -ENOMEM;
+   result = -ENOMEM;
goto _fail_timer_2;
}
*phWFIDrv = pstrWFIDrv;
err = add_handler_in_list(pstrWFIDrv);
if (err) {
-   s32Error = -EFAULT;
+   result = -EFAULT;
goto _fail_timer_2;
}
 
@@ -6403,16 +6403,16 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
PRINT_D(HOSTINF_DBG, "INIT: CLIENT COUNT %d\n", clients_count);
 
if (clients_count == 0) {
-   s32Error = wilc_mq_create(&gMsgQHostIF);
+   result = wilc_mq_create(&gMsgQHostIF);
 
-   if (s32Error < 0) {
+   if (result < 0) {
PRINT_ER("Failed to creat MQ\n");
goto _fail_;
}
HostIFthreadHandler = kthread_run(hostIFthread, NULL, 
"WILC_kthread");
if (IS_ERR(HostIFthreadHandler)) {
PRINT_ER("Failed to creat Thread\n");
-   s32Error = -EFAULT;
+   result = -EFAULT;
goto _fail_mq_;
}
setup_timer(&g_hPeriodicRSSI, GetPeriodicRSSI,
@@ -6452,7 +6452,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
 
clients_count++; /* increase number of created entities */
 
-   return s32Error;
+   return result;
 
 _fail_timer_2:
up(&(pstrWFIDrv->gtOsCfgValuesSem));
@@ -6462,7 +6462,7 @@ _fail_timer_2:
 _fail_mq_:
wilc_mq_destroy(&gMsgQHostIF);
 _fail_:
-   return s32Error;
+   return result;
 
 }
 /**
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 10/16] staging: wilc1000: host_int_init: replace kmalloc with kzalloc

2015-09-22 Thread Chaehyun Lim
This patch replaces kmalloc with kzalloc in host_int_init.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/host_interface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 317bc60..8c0c478 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6371,13 +6371,12 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
 
 
/*Allocate host interface private structure*/
-   pstrWFIDrv  = kmalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL);
+   pstrWFIDrv  = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL);
if (pstrWFIDrv == NULL) {
s32Error = -ENOMEM;
PRINT_ER("Failed to allocate memory\n");
goto _fail_timer_2;
}
-   memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv));
*phWFIDrv = pstrWFIDrv;
err = add_handler_in_list(pstrWFIDrv);
if (err) {
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 11/16] staging: wilc1000: host_int_init: fix kzalloc error check

2015-09-22 Thread Chaehyun Lim
This patch fixes error check when kzalloc is failed.
NULL comparison style is changed to use ! operator and
PRINT_ER is also removed.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/host_interface.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 8c0c478..2150c89 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6372,9 +6372,8 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
 
/*Allocate host interface private structure*/
pstrWFIDrv  = kzalloc(sizeof(tstrWILC_WFIDrv), GFP_KERNEL);
-   if (pstrWFIDrv == NULL) {
+   if (!pstrWFIDrv) {
s32Error = -ENOMEM;
-   PRINT_ER("Failed to allocate memory\n");
goto _fail_timer_2;
}
*phWFIDrv = pstrWFIDrv;
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 02/16] staging: wilc1000: remove useless comment

2015-09-22 Thread Chaehyun Lim
This patch removes useless comment.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 19 +--
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index eaec88c..58b1481 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -13,7 +13,7 @@
 #include "wilc_wfi_cfgoperations.h"
 #include "wilc_wlan.c"
 #ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"/* tony : for set_wiphy_dev() */
+#include "linux_wlan_sdio.h"
 #endif
 #include 
 
@@ -701,10 +701,6 @@ static int set_channel(struct wiphy *wiphy,
  *  @version   1.0
  */
 
-/*
- * kernel version 3.8.8 supported
- * tony, sswd, WILC-KR, 2013-10-29
- */
 static int scan(struct wiphy *wiphy, struct cfg80211_scan_request *request)
 {
struct wilc_priv *priv;
@@ -1626,11 +1622,6 @@ static int get_station(struct wiphy *wiphy, struct 
net_device *dev,
 
host_int_get_statistics(priv->hWILCWFIDrv, &strStatistics);
 
-   /*
-* tony: 2013-11-13
-* tx_failed introduced more than
-* kernel version 3.0.0
-*/
sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |

BIT(NL80211_STA_INFO_RX_PACKETS) |

BIT(NL80211_STA_INFO_TX_PACKETS) |
@@ -2657,7 +2648,7 @@ static int dump_station(struct wiphy *wiphy, struct 
net_device *dev,
  *  @return int : Return 0 on Success.
  *  @authormdaftedar
  *  @date  01 JUL 2012
- *  @version   
1.0WILC_WFI_set_cqmWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_config_rssi_config
+ *  @version   1.0
  */
 static int set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
  bool enabled, int timeout)
@@ -3371,7 +3362,7 @@ struct wireless_dev *add_virtual_intf(struct wiphy 
*wiphy, const char *name,
  *  @date  01 JUL 2012
  *  @version   1.0
  */
-int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)  /* 
tony for v3.8 support */
+int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 {
PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n");
return 0;
@@ -3426,7 +3417,7 @@ static struct cfg80211_ops wilc_cfg80211_ops = {
  *  @return int : Return 0 on Success.
  *  @authormdaftedar
  *  @date  01 MAR 2012
- *  @version   
1.0WILC_WFI_set_cqmWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_configWILC_WFI_set_cqm_rssi_config_rssi_config
+ *  @version   1.0
  */
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed)
 {
@@ -3573,7 +3564,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device 
*net)
   wdev->wiphy->interface_modes, wdev->iftype);
 
#ifdef WILC_SDIO
-   set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev); /* tony */
+   set_wiphy_dev(wdev->wiphy, &local_sdio_func->dev);
#endif
 
/*Register wiphy structure*/
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 04/16] staging: wilc1000: make del_virtual_intf static

2015-09-22 Thread Chaehyun Lim
This patch makes del_virtual_intf static. This function is used only at
wilc_wfi_cfgoperation.c file.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 40fd3ca..da04e50 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -3362,7 +3362,7 @@ struct wireless_dev *add_virtual_intf(struct wiphy 
*wiphy, const char *name,
  *  @date  01 JUL 2012
  *  @version   1.0
  */
-int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
+static int del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 {
PRINT_D(HOSTAPD_DBG, "Deleting virtual interface\n");
return 0;
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 08/16] staging: wilc1000: remove CoreConfiguratorInit

2015-09-22 Thread Chaehyun Lim
This patch removes CoreConfiguratorInit function, which is not doing
anything else except printing a PRINT_D message and returing a s32Error.
It is also removed the code that is calling this function.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing and remove declaration of function.

 drivers/staging/wilc1000/coreconfigurator.c | 19 ---
 drivers/staging/wilc1000/coreconfigurator.h |  1 -
 drivers/staging/wilc1000/host_interface.c   | 11 ---
 3 files changed, 31 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 14e8efc..e563c9b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -327,25 +327,6 @@ static inline u16 get_asoc_id(u8 *data)
return asoc_id;
 }
 
-/**
- *  @brief  initializes the Core Configurator
- *  @details
- *  @return Error code indicating success/failure
- *  @note
- *  @authormabubakr
- *  @date  1 Mar 2012
- *  @version   1.0
- */
-
-s32 CoreConfiguratorInit(void)
-{
-   s32 s32Error = 0;
-
-   PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit()\n");
-
-   return s32Error;
-}
-
 u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
 {
u16 u16index = 0;
diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 8439066..88a697b 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -156,7 +156,6 @@ typedef struct wid_site_survey_reslts {
 } wid_site_survey_reslts_s;
 #endif
 
-s32 CoreConfiguratorInit(void);
 s32 CoreConfiguratorDeInit(void);
 
 s32 SendConfigPkt(u8 u8Mode, tstrWID *pstrWIDs,
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 62f4a8a..bc0adcd 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6465,22 +6465,11 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
up(&(pstrWFIDrv->gtOsCfgValuesSem));
 
/*TODO Code to setup simulation to be removed later*/
-   /*Intialize configurator module*/
-   s32Error = CoreConfiguratorInit();
-   if (s32Error < 0) {
-   PRINT_ER("Failed to initialize core configurator\n");
-   goto _fail_mem_;
-   }
 
clients_count++; /* increase number of created entities */
 
return s32Error;
 
-
-_fail_mem_:
-   if (pstrWFIDrv != NULL)
-   kfree(pstrWFIDrv);
-   del_timer_sync(&pstrWFIDrv->hRemainOnChannel);
 _fail_timer_2:
up(&(pstrWFIDrv->gtOsCfgValuesSem));
del_timer_sync(&pstrWFIDrv->hConnectTimer);
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 06/16] staging: wilc1000: make mgmt_tx static

2015-09-22 Thread Chaehyun Lim
This patch makes mgmt_tx static. This function is used only at
wilc_wfi_cfgoperation.c file.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0c72c5e..0becefb 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2354,10 +2354,10 @@ void WILC_WFI_add_wilcvendorspec(u8 *buff)
  */
 extern linux_wlan_t *g_linux_wlan;
 extern bool bEnablePS;
-int mgmt_tx(struct wiphy *wiphy,
-   struct wireless_dev *wdev,
-   struct cfg80211_mgmt_tx_params *params,
-   u64 *cookie)
+static int mgmt_tx(struct wiphy *wiphy,
+  struct wireless_dev *wdev,
+  struct cfg80211_mgmt_tx_params *params,
+  u64 *cookie)
 {
struct ieee80211_channel *chan = params->chan;
unsigned int wait = params->wait;
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 03/16] staging: wilc1000: rename WILC_WFI_set_cqm_rssi_config

2015-09-22 Thread Chaehyun Lim
This patch replaces WILC_WFI_set_cqm_rssi_config with
set_cqm_rssi_config to avoid CamelCase.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 58b1481..40fd3ca 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2589,7 +2589,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct 
wireless_dev *wdev,
 }
 
 /**
- *  @brief  WILC_WFI_set_cqm_rssi_config
+ *  @brief  set_cqm_rssi_config
  *  @detailsConfigure connection quality monitor RSSI threshold.
  *  @param[in]   struct wiphy *wiphy:
  *  @param[in] struct net_device *dev:
@@ -2600,8 +2600,8 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct 
wireless_dev *wdev,
  *  @date  01 MAR 2012
  *  @version   1.0
  */
-static intWILC_WFI_set_cqm_rssi_config(struct wiphy *wiphy,
-  struct net_device *dev,  s32 
rssi_thold, u32 rssi_hyst)
+static int set_cqm_rssi_config(struct wiphy *wiphy, struct net_device *dev,
+  s32 rssi_thold, u32 rssi_hyst)
 {
PRINT_D(CFG80211_DBG, "Setting CQM RSSi Function\n");
return 0;
@@ -3402,7 +3402,7 @@ static struct cfg80211_ops wilc_cfg80211_ops = {
.mgmt_tx = mgmt_tx,
.mgmt_frame_register = wilc_mgmt_frame_register,
.set_power_mgmt = set_power_mgmt,
-   .set_cqm_rssi_config = WILC_WFI_set_cqm_rssi_config,
+   .set_cqm_rssi_config = set_cqm_rssi_config,
 
 };
 
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V2 09/16] staging: wilc1000: host_int_init: remove meaningless comment

2015-09-22 Thread Chaehyun Lim
This patch removes meaningless comment in host_int_init function.

Signed-off-by: Chaehyun Lim 
---
v2: rebase latest staging-testing

 drivers/staging/wilc1000/host_interface.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index bc0adcd..317bc60 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -6378,9 +6378,7 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
goto _fail_timer_2;
}
memset(pstrWFIDrv, 0, sizeof(tstrWILC_WFIDrv));
-   /*return driver handle to user*/
*phWFIDrv = pstrWFIDrv;
-   /*save into globl handle*/
err = add_handler_in_list(pstrWFIDrv);
if (err) {
s32Error = -EFAULT;
@@ -6393,7 +6391,6 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
#endif
 
PRINT_D(HOSTINF_DBG, "Global handle pointer value=%p\n", pstrWFIDrv);
-   /* /// */
if (clients_count == 0) {
sema_init(&hSemHostIFthrdEnd, 0);
sema_init(&hSemDeinitDrvHandle, 0);
@@ -6407,7 +6404,6 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
sema_init(&(pstrWFIDrv->hSemGetCHNL), 0);
sema_init(&(pstrWFIDrv->hSemInactiveTime), 0);
 
-   /* /// */
 
 
 
@@ -6464,8 +6460,6 @@ s32 host_int_init(tstrWILC_WFIDrv **phWFIDrv)
 
up(&(pstrWFIDrv->gtOsCfgValuesSem));
 
-   /*TODO Code to setup simulation to be removed later*/
-
clients_count++; /* increase number of created entities */
 
return s32Error;
-- 
2.5.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


  1   2   >