[PATCH] staging: bcm2835-camera: Fix module section mismatch warnings.

2018-05-14 Thread Eric Anholt
Noticed by Stephen Rothwell in -next.

Signed-off-by: Eric Anholt 
Fixes: 4bebb0312ea9 ("staging/bcm2835-camera: Set ourselves up as a platform 
driver.")
Cc: Stephen Rothwell 
---

Note: only compile tested here.

 .../staging/vc04_services/bcm2835-camera/bcm2835-camera.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c 
b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
index 53f33fb3998b..ce26741ae9d9 100644
--- a/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
+++ b/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
@@ -1548,7 +1548,7 @@ static int set_camera_parameters(struct 
vchiq_mmal_instance *instance,
 #define MAX_SUPPORTED_ENCODINGS 20
 
 /* MMAL instance and component init */
-static int __init mmal_init(struct bm2835_mmal_dev *dev)
+static int mmal_init(struct bm2835_mmal_dev *dev)
 {
int ret;
struct mmal_es_format_local *format;
@@ -1756,8 +1756,8 @@ static int __init mmal_init(struct bm2835_mmal_dev *dev)
return ret;
 }
 
-static int __init bm2835_mmal_init_device(struct bm2835_mmal_dev *dev,
- struct video_device *vfd)
+static int bm2835_mmal_init_device(struct bm2835_mmal_dev *dev,
+  struct video_device *vfd)
 {
int ret;
 
@@ -1836,7 +1836,7 @@ static struct v4l2_format default_v4l2_format = {
.fmt.pix.sizeimage = 1024 * 768,
 };
 
-static int __init bcm2835_mmal_probe(struct platform_device *pdev)
+static int bcm2835_mmal_probe(struct platform_device *pdev)
 {
int ret;
struct bm2835_mmal_dev *dev;
-- 
2.17.0

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


Re: [PATCH 14/30] staging: wilc1000: fix line over 80 chars in add_network_to_shadow()

2018-05-14 Thread Claudiu Beznea
Hi Ajay,

On 10.05.2018 08:27, Claudiu Beznea wrote:
> 
> 
> On 09.05.2018 21:42, Ajay Singh wrote:
>> On Wed, 9 May 2018 16:43:14 +0300
>> Claudiu Beznea  wrote:
>>
>>> On 07.05.2018 11:43, Ajay Singh wrote:
 Fix line over 80 characters issue reported by checkpatch in
 add_network_to_shadow() by using temporary variable.  
>>>
>>> I, personally, don't like this way of fixing line over 80. From my
>>> point of view this introduces a new future patch. Maybe, in future,
>>> somebody will remove this temporary variable stating that there is
>>> no need for it.
>>>
>>
>> In my opinion, just by removing this temporary variable the patch
>> might not go through because it will definitely have line over
>> 80 character issue. As per guideline its recommended to run the
>> checkpatch before submitting the patch.
>>
>> Only using short variables names might help to resolve that issue but
>> using short variable names will not give clear meaning for the code. 
>> I  don't want to shorten the variable name as they don't convey the
>> complete meaning.
>>
>> Do you have any suggestion/code which can help to understand how to
>> resolve this without using temp/variables name changes.
> 
> No, for this one I have not. Maybe further refactoring...
> 

Looking over the v2 of this series you send, and over wilc_wfi_cfgoperations.c,
and remembering your last question on this patch, I was thinking that
one suggestion for this would be to replace last_scanned_shadow with
just scanned_shadow or nw_info or scanned_nw_info. Just an idea.

Claudiu

>>

 Signed-off-by: Ajay Singh 
 ---
  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 52
 +++ 1 file changed, 25 insertions(+), 27
 deletions(-)

 diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
 b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index
 f1ebaea..0ae2065 100644 ---
 a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++
 b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -300,6
 +300,7 @@ static void add_network_to_shadow(struct network_info
 *nw_info, int ap_found = is_network_in_shadow(nw_info, user_void);
 u32 ap_index = 0; u8 rssi_index = 0;
 +  struct network_info *shadow_nw_info;
  
if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW)
return;
 @@ -310,37 +311,34 @@ static void add_network_to_shadow(struct
 network_info *nw_info, } else {
ap_index = ap_found;
}
 -  rssi_index =
 last_scanned_shadow[ap_index].rssi_history.index;
 -
 last_scanned_shadow[ap_index].rssi_history.samples[rssi_index++] =
 nw_info->rssi;
 +  shadow_nw_info = &last_scanned_shadow[ap_index];
 +  rssi_index = shadow_nw_info->rssi_history.index;
 +  shadow_nw_info->rssi_history.samples[rssi_index++] =
 nw_info->rssi; if (rssi_index == NUM_RSSI) {
rssi_index = 0;
 -  last_scanned_shadow[ap_index].rssi_history.full =
 true;
 -  }
 -  last_scanned_shadow[ap_index].rssi_history.index =
 rssi_index;
 -  last_scanned_shadow[ap_index].rssi = nw_info->rssi;
 -  last_scanned_shadow[ap_index].cap_info = nw_info->cap_info;
 -  last_scanned_shadow[ap_index].ssid_len = nw_info->ssid_len;
 -  memcpy(last_scanned_shadow[ap_index].ssid,
 - nw_info->ssid, nw_info->ssid_len);
 -  memcpy(last_scanned_shadow[ap_index].bssid,
 - nw_info->bssid, ETH_ALEN);
 -  last_scanned_shadow[ap_index].beacon_period =
 nw_info->beacon_period;
 -  last_scanned_shadow[ap_index].dtim_period =
 nw_info->dtim_period;
 -  last_scanned_shadow[ap_index].ch = nw_info->ch;
 -  last_scanned_shadow[ap_index].ies_len = nw_info->ies_len;
 -  last_scanned_shadow[ap_index].tsf_hi = nw_info->tsf_hi;
 +  shadow_nw_info->rssi_history.full = true;
 +  }
 +  shadow_nw_info->rssi_history.index = rssi_index;
 +  shadow_nw_info->rssi = nw_info->rssi;
 +  shadow_nw_info->cap_info = nw_info->cap_info;
 +  shadow_nw_info->ssid_len = nw_info->ssid_len;
 +  memcpy(shadow_nw_info->ssid, nw_info->ssid,
 nw_info->ssid_len);
 +  memcpy(shadow_nw_info->bssid, nw_info->bssid, ETH_ALEN);
 +  shadow_nw_info->beacon_period = nw_info->beacon_period;
 +  shadow_nw_info->dtim_period = nw_info->dtim_period;
 +  shadow_nw_info->ch = nw_info->ch;
 +  shadow_nw_info->ies_len = nw_info->ies_len;
 +  shadow_nw_info->tsf_hi = nw_info->tsf_hi;
if (ap_found != -1)
 -  kfree(last_scanned_shadow[ap_index].ies);
 -  last_scanned_shadow[ap_index].ies =
 kmalloc(nw_info->ies_len,
 -  GFP_KERNEL);
 -  memcpy(last_scanned_shadow[ap_index].ies,
 - nw_info->ies, nw_info->ies_len);
 -  last_scanned_shadow[ap_index].time_scan = jiffies;
 -  last_scanned_shadow[ap_index].time_scan_cached = jiffies;
>

Re: [PATCH] staging: bcm2835-camera: Fix module section mismatch warnings.

2018-05-14 Thread Greg Kroah-Hartman
On Mon, May 14, 2018 at 08:44:11AM +0100, Eric Anholt wrote:
> Noticed by Stephen Rothwell in -next.
> 
> Signed-off-by: Eric Anholt 
> Fixes: 4bebb0312ea9 ("staging/bcm2835-camera: Set ourselves up as a platform 
> driver.")
> Cc: Stephen Rothwell 

Should be:
Reported-by: Stephen Rothwell 

I'll go fix it by hand...

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


[PATCH] staging: most: video: fix build warnings

2018-05-14 Thread Greg Kroah-Hartman
Commit 7d7cdb4fa552 ("staging: most: video: remove debugging code") ended up
adding a bunch of build warnings about unused variables.  Fix that up by
removing those variables as we don't need them anymore.

Cc: Abdun Nihaal 
Reported-by: Stephen Rothwell 
Fixes: 7d7cdb4fa552 ("staging: most: video: remove debugging code")
Signed-off-by: Greg Kroah-Hartman 

--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -261,9 +261,6 @@ static int vidioc_querycap(struct file *file, void *priv,
 static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
   struct v4l2_fmtdesc *f)
 {
-   struct comp_fh *fh = priv;
-   struct most_video_dev *mdev = fh->mdev;
-
if (f->index)
return -EINVAL;
 
@@ -278,9 +275,6 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void 
*priv,
 static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
 {
-   struct comp_fh *fh = priv;
-   struct most_video_dev *mdev = fh->mdev;
-
comp_set_format_struct(f);
return 0;
 }
@@ -305,9 +299,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void 
*priv,
 
 static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
 {
-   struct comp_fh *fh = priv;
-   struct most_video_dev *mdev = fh->mdev;
-
*norm = V4L2_STD_UNKNOWN;
return 0;
 }
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: video: fix warning unused variable

2018-05-14 Thread Anders Roxell
When building video warnings pops up unused variable 'mdev',
drivers/staging/most/video/video.c: In function ‘vidioc_enum_fmt_vid_cap’:
drivers/staging/most/video/video.c:265:25: warning: unused variable ‘mdev’ 
[-Wunused-variable]
  struct most_video_dev *mdev = fh->mdev;
 ^~~~
drivers/staging/most/video/video.c: In function ‘vidioc_g_fmt_vid_cap’:
drivers/staging/most/video/video.c:282:25: warning: unused variable ‘mdev’ 
[-Wunused-variable]
  struct most_video_dev *mdev = fh->mdev;
 ^~~~
drivers/staging/most/video/video.c: In function ‘vidioc_g_std’:
drivers/staging/most/video/video.c:309:25: warning: unused variable ‘mdev’ 
[-Wunused-variable]
  struct most_video_dev *mdev = fh->mdev;
 ^~~~

Remove the 'mdev' declaration.

Fixes: 7d7cdb4fa552 ("staging: most: video: remove debugging code")
Signed-off-by: Anders Roxell 
---
 drivers/staging/most/video/video.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/staging/most/video/video.c 
b/drivers/staging/most/video/video.c
index fc374711fcc0..cf342eb58e10 100644
--- a/drivers/staging/most/video/video.c
+++ b/drivers/staging/most/video/video.c
@@ -261,9 +261,6 @@ static int vidioc_querycap(struct file *file, void *priv,
 static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
   struct v4l2_fmtdesc *f)
 {
-   struct comp_fh *fh = priv;
-   struct most_video_dev *mdev = fh->mdev;
-
if (f->index)
return -EINVAL;
 
@@ -278,9 +275,6 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void 
*priv,
 static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
 {
-   struct comp_fh *fh = priv;
-   struct most_video_dev *mdev = fh->mdev;
-
comp_set_format_struct(f);
return 0;
 }
@@ -305,9 +299,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void 
*priv,
 
 static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
 {
-   struct comp_fh *fh = priv;
-   struct most_video_dev *mdev = fh->mdev;
-
*norm = V4L2_STD_UNKNOWN;
return 0;
 }
-- 
2.17.0

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


Re: [PATCH] staging: video: fix warning unused variable

2018-05-14 Thread Greg KH
On Mon, May 14, 2018 at 12:54:42PM +0200, Anders Roxell wrote:
> When building video warnings pops up unused variable 'mdev',
> drivers/staging/most/video/video.c: In function ‘vidioc_enum_fmt_vid_cap’:
> drivers/staging/most/video/video.c:265:25: warning: unused variable ‘mdev’ 
> [-Wunused-variable]
>   struct most_video_dev *mdev = fh->mdev;
>  ^~~~
> drivers/staging/most/video/video.c: In function ‘vidioc_g_fmt_vid_cap’:
> drivers/staging/most/video/video.c:282:25: warning: unused variable ‘mdev’ 
> [-Wunused-variable]
>   struct most_video_dev *mdev = fh->mdev;
>  ^~~~
> drivers/staging/most/video/video.c: In function ‘vidioc_g_std’:
> drivers/staging/most/video/video.c:309:25: warning: unused variable ‘mdev’ 
> [-Wunused-variable]
>   struct most_video_dev *mdev = fh->mdev;
>  ^~~~
> 
> Remove the 'mdev' declaration.
> 
> Fixes: 7d7cdb4fa552 ("staging: most: video: remove debugging code")
> Signed-off-by: Anders Roxell 
> ---
>  drivers/staging/most/video/video.c | 9 -
>  1 file changed, 9 deletions(-)

I posted the same exact fix about an hour ago, sorry.

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


Re: [PATCH 14/30] staging: wilc1000: fix line over 80 chars in add_network_to_shadow()

2018-05-14 Thread Ajay Singh
Hi Claudiu,

On Mon, 14 May 2018 11:57:24 +0300
Claudiu Beznea  wrote:

> Hi Ajay,
> 
> On 10.05.2018 08:27, Claudiu Beznea wrote:
> > 
> > 
> > On 09.05.2018 21:42, Ajay Singh wrote:  
> >> On Wed, 9 May 2018 16:43:14 +0300
> >> Claudiu Beznea  wrote:
> >>  
> >>> On 07.05.2018 11:43, Ajay Singh wrote:  
>  Fix line over 80 characters issue reported by checkpatch in
>  add_network_to_shadow() by using temporary variable.
> >>>
> >>> I, personally, don't like this way of fixing line over 80. From my
> >>> point of view this introduces a new future patch. Maybe, in
> >>> future, somebody will remove this temporary variable stating that
> >>> there is no need for it.
> >>>  
> >>
> >> In my opinion, just by removing this temporary variable the patch
> >> might not go through because it will definitely have line over
> >> 80 character issue. As per guideline its recommended to run the
> >> checkpatch before submitting the patch.
> >>
> >> Only using short variables names might help to resolve that issue
> >> but using short variable names will not give clear meaning for the
> >> code. I  don't want to shorten the variable name as they don't
> >> convey the complete meaning.
> >>
> >> Do you have any suggestion/code which can help to understand how to
> >> resolve this without using temp/variables name changes.  
> > 
> > No, for this one I have not. Maybe further refactoring...
> >   
> 
> Looking over the v2 of this series you send, and over
> wilc_wfi_cfgoperations.c, and remembering your last question on this
> patch, I was thinking that one suggestion for this would be to
> replace last_scanned_shadow with just scanned_shadow or nw_info or
> scanned_nw_info. Just an idea.
> 

I avoided use of short name for 'last_scanned_shadow' because it might
not give clear meaning as there are variables like 'last_scanned_cnt',
which also uses same prefix 'last_' and its helpful to know its related
data.


> >>  
> 
>  Signed-off-by: Ajay Singh 
>  ---
>   drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 52
>  +++ 1 file changed, 25 insertions(+), 27
>  deletions(-)
> 
>  diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
>  b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c index
>  f1ebaea..0ae2065 100644 ---
>  a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +++
>  b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c @@ -300,6
>  +300,7 @@ static void add_network_to_shadow(struct network_info
>  *nw_info, int ap_found = is_network_in_shadow(nw_info,
>  user_void); u32 ap_index = 0; u8 rssi_index = 0;
>  +struct network_info *shadow_nw_info;
>   
>   if (last_scanned_cnt >= MAX_NUM_SCANNED_NETWORKS_SHADOW)
>   return;
>  @@ -310,37 +311,34 @@ static void add_network_to_shadow(struct
>  network_info *nw_info, } else {
>   ap_index = ap_found;
>   }
>  -rssi_index =
>  last_scanned_shadow[ap_index].rssi_history.index;
>  -
>  last_scanned_shadow[ap_index].rssi_history.samples[rssi_index++]
>  = nw_info->rssi;
>  +shadow_nw_info = &last_scanned_shadow[ap_index];
>  +rssi_index = shadow_nw_info->rssi_history.index;
>  +shadow_nw_info->rssi_history.samples[rssi_index++] =
>  nw_info->rssi; if (rssi_index == NUM_RSSI) {
>   rssi_index = 0;
>  -last_scanned_shadow[ap_index].rssi_history.full
>  = true;
>  -}
>  -last_scanned_shadow[ap_index].rssi_history.index =
>  rssi_index;
>  -last_scanned_shadow[ap_index].rssi = nw_info->rssi;
>  -last_scanned_shadow[ap_index].cap_info =
>  nw_info->cap_info;
>  -last_scanned_shadow[ap_index].ssid_len =
>  nw_info->ssid_len;
>  -memcpy(last_scanned_shadow[ap_index].ssid,
>  -   nw_info->ssid, nw_info->ssid_len);
>  -memcpy(last_scanned_shadow[ap_index].bssid,
>  -   nw_info->bssid, ETH_ALEN);
>  -last_scanned_shadow[ap_index].beacon_period =
>  nw_info->beacon_period;
>  -last_scanned_shadow[ap_index].dtim_period =
>  nw_info->dtim_period;
>  -last_scanned_shadow[ap_index].ch = nw_info->ch;
>  -last_scanned_shadow[ap_index].ies_len =
>  nw_info->ies_len;
>  -last_scanned_shadow[ap_index].tsf_hi = nw_info->tsf_hi;
>  +shadow_nw_info->rssi_history.full = true;
>  +}
>  +shadow_nw_info->rssi_history.index = rssi_index;
>  +shadow_nw_info->rssi = nw_info->rssi;
>  +shadow_nw_info->cap_info = nw_info->cap_info;
>  +shadow_nw_info->ssid_len = nw_info->ssid_len;
>  +memcpy(shadow_nw_info->ssid, nw_info->ssid,
>  nw_info->ssid_len);
>  +memcpy(shadow_nw_info->bssid, nw_info->bssid, ETH

Re: [PATCH] staging: bcm2835-camera: Add TODO for removing overlay support

2018-05-14 Thread Greg KH
On Fri, May 11, 2018 at 01:12:44AM +0200, Stefan Schake wrote:
> The overlay code is non-functional since it relies on firmware control
> of the HVS.
> 
> Signed-off-by: Stefan Schake 
> ---
> Dave, does this match your understanding?

This doesn't apply to my tree, can you rebase and resend?

thanks,

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


Re: [PATCH 00/14] staging: clocking-wizard: Implement many TODOs

2018-05-14 Thread Greg Kroah-Hartman
On Mon, May 07, 2018 at 11:20:26AM +1000, James Kelly wrote:
> This series of patches attempts to implement many of the outstanding TODOs
> for the Xilinx Clocking Wizard IP driver that has been languishing in the
> staging tree for some time.  I had a need for this driver so I thought it
> appropriate to give it some love.  Hopefully others will find these patches
> useful.
> 
> Highlights include:
> - Support for fractional ratios when available in hardware.
> - Support for clk_round_rate and clk_set_rate kernel APIs.
> - Automatic set rate of internal clocks when rate of output clock is set.
> - Automatic set rate of input clock and internal clocks when rate of 
>   output clock is set.
> 
> A CCF clock provider has been implemented within the driver to support
> the new functionality as it was not possible to do this with the existing
> clock providers.  There is also code to handle a limitation of Clocking
> Wizard IP which prevents changes to the clock ratios if the PLL is not
> locked.  Great care has to be taken to ensure the PLL will always lock as
> there is no way for the driver to recover if the PLL fails to lock under
> transient conditions that may drive the PLL VCO frequency out of range.
> 
> The patches were built on the current staging-next branch.
> 
> The patches also work with the xlnx_rebase_v4.14 branch of the Xilinx
> linux tree at https://github.com/Xilinx/linux-xlnx.git - this branch is
> used by the current release (2018.1) of the Xilinx development tools.
> Patches corresponding to the following staging tree commits are required as
> prerequisites before applying this patch series to xlnx_rebase_v4.14:
> 
> 667063acb81931e2f8fd0cb91df9fcccad131d9a 
> regmap: add iopoll-like polling macro for regmap_field
> 1dbb3344d9e9cd6e72da23f4058f3e6e926614b6 
> staging: clocking-wizard: add SPDX identifier
> 09956d59bad5f5bb238efb805f0767060e624378 
> staging: clocking-wizard: remove redundant license text
> a08f06bb7a0743a7fc8d571899c93d882468096e 
> seq_file: Introduce DEFINE_SHOW_ATTRIBUTE() helper macro
> 
> Testing has been done on a Digilent Zybo-Z7 development board.  This uses a
> 32-bit ARM architecture Zynq-7020 SoC. Testing used the 2018.1 release of
> the Xilinx development tools which has v6.0 of the Clocking Wizard IP.
> 
> The patches are also applicable to, but are currently untested on:
> - 64-bit ARM architecture (Zynq Ultrascale+ MPSoC etc.)
> - Microblaze architecture (7-Series, Ultrascale, Ultrascale+ FPGAs)
> Others with access to suitable hardware will need to test these platforms.
> 
> Potential users of this driver may use the Xilinx device tree generator
> from https://github.com/Xilinx/device-tree-xlnx.git either directly or via
> the development tools provided by Xilinx.  There are two issues with the
> DTG that any potential testers of these patches should be aware of:
> - The DTG generates a negative value for the device-tree speed-grade
>   property.  The 7th patch has a hack to handle this quirk until Xilinx
>   fix their DTG.
> - The 2018.1 DTG changed the device-tree clock-output-names property so
>   it no longer provides any information about how the Clocking Wizard IP
>   is actually configured.  These patches will still work with the new
>   2018.1 DTG behaviour but the names of the output clocks will no longer
>   match those used in the Clocking Wizard IP customization, and the
>   maximum number of clocks will always be created even if not used or
>   FPGA.  A warning will also be issued stating that there are too many
>   clock output names.  Further details can be found in the Xilinx Community
>   forums at https://bit.ly/2jmFIRf.
> 
> The original driver author appears to have left Xilinx so I have not
> included them as an addressee for these patches and instead directed
> them to another Xilinx Linux maintainer.

Can you please fix up the issues reported in this series, rebase on my
latest tree, and resend so that I can apply them?

thanks,

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


Re: [PATCH] ANDROID: binder: remove 32-bit binder interface.

2018-05-14 Thread Christoph Hellwig
On Fri, May 11, 2018 at 09:57:52AM +0200, Martijn Coenen wrote:
> On Sat, May 5, 2018 at 2:10 PM, kbuild test robot  wrote:
> >drivers/android/binder.o: In function `binder_thread_write':
> >>> binder.c:(.text+0x6a16): undefined reference to `__get_user_bad'
> 
> Looks like m68k doesn't support 64-bit get_user(). I could just have
> binder depend on !CONFIG_M68K, but there may be other architectures
> still that don't support this. Another alternative would be to
> whitelist the architectures Android supports - eg arm, arm64, x86,
> x86_64. But I'm not sure if arch-limited drivers are considered bad
> form. Does anybody have suggestions for how to deal with this?

The proper fix is to just support 640bit get/put_user on m68k instead
of working around this.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/4] staging: Few fixes for the mt7621-eth driver

2018-05-14 Thread Dan Carpenter
On Mon, May 07, 2018 at 08:38:29AM +1000, NeilBrown wrote:
> 
> Thanks for these.  Unfortunately you didn't cc me on the individual
> patches so I had to go and look in the online archive.

Btw, these days everyone uses git so get_maintainer.pl picks you as a
maintainer but you should add yourself to the MAINTAINERS file as well.

regards,
dan carpenter

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


Re: [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks

2018-05-14 Thread Dan Carpenter
On Sun, May 06, 2018 at 03:03:00PM -0700, Nathan Chancellor wrote:
> uwrq is an unsigned 32-bit integer, it cannot be less than zero.
> 
> Signed-off-by: Nathan Chancellor 
> ---
>  drivers/staging/ks7010/ks_wlan_net.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
> b/drivers/staging/ks7010/ks_wlan_net.c
> index e96477937f65..0c83d6fe270f 100644
> --- a/drivers/staging/ks7010/ks_wlan_net.c
> +++ b/drivers/staging/ks7010/ks_wlan_net.c
> @@ -1928,7 +1928,7 @@ static int ks_wlan_set_beacon_lost(struct net_device 
> *dev,
>   if (priv->sleep_mode == SLP_SLEEP)
>   return -EPERM;
>   /* for SLEEP MODE */
> - if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX)
> + if (*uwrq > BEACON_LOST_COUNT_MAX)

I believe Smatch is supposed to ignore this sort of code because
comparing "if (foo < 0 || foo > max) " is pretty readable and idiomatic.

Presumably this was so we could redefine BEACON_LOST_COUNT_MIN, but it's
fine to unused code.  The define isn't needed at all, so you can
delete that as well.

regards,
dan carpenter

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


Re: [PATCH 2/6] staging: android: Clean up license identifiers

2018-05-14 Thread Dan Carpenter
On Sun, May 06, 2018 at 06:13:24PM -0700, Nathan Chancellor wrote:
> Add the identifiers when missing and fix the ones already present
> according to checkpatch.pl.
> 
> Signed-off-by: Nathan Chancellor 
> ---
>  drivers/staging/android/ashmem.h|  6 +-
>  drivers/staging/android/uapi/ashmem.h   |  6 +-
>  drivers/staging/android/uapi/vsoc_shm.h | 10 +-
>  drivers/staging/android/vsoc.c  | 11 +--
>  4 files changed, 4 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/staging/android/ashmem.h 
> b/drivers/staging/android/ashmem.h
> index 60d7208f110a..1a478173cd21 100644
> --- a/drivers/staging/android/ashmem.h
> +++ b/drivers/staging/android/ashmem.h
> @@ -1,13 +1,9 @@
> -// SPDX-License-Identifier: (GPL-2.0 OR Apache-2.0)
> +/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */


// was correct for SPDX headers.


regards,
dan carpenter

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


Re: [PATCH 3/6] staging: android: vsoc: Fix ending '(' warnings in function defintions

2018-05-14 Thread Dan Carpenter
I hate this checkpatch warning...  The original is often superior to the
modified versions we see.

regards,
dan carpenter

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


Re: [PATCH 01/14] staging: clocking-wizard: Add principles of operation

2018-05-14 Thread Dan Carpenter
On Fri, May 11, 2018 at 08:04:01AM +0200, Michal Simek wrote:
> 
> There are some double spaces in the text without any reason.
> 

Are you talking about two spaces after a period??  Kernel style guide
has no official position on this.  It's up to the author.

regards,
dan carpenter

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


Re: [PATCH 03/14] staging: clocking-wizard: Split probe function

2018-05-14 Thread Dan Carpenter
On Mon, May 07, 2018 at 11:20:29AM +1000, James Kelly wrote:
> +static int clk_wzrd_probe(struct platform_device *pdev)
> +{
> + int ret;
> + struct device *dev = &pdev->dev;
> +
> + ret = clk_wzrd_get_device_tree_data(dev);
> + if (ret)
> + return ret;
> +
> + ret = clk_wzrd_regmap_alloc(dev);
> + if (ret)
> + return ret;
> +
> + ret = clk_wzrd_register_ccf(dev);
> + if (ret)
> + return ret;
> +
> + return 0;

The error handling is a terrible layer violation now...  Every
allocation function should have a matching free function.  But now
instead of that if clk_wzrd_register_ccf() fails then it starts cleaning
up the clk_wzrd->axi_clk that was allocated in
clk_wzrd_get_device_tree_data().

regards,
dan carpenter


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


Re: [PATCH 2/6] staging: android: Clean up license identifiers

2018-05-14 Thread Greg Kroah-Hartman
On Mon, May 14, 2018 at 04:29:45PM +0300, Dan Carpenter wrote:
> On Sun, May 06, 2018 at 06:13:24PM -0700, Nathan Chancellor wrote:
> > Add the identifiers when missing and fix the ones already present
> > according to checkpatch.pl.
> > 
> > Signed-off-by: Nathan Chancellor 
> > ---
> >  drivers/staging/android/ashmem.h|  6 +-
> >  drivers/staging/android/uapi/ashmem.h   |  6 +-
> >  drivers/staging/android/uapi/vsoc_shm.h | 10 +-
> >  drivers/staging/android/vsoc.c  | 11 +--
> >  4 files changed, 4 insertions(+), 29 deletions(-)
> > 
> > diff --git a/drivers/staging/android/ashmem.h 
> > b/drivers/staging/android/ashmem.h
> > index 60d7208f110a..1a478173cd21 100644
> > --- a/drivers/staging/android/ashmem.h
> > +++ b/drivers/staging/android/ashmem.h
> > @@ -1,13 +1,9 @@
> > -// SPDX-License-Identifier: (GPL-2.0 OR Apache-2.0)
> > +/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */
> 
> 
> // was correct for SPDX headers.

Not for .h files, as per the documentation.  Sorry, I got this wrong the
first time around.

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


Re: [PATCH 2/6] staging: android: Clean up license identifiers

2018-05-14 Thread Justin Skists

> On 14 May 2018 at 14:29 Dan Carpenter  wrote:
> 
> 
> On Sun, May 06, 2018 at 06:13:24PM -0700, Nathan Chancellor wrote:
> > Add the identifiers when missing and fix the ones already present
> > according to checkpatch.pl.
> > 
> > Signed-off-by: Nathan Chancellor 
> > ---
> >  drivers/staging/android/ashmem.h|  6 +-
> >  drivers/staging/android/uapi/ashmem.h   |  6 +-
> >  drivers/staging/android/uapi/vsoc_shm.h | 10 +-
> >  drivers/staging/android/vsoc.c  | 11 +--
> >  4 files changed, 4 insertions(+), 29 deletions(-)
> > 
> > diff --git a/drivers/staging/android/ashmem.h 
> > b/drivers/staging/android/ashmem.h
> > index 60d7208f110a..1a478173cd21 100644
> > --- a/drivers/staging/android/ashmem.h
> > +++ b/drivers/staging/android/ashmem.h
> > @@ -1,13 +1,9 @@
> > -// SPDX-License-Identifier: (GPL-2.0 OR Apache-2.0)
> > +/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */
> 
> 
> // was correct for SPDX headers.

Sorry, header files use the /* ... */ format. :)

https://elixir.bootlin.com/linux/v4.17-rc5/source/Documentation/process/license-rules.rst


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


Re: [PATCH] ANDROID: binder: remove 32-bit binder interface.

2018-05-14 Thread Geert Uytterhoeven
Hi Christoph,

On Mon, May 14, 2018 at 2:03 PM, Christoph Hellwig  wrote:
> On Fri, May 11, 2018 at 09:57:52AM +0200, Martijn Coenen wrote:
>> On Sat, May 5, 2018 at 2:10 PM, kbuild test robot  wrote:
>> >drivers/android/binder.o: In function `binder_thread_write':
>> >>> binder.c:(.text+0x6a16): undefined reference to `__get_user_bad'
>>
>> Looks like m68k doesn't support 64-bit get_user(). I could just have
>> binder depend on !CONFIG_M68K, but there may be other architectures
>> still that don't support this. Another alternative would be to
>> whitelist the architectures Android supports - eg arm, arm64, x86,
>> x86_64. But I'm not sure if arch-limited drivers are considered bad
>> form. Does anybody have suggestions for how to deal with this?
>
> The proper fix is to just support 640bit get/put_user on m68k instead

I hope we'll never need 640bit support in {get,put}_user() ;-)

> of working around this.

Patch sent.

BTW, sh also doesn't seem to have 64-bit get_user().
There may be others.

BTW2, does the Android Binder need to care about endianness when talking
to userspace?

Gr{oetje,eeting}s,

Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/5] staging: mt7621-gpio: some driver cleanups

2018-05-14 Thread Sergio Paracuellos
The following patch series fix all remaining checkpatch complains
about this driver. Changes have not been tested and also compiled
but it should not have any problem about them.

Sergio Paracuellos (5):
  staging: mt7621-gpio: fix some warnings because of lines exceded 80
characters
  staging: mt7621-gpio: add SPDX identifier
  dt-bindings: add compatible string for 'mtk' MediaTek
  dt-bindings: gpio: add documentation for mt7621-gpio
  staging: mt7621-gpio: remove device tree related stuff from TODO file

 .../devicetree/bindings/gpio/mtk,mt7621-gpio.txt   | 51 ++
 .../devicetree/bindings/vendor-prefixes.txt|  1 +
 drivers/staging/mt7621-gpio/TODO   |  1 -
 drivers/staging/mt7621-gpio/gpio-mt7621.c  | 24 +-
 4 files changed, 66 insertions(+), 11 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt

-- 
2.7.4

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


[PATCH 3/5] dt-bindings: add compatible string for 'mtk' MediaTek

2018-05-14 Thread Sergio Paracuellos
There is a complain of checkpatch script about the not documented
DT compatible string for vendor "mtk". Add it to vendor-prefixes.txt
file.

Signed-off-by: Sergio Paracuellos 
---
 Documentation/devicetree/bindings/vendor-prefixes.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.txt 
b/Documentation/devicetree/bindings/vendor-prefixes.txt
index b5f978a..a588a29 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.txt
+++ b/Documentation/devicetree/bindings/vendor-prefixes.txt
@@ -228,6 +228,7 @@ mqmaker mqmaker Inc.
 mscc   Microsemi Corporation
 msiMicro-Star International Co. Ltd.
 mtiImagination Technologies Ltd. (formerly MIPS Technologies Inc.)
+mtkMediaTek
 multi-inno Multi-Inno Technology Co.,Ltd
 mundoreaderMundo Reader S.L.
 murata Murata Manufacturing Co., Ltd.
-- 
2.7.4

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


[PATCH 4/5] dt-bindings: gpio: add documentation for mt7621-gpio

2018-05-14 Thread Sergio Paracuellos
This commit add missing dt bindings documentation for mt7621-gpio
driver. After this checkpatch script complain about this
issue dissapears.

Signed-off-by: Sergio Paracuellos 
---
 .../devicetree/bindings/gpio/mtk,mt7621-gpio.txt   | 51 ++
 1 file changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt

diff --git a/Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt 
b/Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt
new file mode 100644
index 000..5fe4bb5
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt
@@ -0,0 +1,51 @@
+Mediatek SoC GPIO controller bindings
+
+The IP core used inside these SoCs has 3 banks of 32 GPIOs each.
+The registers of all the banks are interwoven inside one single IO range.
+We load one GPIO controller instance per bank. To make this possible
+we support 2 types of nodes. The parent node defines the memory I/O range and
+has 3 children each describing a single bank.
+
+Required properties for the top level node:
+- compatible:
+  - "mtk,mt7621-gpio" for Mediatek controllers
+- reg : Physical base address and length of the controller's registers
+
+Required properties for the GPIO bank node:
+- compatible:
+  - "mtk,mt7621-gpio-bank" for Mediatek banks
+- #gpio-cells : Should be two.
+  - first cell is the pin number
+  - second cell is used to specify optional parameters (unused)
+- gpio-controller : Marks the device node as a GPIO controller
+- reg : The id of the bank that the node describes.
+
+Example:
+   gpio@600 {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   compatible = "mtk,mt7621-gpio";
+   reg = <0x600 0x100>;
+
+   gpio0: bank@0 {
+   reg = <0>;
+   compatible = "mtk,mt7621-gpio-bank";
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
+   gpio1: bank@1 {
+   reg = <1>;
+   compatible = "mtk,mt7621-gpio-bank";
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
+   gpio2: bank@2 {
+   reg = <2>;
+   compatible = "mtk,mt7621-gpio-bank";
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+   };
-- 
2.7.4

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


[PATCH 2/5] staging: mt7621-gpio: add SPDX identifier

2018-05-14 Thread Sergio Paracuellos
It's good to have SPDX identifiers in driver files to make it easier to
audit the kernel tree for correct licenses.

Fix up the one of staging gpio-mt7621 file to have a proper SPDX
identifier, based on the license text in the file itself. The SPDX
identifier is a legally binding shorthand, which can be used instead of
the full boiler plate text.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-gpio/gpio-mt7621.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index a6dcfdf..a577381 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -1,8 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
- *
  * Copyright (C) 2009-2011 Gabor Juhos 
  * Copyright (C) 2013 John Crispin 
  */
-- 
2.7.4

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


[PATCH 1/5] staging: mt7621-gpio: fix some warnings because of lines exceded 80 characters

2018-05-14 Thread Sergio Paracuellos
This patch silence some complains of checkpatch script because
of the use of long lines.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-gpio/gpio-mt7621.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index c9ef936..a6dcfdf 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -65,7 +65,9 @@ mtk_gpio_w32(struct mtk_gc *rg, u8 reg, u32 val)
 static inline u32
 mtk_gpio_r32(struct mtk_gc *rg, u8 reg)
 {
-   return ioread32(mediatek_gpio_membase + (reg * 0x10) + (rg->bank * 
0x4));
+   u32 offset = (reg * 0x10) + (rg->bank * 0x4);
+
+   return ioread32(mediatek_gpio_membase + offset);
 }
 
 static void
@@ -140,7 +142,8 @@ mediatek_gpio_to_irq(struct gpio_chip *chip, unsigned int 
pin)
 {
struct mtk_gc *rg = to_mediatek_gpio(chip);
 
-   return irq_create_mapping(mediatek_gpio_irq_domain, pin + (rg->bank * 
MTK_BANK_WIDTH));
+   return irq_create_mapping(mediatek_gpio_irq_domain,
+ pin + (rg->bank * MTK_BANK_WIDTH));
 }
 
 static int
@@ -197,7 +200,8 @@ mediatek_gpio_irq_handler(struct irq_desc *desc)
pending = mtk_gpio_r32(rg, GPIO_REG_STAT);
 
for_each_set_bit(bit, &pending, MTK_BANK_WIDTH) {
-   u32 map = irq_find_mapping(mediatek_gpio_irq_domain, 
(MTK_BANK_WIDTH * i) + bit);
+   u32 map = irq_find_mapping(mediatek_gpio_irq_domain,
+  (MTK_BANK_WIDTH * i) + bit);
 
generic_handle_irq(map);
mtk_gpio_w32(rg, GPIO_REG_STAT, BIT(bit));
@@ -287,9 +291,11 @@ static struct irq_chip mediatek_gpio_irq_chip = {
 };
 
 static int
-mediatek_gpio_gpio_map(struct irq_domain *d, unsigned int irq, irq_hw_number_t 
hw)
+mediatek_gpio_gpio_map(struct irq_domain *d, unsigned int irq,
+  irq_hw_number_t hw)
 {
-   irq_set_chip_and_handler(irq, &mediatek_gpio_irq_chip, 
handle_level_irq);
+   irq_set_chip_and_handler(irq, &mediatek_gpio_irq_chip,
+handle_level_irq);
irq_set_handler_data(irq, d);
 
return 0;
@@ -324,7 +330,8 @@ mediatek_gpio_probe(struct platform_device *pdev)
mediatek_gpio_bank_probe(pdev, bank);
 
if (mediatek_gpio_irq_domain)
-   irq_set_chained_handler(mediatek_gpio_irq, 
mediatek_gpio_irq_handler);
+   irq_set_chained_handler(mediatek_gpio_irq,
+   mediatek_gpio_irq_handler);
 
return 0;
 }
-- 
2.7.4

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


[PATCH 5/5] staging: mt7621-gpio: remove device tree related stuff from TODO file

2018-05-14 Thread Sergio Paracuellos
Documentation related with device tree and its checkpatch complains
have been added. Update TODO file accordingly.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-gpio/TODO | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/mt7621-gpio/TODO b/drivers/staging/mt7621-gpio/TODO
index 7143905..492dbaa 100644
--- a/drivers/staging/mt7621-gpio/TODO
+++ b/drivers/staging/mt7621-gpio/TODO
@@ -1,5 +1,4 @@
 
 - general code review and clean up
-- ensure device-tree requirements are documented
 
 Cc:  NeilBrown 
-- 
2.7.4

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


[PATCH] staging: ks7010: Remove unused define

2018-05-14 Thread Nathan Chancellor
After commit 6d6612deaf55 ("staging: ks7010: Remove unnecessary limit
checks"), this define is not used anywhere. Remove it as well.

Suggested-by: Dan Carpenter 
Signed-off-by: Nathan Chancellor 
---
 drivers/staging/ks7010/ks_wlan.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks_wlan.h b/drivers/staging/ks7010/ks_wlan.h
index 655f1e3a2157..cd2ae8871aaa 100644
--- a/drivers/staging/ks7010/ks_wlan.h
+++ b/drivers/staging/ks7010/ks_wlan.h
@@ -33,7 +33,6 @@ struct ks_wlan_parameter {
u8 preamble;
u8 power_mgmt;
u32 scan_type;
-#define BEACON_LOST_COUNT_MIN 0
 #define BEACON_LOST_COUNT_MAX 65535
u32 beacon_lost_count;
u32 rts;
-- 
2.17.0

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


Re: [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks

2018-05-14 Thread Nathan Chancellor
On Mon, May 14, 2018 at 04:17:36PM +0300, Dan Carpenter wrote:
> On Sun, May 06, 2018 at 03:03:00PM -0700, Nathan Chancellor wrote:
> > uwrq is an unsigned 32-bit integer, it cannot be less than zero.
> > 
> > Signed-off-by: Nathan Chancellor 
> > ---
> >  drivers/staging/ks7010/ks_wlan_net.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
> > b/drivers/staging/ks7010/ks_wlan_net.c
> > index e96477937f65..0c83d6fe270f 100644
> > --- a/drivers/staging/ks7010/ks_wlan_net.c
> > +++ b/drivers/staging/ks7010/ks_wlan_net.c
> > @@ -1928,7 +1928,7 @@ static int ks_wlan_set_beacon_lost(struct net_device 
> > *dev,
> > if (priv->sleep_mode == SLP_SLEEP)
> > return -EPERM;
> > /* for SLEEP MODE */
> > -   if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX)
> > +   if (*uwrq > BEACON_LOST_COUNT_MAX)
> 
> I believe Smatch is supposed to ignore this sort of code because
> comparing "if (foo < 0 || foo > max) " is pretty readable and idiomatic.
> 
> Presumably this was so we could redefine BEACON_LOST_COUNT_MIN, but it's
> fine to unused code.  The define isn't needed at all, so you can
> delete that as well.
> 
> regards,
> dan carpenter
> 

Hi Dan,

Thanks for the suggestion, I just sent a patch.

This warning came from GCC as a -Wtype-limit warning. I should have put
that in the commit message to be more clear. I will keep this in mind
for the future if I come across any more checks like this with defines.

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


Re: [PATCH 2/6] staging: android: Clean up license identifiers

2018-05-14 Thread Dan Carpenter
On Mon, May 14, 2018 at 02:52:16PM +0100, Justin Skists wrote:
> 
> > On 14 May 2018 at 14:29 Dan Carpenter  wrote:
> > 
> > 
> > On Sun, May 06, 2018 at 06:13:24PM -0700, Nathan Chancellor wrote:
> > > Add the identifiers when missing and fix the ones already present
> > > according to checkpatch.pl.
> > > 
> > > Signed-off-by: Nathan Chancellor 
> > > ---
> > >  drivers/staging/android/ashmem.h|  6 +-
> > >  drivers/staging/android/uapi/ashmem.h   |  6 +-
> > >  drivers/staging/android/uapi/vsoc_shm.h | 10 +-
> > >  drivers/staging/android/vsoc.c  | 11 +--
> > >  4 files changed, 4 insertions(+), 29 deletions(-)
> > > 
> > > diff --git a/drivers/staging/android/ashmem.h 
> > > b/drivers/staging/android/ashmem.h
> > > index 60d7208f110a..1a478173cd21 100644
> > > --- a/drivers/staging/android/ashmem.h
> > > +++ b/drivers/staging/android/ashmem.h
> > > @@ -1,13 +1,9 @@
> > > -// SPDX-License-Identifier: (GPL-2.0 OR Apache-2.0)
> > > +/* SPDX-License-Identifier: GPL-2.0 OR Apache-2.0 */
> > 
> > 
> > // was correct for SPDX headers.
> 
> Sorry, header files use the /* ... */ format. :)
> 
> https://elixir.bootlin.com/linux/v4.17-rc5/source/Documentation/process/license-rules.rst
> 

Oh.  Huh...  That's fine then.  My bad.

regards,
dan carpenter

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


Re: [PATCH 3/7] staging: ks7010: Remove unnecessary limit checks

2018-05-14 Thread Dan Carpenter
On Mon, May 14, 2018 at 07:06:22AM -0700, Nathan Chancellor wrote:
> On Mon, May 14, 2018 at 04:17:36PM +0300, Dan Carpenter wrote:
> > On Sun, May 06, 2018 at 03:03:00PM -0700, Nathan Chancellor wrote:
> > > uwrq is an unsigned 32-bit integer, it cannot be less than zero.
> > > 
> > > Signed-off-by: Nathan Chancellor 
> > > ---
> > >  drivers/staging/ks7010/ks_wlan_net.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/staging/ks7010/ks_wlan_net.c 
> > > b/drivers/staging/ks7010/ks_wlan_net.c
> > > index e96477937f65..0c83d6fe270f 100644
> > > --- a/drivers/staging/ks7010/ks_wlan_net.c
> > > +++ b/drivers/staging/ks7010/ks_wlan_net.c
> > > @@ -1928,7 +1928,7 @@ static int ks_wlan_set_beacon_lost(struct 
> > > net_device *dev,
> > >   if (priv->sleep_mode == SLP_SLEEP)
> > >   return -EPERM;
> > >   /* for SLEEP MODE */
> > > - if (*uwrq < BEACON_LOST_COUNT_MIN || *uwrq > BEACON_LOST_COUNT_MAX)
> > > + if (*uwrq > BEACON_LOST_COUNT_MAX)
> > 
> > I believe Smatch is supposed to ignore this sort of code because
> > comparing "if (foo < 0 || foo > max) " is pretty readable and idiomatic.
> > 
> > Presumably this was so we could redefine BEACON_LOST_COUNT_MIN, but it's
> > fine to unused code.  The define isn't needed at all, so you can
> > delete that as well.
> > 
> > regards,
> > dan carpenter
> > 
> 
> Hi Dan,
> 
> Thanks for the suggestion, I just sent a patch.
> 
> This warning came from GCC as a -Wtype-limit warning. I should have put
> that in the commit message to be more clear. I will keep this in mind
> for the future if I come across any more checks like this with defines.
> 

Anyway, please delete BEACON_LOST_COUNT_MIN entirely.

regards,
dan carpenter

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


Re: [PATCH 03/14] staging: clocking-wizard: Split probe function

2018-05-14 Thread Dan Carpenter
On Mon, May 14, 2018 at 04:47:26PM +0300, Dan Carpenter wrote:
> On Mon, May 07, 2018 at 11:20:29AM +1000, James Kelly wrote:
> > +static int clk_wzrd_probe(struct platform_device *pdev)
> > +{
> > +   int ret;
> > +   struct device *dev = &pdev->dev;
> > +
> > +   ret = clk_wzrd_get_device_tree_data(dev);
> > +   if (ret)
> > +   return ret;
> > +
> > +   ret = clk_wzrd_regmap_alloc(dev);
> > +   if (ret)
> > +   return ret;
> > +
> > +   ret = clk_wzrd_register_ccf(dev);
> > +   if (ret)
> > +   return ret;
> > +
> > +   return 0;
> 
> The error handling is a terrible layer violation now...  Every
> allocation function should have a matching free function.  But now
> instead of that if clk_wzrd_register_ccf() fails then it starts cleaning
> up the clk_wzrd->axi_clk that was allocated in
> clk_wzrd_get_device_tree_data().
> 

Oh...  Duh to me.  It's also buggy because clk_wzrd_regmap_alloc() can
fail and then ->axi_clk isn't disabled.

regards,
dan carpenter

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


Coding Style of drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c

2018-05-14 Thread John Whitmore
There were a lot of coding style issues with this file, but I think I've
reduced the number down to mainly line length and CamelCase issues. I've put
it in 13 patches to, hopefully, make it easier to review, and see that I've
made no changes to functionality of the code, (I hope).

John

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


[PATCH 02/13] coding style chages to the switch statements in the file.

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 93 ++
 1 file changed, 44 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 17a720966253..9e596577e544 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -187,38 +187,36 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tPrimary channel = %d\n", 
pHTInfoEle->ControlChl);
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSecondary channel =");
-   switch (pHTInfoEle->ExtChlOffset)
-   {
-   case 0:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n");
-   break;
-   case 1:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n");
-   break;
-   case 2:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. 
Eooro!!!\n");
-   break;
-   case 3:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
-   break;
+   switch (pHTInfoEle->ExtChlOffset) {
+   case 0:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n");
+   break;
+   case 1:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n");
+   break;
+   case 2:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. Eooro!!!\n");
+   break;
+   case 3:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
+   break;
}
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth)?"20Mhz": "40Mhz");
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = ");
-   switch (pHTInfoEle->OptMode)
-   {
-   case 0:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n");
-   break;
-   case 1:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member 
protection mode\n");
-   break;
-   case 2:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open 
protection\n");
-   break;
-   case 3:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n");
-   break;
+   switch (pHTInfoEle->OptMode) {
+   case 0:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n");
+   break;
+   case 1:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member protection 
mode\n");
+   break;
+   case 2:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open 
protection\n");
+   break;
+   case 3:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n");
+   break;
}
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tBasic MCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\
@@ -821,36 +819,33 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, 
u8 *pOperateMCS)
return false;
}
 
-   switch (ieee->mode)
-   {
+   switch (ieee->mode) {
case IEEE_A:
case IEEE_B:
case IEEE_G:
-   //legacy rate routine handled at selectedrate
+   //legacy rate routine handled at selectedrate
 
-   //no MCS rate
-   for(i=0;i<=15;i++){
-   pOperateMCS[i] = 0;
-   }
-   break;
+   //no MCS rate
+   for(i=0;i<=15;i++){
+   pOperateMCS[i] = 0;
+   }
+   break;
 
case IEEE_N_24G://assume CCK rate ok
case IEEE_N_5G:
-   // Legacy part we only use 6, 5.5,2,1 for N_24G and 6 
for N_5G.
-   // Legacy part shall be handled at SelectRateSet().
-
-   //HT part
-   // TODO: may be different if we have different number 
of antenna
-   pOperateMCS[0] &=RATE_ADPT_1SS_MASK;//support MCS 
0~7
-   pOperateMCS[1] &=RATE_ADPT_2SS_MASK;
-   pOperateMCS[3] &=RATE_ADPT_MCS32_MASK;
-   break;
+   // Legacy part we only use 6, 5.5,2,1 for N_24G and 6 for N_5G.
+   // Legacy part shall be handled at SelectRateSet().
 
-   //should never reach here
-   default:
-
-   break;
+   //HT part
+   // TODO: may be different if we have different number of antenna
+   pOperateMCS[0] &=RATE_ADPT_1SS_MASK;//support MCS 0~7
+   pOperateMCS[1] 

[PATCH 01/13] Coding style changes to block comments

2018-05-14 Thread John Whitmore
The file drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c has a lot of
coding style issues, this will be the first of many small patches which clear
up some, if not all, of the problems with the file.

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 319 -
 1 file changed, 183 insertions(+), 136 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index bf7b7122d042..17a720966253 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -42,16 +42,19 @@ static u8 AIRLINK_RALINK[3] = {0x00, 0x18, 0x02};
 //static u8 DLINK_ATHEROS[3] = {0x00, 0x1c, 0xf0};
 static u8 CISCO_BROADCOM[3] = {0x00, 0x17, 0x94};
 
-// 2008/04/01 MH For Cisco G mode RX TP We need to change FW duration. Should 
we put the
-// code in other place??
-//static u8 WIFI_CISCO_G_AP[3] = {0x00, 0x40, 0x96};
-/
+/*
+ * 2008/04/01 MH For Cisco G mode RX TP We need to change FW duration. Should 
we
+ * put the code in other place?? 
+ * static u8 WIFI_CISCO_G_AP[3] = {0x00, 0x40, 0x96};
+ */
+/***
  *function:  This function update default settings in pHTInfo structure
  *   input:  PRT_HIGH_THROUGHPUT   pHTInfo
  *  output:  none
  *  return:  none
  *  notice:  These value need be modified if any changes.
- * 
*/
+ 
***
+ */
 void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -114,14 +117,17 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
 
 
 }
-/
- *function:  This function print out each field on HT capability IE mainly 
from (Beacon/ProbeRsp/AssocReq)
+
+/***
+ *function:  This function print out each field on HT capability IE mainly 
+ *   from (Beacon/ProbeRsp/AssocReq)
  *   input:  u8*   CapIE   //Capability IE to be printed out
  *  u8*TitleString //mainly print out caller function
  *  output:  none
  *  return:  none
  *  notice:  Driver should not print out this message by default.
- * 
*/
+ 
***
+ */
 void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
 {
 
@@ -151,14 +157,17 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
return;
 
 }
-/
- *function:  This function print out each field on HT Information IE mainly 
from (Beacon/ProbeRsp)
+
+/***
+ *function:  This function print out each field on HT Information IE mainly 
+ *   from (Beacon/ProbeRsp)
  *   input:  u8*   InfoIE   //Capability IE to be printed out
  *  u8*TitleString //mainly print out caller function
  *  output:  none
  *  return:  none
  *  notice:  Driver should not print out this message by default.
- * 
*/
+ 
***
+ */
 void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
 {
 
@@ -218,8 +227,8 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
 }
 
 /*
-*  Return: true if station in half n mode and AP supports 40 bw
-*/
+ * Return: true if station in half n mode and AP supports 40 bw
+ */
 static bool IsHTHalfNmode40Bandwidth(struct ieee80211_device *ieee)
 {
boolretValue = false;
@@ -290,14 +299,15 @@ u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 
nMcsRate)
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
 }
 
-/
+/***
  *function:  This function returns current datarate.
  *   input:  struct ieee80211_device*  ieee
  *  u8 nDataRate
  *  output:  none
  *  return:  tx rate
  *  notice:  quite unsure about how to use this function //wb
- * 
*

[PATCH 04/13] coding style corrections, spaces around ', ' characters and removal of blank lines

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 134 +++--
 1 file changed, 42 insertions(+), 92 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 9366b62343af..110fa8ba15db 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -7,28 +7,28 @@ u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0
 
 u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
-u16 MCS_DATA_RATE[2][2][77] =
-   {   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78 ,104, 
156, 208, 234, 260,
-   39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 
312, 416, 468, 520,
-   0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 
182, 182, 208, 156, 195,
-   195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 
234, 208, 234, 260, 260,
-   286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 
390, 429},   // Long GI, 20MHz
-   {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 
173, 231, 260, 289,
-   43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 
231, 347, 462, 520, 578,
-   0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 
202, 202, 231, 173, 217,
-   217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 
260, 231, 260, 289, 289,
-   318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 
433, 477}},  // Short GI, 20MHz
-   {   {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 
216, 324, 432, 486, 540,
-   81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 
432, 648, 864, 972, 1080,
-   12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 
378, 378, 432, 324, 405,
-   405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 
486, 432, 486, 540, 540,
-   594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 
810, 891},   // Long GI, 40MHz
-   {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 
240, 360, 480, 540, 600,
-   90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 
480, 720, 960, 1080, 1200,
-   13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 
420, 420, 480, 360, 450,
-   450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 
540, 480, 540, 600, 600,
-   660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 
900, 990}}   // Short GI, 40MHz
-   };
+u16 MCS_DATA_RATE[2][2][77] = {
+   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 
234, 260,
+39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416, 
468, 520,
+0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182, 182, 
208, 156, 195,
+195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 234, 
208, 234, 260, 260,
+286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 390, 
429},  // Long GI, 20MHz
+   {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 173, 231, 
260, 289,
+43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 231, 347, 
462, 520, 578,
+0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 202, 202, 
231, 173, 217,
+217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 260, 
231, 260, 289, 289,
+318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 433, 
477}   },  // Short GI, 20MHz
+   {   {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 
432, 486, 540,
+81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 
648, 864, 972, 1080,
+12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 378, 
378, 432, 324, 405,
+405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 486, 
432, 486, 540, 540,
+594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 810, 
891},  // Long GI, 40MHz
+   {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 
480, 540, 600,
+90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 
720, 960, 1080, 1200,
+13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 420, 
420, 480, 360, 450,
+450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 540, 
480, 540, 600, 600,
+660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 900, 
990}   }   // Short GI, 40MHz
+};
 
 static u8 UNKNOWN_BORADCOM[3] = {0x00, 0x14, 0xbf};
 static u8 LINKSYSWRT330_LINKSYSWRT300_BROADCOM[3] = {0

[PATCH 03/13] coding style corrections for if statements

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 273 +
 1 file changed, 112 insertions(+), 161 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 9e596577e544..9366b62343af 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -70,7 +70,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
pHTInfo->bRegBW40MHz = 1;
 
// CCK rate support in 40MHz channel
-   if(pHTInfo->bRegBW40MHz)
+   if (pHTInfo->bRegBW40MHz)
pHTInfo->bRegSuppCCK = 1;
else
pHTInfo->bRegSuppCCK = true;
@@ -86,7 +86,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
 
// MIMO Power Save
pHTInfo->SelfMimoPs = 3;// 0: Static Mimo Ps, 1: Dynamic Mimo Ps, 3: No 
Limitation, 2: Reserved(Set to 3 automatically.)
-   if(pHTInfo->SelfMimoPs == 2)
+   if (pHTInfo->SelfMimoPs == 2)
pHTInfo->SelfMimoPs = 3;
// 8190 only. Assign rate operation mode to firmware
ieee->bTxDisableRateFallBack = 0;
@@ -134,14 +134,13 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
static u8   EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
PHT_CAPABILITY_ELE  pCapELE;
 
-   if(!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap)))
-   {
+   if (!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) {
//EWC IE
IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[4]);
-   }else
+   } else {
pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[0]);
-
+   }
IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString );
 
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth)?"20MHz": "20/40MHz");
@@ -174,14 +173,13 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
static u8   EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};  // For 
11n EWC definition, 2007.07.17, by Emily
PHT_INFORMATION_ELE pHTInfoEle;
 
-   if(!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo)))
-   {
+   if (!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo))) {
// Not EWC IE
IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[4]);
-   }else
+   } else {
pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[0]);
-
+   }
 
IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called 
by %s\n", TitleString);
 
@@ -232,13 +230,13 @@ static bool IsHTHalfNmode40Bandwidth(struct 
ieee80211_device *ieee)
boolretValue = false;
PRT_HIGH_THROUGHPUT  pHTInfo = ieee->pHTInfo;
 
-   if(!pHTInfo->bCurrentHTSupport) // wireless is n mode
+   if (!pHTInfo->bCurrentHTSupport)// wireless is n mode
retValue = false;
-   else if(!pHTInfo->bRegBW40MHz)  // station supports 40 bw
+   else if (!pHTInfo->bRegBW40MHz) // station supports 40 bw
retValue = false;
-   else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))  // 
station in half n mode
+   else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // 
station in half n mode
retValue = false;
-   else if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap 
support 40 bw
+   else if (((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap 
support 40 bw
retValue = true;
else
retValue = false;
@@ -251,20 +249,17 @@ static bool IsHTHalfNmodeSGI(struct ieee80211_device 
*ieee, bool is40MHz)
boolretValue = false;
PRT_HIGH_THROUGHPUT  pHTInfo = ieee->pHTInfo;
 
-   if(!pHTInfo->bCurrentHTSupport) // wireless is n mode
+   if (!pHTInfo->bCurrentHTSupport)// wireless is n mode
retValue = false;
-   else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))  // 
station in half n mode
+   else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // 
station in half n mode
retValue = false;
-   else if(is40MHz) // ap support 40 bw
-   {
-   if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) 
// ap support 40 bw short GI
+   else if (is40MHz) { // ap support 40 bw
+   if 
(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) // ap support 40 
bw short GI
retValue = true;
else
retValue = false;
-   }
-   else
-   {
-   if(((PHT_CAPAB

[PATCH 09/13] Coding style, corrected bad indentation of a statement.

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 254d536c21d8..f26b01c56d66 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -344,7 +344,7 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee)
 (memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) 
== 0) ||
 (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3) == 0) ||
 (net->broadcom_cap_exist))
- retValue = true;
+   retValue = true;
else if (net->bssht.bdRT2RTAggregation)
retValue = true;
else
-- 
2.16.3

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


[PATCH 13/13] Coding style, corrected an indentation issue, (use tabs).

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index af6508dfd897..7a765b022f8c 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -769,7 +769,7 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 
*pOperateMCS)
//no MCS rate
for (i = 0; i <= 15; i++)
pOperateMCS[i] = 0;
-   break;
+   break;
 
case IEEE_N_24G://assume CCK rate ok
case IEEE_N_5G:
-- 
2.16.3

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


[PATCH 07/13] Coding style, removal of redundant returns from void functions.

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 13f1eee7d8b1..56cc1192cf9f 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -150,7 +150,6 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMPDU Density = %d\n", 
pCapELE->MPDUDensity);
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\
pCapELE->MCS[1], pCapELE->MCS[2], 
pCapELE->MCS[3], pCapELE->MCS[4]);
-   return;
 }
 
 
/***
@@ -214,7 +213,6 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tBasic MCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\
pHTInfoEle->BasicMSC[1], 
pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3], pHTInfoEle->BasicMSC[4]);
-   return;
 }
 
 /*
@@ -620,7 +618,6 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
 
//Print each field in detail. Driver should not print out this message 
by default
 // HTDebugHTCapability(posHTCap, (u8*)"HTConstructCapability()");
-   return;
 }
 
 
/***
@@ -672,7 +669,6 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
}
//IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, posHTInfo, 
*len - 2);
//HTDebugHTInfo(posHTInfo, "HTConstructInforElement");
-   return;
 }
 
 /*
-- 
2.16.3

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


[PATCH 05/13] Coding style corrections. Added spaces around operators.

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 148 ++---
 1 file changed, 74 insertions(+), 74 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 110fa8ba15db..925a8f313e9f 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -63,8 +63,8 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
//printk("pHTinfo:%p, &pHTinfo:%p, mptr:%p,  offsetof:%x\n", pHTInfo, 
&pHTInfo, __mptr, offsetof(struct ieee80211_device, pHTInfo));
//printk("===>ieee:%p,\n", ieee);
// ShortGI support
-   pHTInfo->bRegShortGI20MHz= 1;
-   pHTInfo->bRegShortGI40MHz= 1;
+   pHTInfo->bRegShortGI20MHz = 1;
+   pHTInfo->bRegShortGI40MHz = 1;
 
// 40MHz channel support
pHTInfo->bRegBW40MHz = 1;
@@ -140,12 +140,12 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
}
IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString);
 
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth)?"20MHz": "20/40MHz");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 20M = %s\n", 
(pCapELE->ShortGI20Mhz)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 40M = %s\n", 
(pCapELE->ShortGI40Mhz)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport TX STBC = %s\n", 
(pCapELE->TxSTBC)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMSDU Size = %s\n", 
(pCapELE->MaxAMSDUSize)?"3839": "7935");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport CCK in 20/40 mode = %s\n", 
(pCapELE->DssCCk)?"YES": "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth) ? "20MHz" : "20/40MHz");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 20M = %s\n", 
(pCapELE->ShortGI20Mhz) ? "YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 40M = %s\n", 
(pCapELE->ShortGI40Mhz) ? "YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport TX STBC = %s\n", 
(pCapELE->TxSTBC) ? "YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMSDU Size = %s\n", 
(pCapELE->MaxAMSDUSize) ? "3839" : "7935");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport CCK in 20/40 mode = %s\n", 
(pCapELE->DssCCk) ? "YES" : "NO");
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMPDU Factor = %d\n", 
pCapELE->MaxRxAMPDUFactor);
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMPDU Density = %d\n", 
pCapELE->MPDUDensity);
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\
@@ -194,7 +194,7 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
break;
}
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth)?"20Mhz": "40Mhz");
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth) ? "20Mhz" : "40Mhz");
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = ");
switch (pHTInfoEle->OptMode) {
@@ -268,21 +268,21 @@ u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee,
u8  nMcsRate)
u8  is40MHz;
u8  isShortGI;
 
-   is40MHz  =  (IsHTHalfNmode40Bandwidth(ieee))?1:0;
-   isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz))? 1:0;
+   is40MHz  =  (IsHTHalfNmode40Bandwidth(ieee)) ? 1 : 0;
+   isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz)) ? 1 : 0;
 
-   return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
+   return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)];
 }
 
 u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
 
-   u8  is40MHz = (pHTInfo->bCurBW40MHz)?1:0;
-   u8  isShortGI = (pHTInfo->bCurBW40MHz)?
-   
((pHTInfo->bCurShortGI40MHz)?1:0):
-   
((pHTInfo->bCurShortGI20MHz)?1:0);
-   return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
+   u8  is40MHz = (pHTInfo->bCurBW40MHz) ? 1 : 0;
+   u8  isShortGI = (pHTInfo->bCurBW40MHz) ?
+   ((pHTInfo->bCurShortGI40MHz) ? 
1 : 0) :
+   ((pHTInfo->bCurShortGI20MHz) ? 
1 : 0);
+   return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)];
 }
 
 
/***
@@ -309,7 +309,7 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
isShortGI = 0;
 
  // nDataRate = nDataRate - 12;
-

[PATCH 11/13] Coding style: corrections to for statements.

2018-05-14 Thread John Whitmore
I few other minor coding style issues.

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 42 ++
 1 file changed, 19 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 25db009e0a37..742eb35ae442 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -547,7 +547,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
u8  EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
 
memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
-   pCapELE = (PHT_CAPABILITY_ELE) &posHTCap[4];
+   pCapELE = (PHT_CAPABILITY_ELE)&posHTCap[4];
} else {
pCapELE = (PHT_CAPABILITY_ELE)posHTCap;
}
@@ -602,7 +602,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) {
int i;
 
-   for(i = 1; i < 16; i++)
+   for (i = 1; i < 16; i++)
pCapELE->MCS[i] = 0;
}
 
@@ -719,7 +719,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
*posRT2RTAgg++ = 0x4c;
*posRT2RTAgg++ = 0x02;
*posRT2RTAgg++ = 0x01;
-   *posRT2RTAgg = 0x10;//*posRT2RTAgg = 0x02;
+   *posRT2RTAgg = 0x10;// *posRT2RTAgg = 0x02;
 
if (ieee->bSupportRemoteWakeUp)
*posRT2RTAgg |= 0x08;//RT_HT_CAP_USE_WOW;
@@ -729,16 +729,14 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
 #ifdef TODO
 #if (HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE)
/*
-   //Emily. If it is required to Ask Realtek AP to send AMPDU during AES 
mode, enable this
-  section of code.
-   if(IS_UNDER_11N_AES_MODE(Adapter))
-   {
-   posRT2RTAgg->Octet[5] |=RT_HT_CAP_USE_AMPDU;
-   }else
-   {
-   posRT2RTAgg->Octet[5] &= 0xfb;
-   }
-   */
+* Emily. If it is required to Ask Realtek AP to send AMPDU during AES
+* mode, enable this section of code.
+*   if(IS_UNDER_11N_AES_MODE(Adapter)) {
+*   posRT2RTAgg->Octet[5] |=RT_HT_CAP_USE_AMPDU;
+*   } else {
+*   posRT2RTAgg->Octet[5] &= 0xfb;
+*   }
+*/
 #else
// Do Nothing
 #endif
@@ -770,7 +768,7 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 
*pOperateMCS)
//legacy rate routine handled at selectedrate
 
//no MCS rate
-   for(i = 0; i <= 15; i++){
+   for (i = 0; i <= 15; i++) {
pOperateMCS[i] = 0;
}
break;
@@ -826,23 +824,21 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter 
can't be null in HTGetHighestMCSRate()\n");
return false;
}
-   for(i = 0; i < 16; i++)
+   for (i = 0; i < 16; i++)
availableMcsRate[i] = pMCSRateSet[i] & pMCSFilter[i];
 
-   for(i = 0; i < 16; i++)
-   {
+   for (i = 0; i < 16; i++) {
if (availableMcsRate[i] != 0)
break;
}
if (i == 16)
return false;
 
-   for(i = 0; i < 16; i++)
+   for (i = 0; i < 16; i++)
{
if (availableMcsRate[i] != 0) {
bitMap = availableMcsRate[i];
-   for(j = 0; j < 8; j++)
-   {
+   for (j = 0; j < 8; j++) {
if ((bitMap % 2) != 0) {
if (HTMcsToDataRate(ieee, (8 * i + j)) 
> HTMcsToDataRate(ieee, mcsRate))
mcsRate = (8 * i + j);
@@ -869,7 +865,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
u8 i = 0;
 
// filter out operational rate set not supported by AP, the length of 
it is 16
-   for(i = 0; i <= 15; i++){
+   for (i = 0; i <= 15; i++) {
pOperateMCS[i] = ieee->Regdot11HTOperationalRateSet[i] & 
pSupportMCS[i];
}
 
@@ -890,7 +886,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
 * For RTL819X, we support only MCS0~15.
 * And also, we do not know how to use MCS32 now.
 */
-   for(i = 2; i <= 15; i++)
+   for (i = 2; i <= 15; i++)
pOperateMCS[i] = 0;
 
return true;
@@ -1016,7 +1012,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
 
// Lanhsin: mark for tmp to avoid deauth by ap from  s3
//if(me

[PATCH 08/13] Coding style, added blank line after declarations.

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 56cc1192cf9f..254d536c21d8 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -331,6 +331,7 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee)
 {
boolretValue = false;
struct ieee80211_network *net = &ieee->current_network;
+
if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
(memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
(memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
@@ -364,6 +365,7 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
struct ieee80211_network *net = &ieee->current_network;
+
if (net->bssht.bdRT2RTAggregation)
pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK;
else if (net->broadcom_cap_exist)
@@ -389,6 +391,7 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
 
IEEE80211_DEBUG(IEEE80211_DL_IOT, "Joseph debug!! IOTPEER: %x\n", 
pHTInfo->IOTPeer);
 }
+
 
/***
  *function:  Check whether driver should declare received rate up to MCS13 only
  *   since some chipset is not good at receiving MCS14~15 frame from
@@ -503,6 +506,7 @@ static u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network 
*network)
 static u8 HTIOTActIsCCDFsync(u8 *PeerMacAddr)
 {
u8  retValue = 0;
+
if ((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3) == 0) ||
(memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) == 0) 
||
(memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) == 0))
@@ -541,6 +545,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
memset(posHTCap, 0, *len);
if (pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC) {
u8  EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
+
memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
pCapELE = (PHT_CAPABILITY_ELE) & posHTCap[4];
} else {
@@ -596,6 +601,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
// For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support 
only MCS0~7.
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) {
int i;
+
for(i = 1; i < 16; i++)
pCapELE->MCS[i] = 0;
}
@@ -636,7 +642,8 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
 void HTConstructInfoElement(struct ieee80211_device *ieee, u8 *posHTInfo, u8 
*len, u8 IsEncrypt)
 {
PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
-   PHT_INFORMATION_ELE pHTInfoEle = 
(PHT_INFORMATION_ELE)posHTInfo;
+   PHT_INFORMATION_ELE pHTInfoEle = (PHT_INFORMATION_ELE)posHTInfo;
+
if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle 
can't be null in HTConstructInfoElement()\n");
return;
@@ -750,6 +757,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
 static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
 {
u8  i;
+
if (pOperateMCS == NULL) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in 
HT_PickMCSRate()\n");
return false;
@@ -813,6 +821,7 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
u8  bitMap;
u8  mcsRate = 0;
u8  availableMcsRate[16];
+
if (pMCSRateSet == NULL || pMCSFilter == NULL) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter 
can't be null in HTGetHighestMCSRate()\n");
return false;
@@ -886,6 +895,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
 
return true;
 }
+
 void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH
Bandwidth, HT_EXTCHNL_OFFSETOffset);
 void HTOnAssocRsp(struct ieee80211_device *ieee)
 {
@@ -1120,6 +1130,7 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
//MCS rate initialized here
{
u8 *RegHTSuppRateSets = &ieee->RegHTSuppRateSet[0];
+
RegHTSuppRateSets[0] = 0xFF;//support MCS 0~7
RegHTSuppRateSets[1] = 0xFF;//support MCS 8~15
RegHTSuppRateSets[4] = 0x01;//support MCS 32
-- 
2.16.3

__

[PATCH 10/13] Coding style: Removal of prohibited spaces.

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index f26b01c56d66..25db009e0a37 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -482,7 +482,7 @@ static u8 HTIOTActIsDisableEDCATurbo(struct 
ieee80211_device *ieee,
 }
 
 
/***
- *function:  Check whether we need to use OFDM to sned MGNT frame for 
+ *function:  Check whether we need to use OFDM to sned MGNT frame for
  *   broadcom AP
  *   input:  struct ieee80211_network *network   //current network we live
  *  output:  none
@@ -547,7 +547,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
u8  EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
 
memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
-   pCapELE = (PHT_CAPABILITY_ELE) & posHTCap[4];
+   pCapELE = (PHT_CAPABILITY_ELE) &posHTCap[4];
} else {
pCapELE = (PHT_CAPABILITY_ELE)posHTCap;
}
@@ -650,7 +650,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
}
 
memset(posHTInfo, 0, *len);
-   if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == 
IW_MODE_MASTER)) { //ap mode is not currently supported
+   if ((ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == 
IW_MODE_MASTER)) { //ap mode is not currently supported
pHTInfoEle->ControlChl  = 
ieee->current_network.channel;
pHTInfoEle->ExtChlOffset= ((!pHT->bRegBW40MHz) 
? HT_EXTCHNL_OFFSET_NO_EXT :

(ieee->current_network.channel <= 6) ?
@@ -968,7 +968,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
 
nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize == 0) ? 3839 : 7935;
 
-   if (pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize )
+   if (pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize)
pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize;
else
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
@@ -1010,7 +1010,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
else
pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
-   if (ieee->pairwise_key_type != KEY_TYPE_NA )
+   if (ieee->pairwise_key_type != KEY_TYPE_NA)
pHTInfo->CurrentMPDUDensity = 7; // 8us
// Force TX AMSDU
 
-- 
2.16.3

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


[PATCH 12/13] Coding style, removal of braces from single statement blocks

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 742eb35ae442..af6508dfd897 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -496,9 +496,8 @@ static u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network 
*network)
// 2008/01/25 MH Judeg if we need to use OFDM to sned MGNT frame for 
broadcom AP.
// 2008/01/28 MH We must prevent that we select null bssid to link.
 
-   if (network->broadcom_cap_exist) {
+   if (network->broadcom_cap_exist)
retValue = 1;
-   }
 
return retValue;
 }
@@ -768,10 +767,9 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 
*pOperateMCS)
//legacy rate routine handled at selectedrate
 
//no MCS rate
-   for (i = 0; i <= 15; i++) {
+   for (i = 0; i <= 15; i++)
pOperateMCS[i] = 0;
-   }
-   break;
+   break;
 
case IEEE_N_24G://assume CCK rate ok
case IEEE_N_5G:
@@ -834,8 +832,7 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
if (i == 16)
return false;
 
-   for (i = 0; i < 16; i++)
-   {
+   for (i = 0; i < 16; i++) {
if (availableMcsRate[i] != 0) {
bitMap = availableMcsRate[i];
for (j = 0; j < 8; j++) {
@@ -865,9 +862,8 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
u8 i = 0;
 
// filter out operational rate set not supported by AP, the length of 
it is 16
-   for (i = 0; i <= 15; i++) {
+   for (i = 0; i <= 15; i++)
pOperateMCS[i] = ieee->Regdot11HTOperationalRateSet[i] & 
pSupportMCS[i];
-   }
 
// TODO: adjust our operational rate set  according to our channel 
bandwidth, STBC and Antenna number
 
-- 
2.16.3

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


[PATCH 06/13] Coding style, removal of redundant braces.

2018-05-14 Thread John Whitmore
Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 925a8f313e9f..13f1eee7d8b1 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -544,7 +544,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
if (pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC) {
u8  EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
-   pCapELE = (PHT_CAPABILITY_ELE) & (posHTCap[4]);
+   pCapELE = (PHT_CAPABILITY_ELE) & posHTCap[4];
} else {
pCapELE = (PHT_CAPABILITY_ELE)posHTCap;
}
@@ -1104,10 +1104,10 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
 
// Initialize all of the parameters related to 11n
-   memset((void *)(&(pHTInfo->SelfHTCap)), 0, sizeof(pHTInfo->SelfHTCap));
-   memset((void *)(&(pHTInfo->SelfHTInfo)), 0, 
sizeof(pHTInfo->SelfHTInfo));
-   memset((void *)(&(pHTInfo->PeerHTCapBuf)), 0, 
sizeof(pHTInfo->PeerHTCapBuf));
-   memset((void *)(&(pHTInfo->PeerHTInfoBuf)), 0, 
sizeof(pHTInfo->PeerHTInfoBuf));
+   memset((void *)(&pHTInfo->SelfHTCap), 0, sizeof(pHTInfo->SelfHTCap));
+   memset((void *)(&pHTInfo->SelfHTInfo), 0, sizeof(pHTInfo->SelfHTInfo));
+   memset((void *)(&pHTInfo->PeerHTCapBuf), 0, 
sizeof(pHTInfo->PeerHTCapBuf));
+   memset((void *)(&pHTInfo->PeerHTInfoBuf), 0, 
sizeof(pHTInfo->PeerHTInfoBuf));
 
pHTInfo->bSwBwInProgress = false;
pHTInfo->ChnlOp = CHNLOP_NONE;
@@ -1123,7 +1123,7 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
 
//MCS rate initialized here
{
-   u8 *RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]);
+   u8 *RegHTSuppRateSets = &ieee->RegHTSuppRateSet[0];
RegHTSuppRateSets[0] = 0xFF;//support MCS 0~7
RegHTSuppRateSets[1] = 0xFF;//support MCS 8~15
RegHTSuppRateSets[4] = 0x01;//support MCS 32
-- 
2.16.3

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


Re: [PATCH 01/13] Coding style changes to block comments

2018-05-14 Thread Greg KH
On Mon, May 14, 2018 at 04:53:06PM +0100, John Whitmore wrote:
> The file drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c has a lot of
> coding style issues, this will be the first of many small patches which clear
> up some, if not all, of the problems with the file.

This isn't a good changelog comment.  It should explain why you are
doing what you are doing, and maybe what, at the very least.  Saying
something will happen in the future isn't good.

Also your subject line should have the subsystem/driver in it, to make
it more obvious.  Something like:
Subject: staging: rtl8192u: fix block comments in rtl819x_HTProc.c

There are thousands of good examples of good changelog comments and
subject lines in the email archives, and in the kernel log itself :)

Please fix this up and redo the whole series and resend.

thanks,

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


Re: [PATCH 02/13] coding style chages to the switch statements in the file.

2018-05-14 Thread Greg KH
On Mon, May 14, 2018 at 04:53:07PM +0100, John Whitmore wrote:
> Signed-off-by: John Whitmore 
> ---
>  .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 93 
> ++
>  1 file changed, 44 insertions(+), 49 deletions(-)

And I can't take patches without any changelog comments at all.

thanks,

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


Re: A few questions about warnings in the ion driver

2018-05-14 Thread Laura Abbott

On 05/07/2018 07:51 AM, Nathan Chancellor wrote:

On Mon, May 07, 2018 at 06:46:23AM -0700, Laura Abbott wrote:

On 05/06/2018 06:43 PM, Nathan Chancellor wrote:

Hi everyone,

I compiled the ion driver with W=1 where I encountered the two following
warnings and I had a couple of questions about solving them.


1.

drivers/staging/android/ion/ion.c: In function ‘ion_dma_buf_begin_cpu_access’:
drivers/staging/android/ion/ion.c:316:8: warning: variable ‘vaddr’ set but not 
used [-Wunused-but-set-variable]

which concerns the following function:

static int ion_dma_buf_begin_cpu_access(struct dma_buf *dmabuf,
  enum dma_data_direction direction)
{
  struct ion_buffer *buffer = dmabuf->priv;
  void *vaddr;
  struct ion_dma_buf_attachment *a;

  /*
   * TODO: Move this elsewhere because we don't always need a vaddr
   */
  if (buffer->heap->ops->map_kernel) {
  mutex_lock(&buffer->lock);
  vaddr = ion_buffer_kmap_get(buffer);
  mutex_unlock(&buffer->lock);
  }

  mutex_lock(&buffer->lock);
  list_for_each_entry(a, &buffer->attachments, list) {
  dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
  direction);
  }
  mutex_unlock(&buffer->lock);

  return 0;
}

Can vaddr be removed and just have ion_buffer_kmap_get remain, since it is 
never used again in the function?



I think a better solution is to check the return value of vaddr
and error out if it fails.



Something like this? I was unsure if -ENOMEM or -EINVAL was a better
error return code in this context.

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index d10b60fe4a29..d1c149bb15c3 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -315,6 +315,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
 struct ion_buffer *buffer = dmabuf->priv;
 void *vaddr;
 struct ion_dma_buf_attachment *a;
+   int ret = 0;

 /*
  * TODO: Move this elsewhere because we don't always need a vaddr
@@ -322,6 +323,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
 if (buffer->heap->ops->map_kernel) {
 mutex_lock(&buffer->lock);
 vaddr = ion_buffer_kmap_get(buffer);
+   if (IS_ERR(vaddr)) {
+   ret = -ENOMEM;


A better practice is to just return the error that's returned

ret = PTR_ERR(vaddr);

Other than that looks okay for submission as a patch.

Thanks,
Laura


+   goto unlock;
+   }
 mutex_unlock(&buffer->lock);
 }

@@ -330,9 +335,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
 dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
 direction);
 }
-   mutex_unlock(&buffer->lock);

-   return 0;
+unlock:
+   mutex_unlock(&buffer->lock);
+   return ret;
  }

  static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,



2.

drivers/staging/android/ion/ion_carveout_heap.c:106:18: warning: no previous 
prototype for ‘ion_carveout_heap_create’ [-Wmissing-prototypes]
drivers/staging/android/ion/ion_chunk_heap.c:111:18: warning: no previous 
prototype for ‘ion_chunk_heap_create’ [-Wmissing-prototypes]

It appears neither of these functions are used since commit 2f87f50b2340
("staging: android: ion: Rework heap registration/enumeration"). Ultimately,
removing the whole file fixes this warning; is there still a need to rework
them or can they be removed?



I'd still like to delete it. I haven't seen anyone come out to re-work it.
That said, I think my preference is still to keep it for now until
we do another round of updates.



Understood, I figured it probably isn't wise to remove stuff in the
middle of a release cycle but hey, never know. I will leave it alone
for now.

Thanks!
Nathan


Thanks for looking at these.

Laura



If any part of this email was formatted incorrectly or could be done better,
please let me know!

Thank you,
Nathan Chancellor





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


RE: [PATCH 1/1] Drivers: hv: vmbus: enable VMBus protocol version 5.0

2018-05-14 Thread Dexuan Cui
> From: devel  On Behalf Of
> Stephen Hemminger
> Sent: Sunday, May 13, 2018 10:24
> > ...
> > @@ -372,6 +400,18 @@ int vmbus_post_msg(void *buffer, size_t buflen,
> bool can_sleep)
> > ...
> > +   hdr = (struct vmbus_channel_message_header *)buffer;
> 
> Hate to pick o the details, but buffer is void * so cast is not necessary 
> here.

Yes, it's unnecessary in C, though it's necessary in C++.

I found the patch went into char-misc 4 hours ago, so it looks we may
as well leave it as is. IMHO an explicit cast is not a bad thing. :-)

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


Re: [PATCH 1/1] Drivers: hv: vmbus: enable VMBus protocol version 5.0

2018-05-14 Thread Stephen Hemminger
On Mon, 14 May 2018 18:14:15 +
Dexuan Cui  wrote:

> > From: devel  On Behalf Of
> > Stephen Hemminger
> > Sent: Sunday, May 13, 2018 10:24  
> > > ...
> > > @@ -372,6 +400,18 @@ int vmbus_post_msg(void *buffer, size_t buflen,  
> > bool can_sleep)  
> > > ...
> > > + hdr = (struct vmbus_channel_message_header *)buffer;  
> > 
> > Hate to pick o the details, but buffer is void * so cast is not necessary 
> > here.  
> 
> Yes, it's unnecessary in C, though it's necessary in C++.
> 
> I found the patch went into char-misc 4 hours ago, so it looks we may
> as well leave it as is. IMHO an explicit cast is not a bad thing. :-)
> 
> Thanks,
> -- Dexuan

Kernel developers like to be concise. In fact there is a smatch script that 
perodically
gets run and more cleanup patches get sent.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android: ion: Check return value of ion_buffer_kmap_get

2018-05-14 Thread Nathan Chancellor
GCC warns that vaddr is set but unused. Check the return value of
ion_buffer_kmap_get to make vaddr useful and make sure everything
is properly configured before beginning a DMA.

Suggested-by: Laura Abbott 
Signed-off-by: Nathan Chancellor 
---
 drivers/staging/android/ion/ion.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index d10b60fe4a29..af682cbde767 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -315,6 +315,7 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
struct ion_buffer *buffer = dmabuf->priv;
void *vaddr;
struct ion_dma_buf_attachment *a;
+   int ret = 0;
 
/*
 * TODO: Move this elsewhere because we don't always need a vaddr
@@ -322,6 +323,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
if (buffer->heap->ops->map_kernel) {
mutex_lock(&buffer->lock);
vaddr = ion_buffer_kmap_get(buffer);
+   if (IS_ERR(vaddr)) {
+   ret = PTR_ERR(vaddr);
+   goto unlock;
+   }
mutex_unlock(&buffer->lock);
}
 
@@ -330,9 +335,10 @@ static int ion_dma_buf_begin_cpu_access(struct dma_buf 
*dmabuf,
dma_sync_sg_for_cpu(a->dev, a->table->sgl, a->table->nents,
direction);
}
-   mutex_unlock(&buffer->lock);
 
-   return 0;
+unlock:
+   mutex_unlock(&buffer->lock);
+   return ret;
 }
 
 static int ion_dma_buf_end_cpu_access(struct dma_buf *dmabuf,
-- 
2.17.0

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


RE: [PATCH 1/1] Drivers: hv: vmbus: enable VMBus protocol version 5.0

2018-05-14 Thread Dexuan Cui
> From: Stephen Hemminger 
> Sent: Monday, May 14, 2018 11:18
> To: Dexuan Cui 
> > > ...
> > > Hate to pick o the details, but buffer is void * so cast is not necessary 
> > > here.
> >
> > Yes, it's unnecessary in C, though it's necessary in C++.
> >
> > I found the patch went into char-misc 4 hours ago, so it looks we may
> > as well leave it as is. IMHO an explicit cast is not a bad thing. :-)
> >
> > Thanks,
> > -- Dexuan
> 
> Kernel developers like to be concise. In fact there is a smatch script that
> perodically  gets run and more cleanup patches get sent.

I checked the "git log" and confimed you're correct: there are a lot of 
patches that removed the cast from "void *". :-)

Then let me post a small patch for this.

-- Dexuan


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


Re: [PATCH 03/14] staging: clocking-wizard: Split probe function

2018-05-14 Thread James Kelly
Dan,

> On 14 May 2018, at 11:47 pm, Dan Carpenter  wrote:
> 
> On Mon, May 07, 2018 at 11:20:29AM +1000, James Kelly wrote:
>> +static int clk_wzrd_probe(struct platform_device *pdev)
>> +{
>> +int ret;
>> +struct device *dev = &pdev->dev;
>> +
>> +ret = clk_wzrd_get_device_tree_data(dev);
>> +if (ret)
>> +return ret;
>> +
>> +ret = clk_wzrd_regmap_alloc(dev);
>> +if (ret)
>> +return ret;
>> +
>> +ret = clk_wzrd_register_ccf(dev);
>> +if (ret)
>> +return ret;
>> +
>> +return 0;
> 
> The error handling is a terrible layer violation now...  Every
> allocation function should have a matching free function.  But now
> instead of that if clk_wzrd_register_ccf() fails then it starts cleaning
> up the clk_wzrd->axi_clk that was allocated in
> clk_wzrd_get_device_tree_data().
> 
> regards,
> dan carpenter
> 
> 

This gets cleaned up in patch 6.  There seemed little point in putting a whole 
lot of
code in patch 3 only to rip it out again in patch 6.  I was trying to keep the 
patches
simple.

I could defer breaking up the probe function until after the changes in patch 6 
?

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


Re: [PATCH 00/14] staging: clocking-wizard: Implement many TODOs

2018-05-14 Thread James Kelly
Greg,


> On 14 May 2018, at 10:02 pm, Greg Kroah-Hartman  
> wrote:
> 
> Can you please fix up the issues reported in this series, rebase on my
> latest tree, and resend so that I can apply them?
> 
> thanks,
> 
> greg k-h

I’m working on a version 2 patch set and will post when it is ready.

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


[PATCH] staging: mt7621-eth: Remove unused variable

2018-05-14 Thread Kamal Heib
Remove unused variable 'condition' which was set but not used.

Signed-off-by: Kamal Heib 
---
 drivers/staging/mt7621-eth/mtk_eth_soc.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
b/drivers/staging/mt7621-eth/mtk_eth_soc.c
index 86209b3d0a0e..2c7a2e666bfb 100644
--- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
+++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
@@ -1194,7 +1194,6 @@ static int mtk_qdma_tx_poll(struct mtk_eth *eth, int 
budget, bool *tx_again)
int total = 0, done[MTK_MAX_DEVS];
unsigned int bytes[MTK_MAX_DEVS];
u32 cpu, dma;
-   static int condition;
int i;
 
memset(done, 0, sizeof(done));
@@ -1219,10 +1218,8 @@ static int mtk_qdma_tx_poll(struct mtk_eth *eth, int 
budget, bool *tx_again)
 
tx_buf = mtk_desc_to_tx_buf(ring, desc);
skb = tx_buf->skb;
-   if (!skb) {
-   condition = 1;
+   if (!skb)
break;
-   }
 
if (skb != (struct sk_buff *)DMA_DUMMY_DESC) {
bytes[mac] += skb->len;
-- 
2.14.3

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


Re: WARNING in ion_buffer_destroy

2018-05-14 Thread Laura Abbott

On 05/09/2018 11:59 PM, Dmitry Vyukov wrote:

On Wed, Jan 10, 2018 at 7:14 PM, Laura Abbott  wrote:

On 01/09/2018 02:58 PM, syzbot wrote:


Hello,

syzkaller hit the following crash on
06d41862286aa7bc634a1dd9e6e7e96f925ef30a
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.
C reproducer is attached
syzkaller reproducer is attached. See https://goo.gl/kgGztJ
for information about syzkaller reproducers


IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+cd8bcd40cb049efa2...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

audit: type=1400 audit(1515538424.230:7): avc:  denied  { map } for
pid=3499 comm="syzkaller239906" path="/root/syzkaller239906633" dev="sda1"
ino=16481 scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=1
WARNING: CPU: 0 PID: 1467 at drivers/staging/android/ion/ion.c:122
ion_buffer_destroy+0xd4/0x190 drivers/staging/android/ion/ion.c:122
Kernel panic - not syncing: panic_on_warn set ...

CPU: 0 PID: 1467 Comm: ion_system_heap Not tainted
4.15.0-rc7-next-20180109+ #92
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
   __dump_stack lib/dump_stack.c:17 [inline]
   dump_stack+0x194/0x257 lib/dump_stack.c:53
   panic+0x1e4/0x41c kernel/panic.c:183
   __warn+0x1dc/0x200 kernel/panic.c:547
   report_bug+0x211/0x2d0 lib/bug.c:184
   fixup_bug.part.11+0x37/0x80 arch/x86/kernel/traps.c:178
   fixup_bug arch/x86/kernel/traps.c:247 [inline]
   do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
   do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
   invalid_op+0x22/0x40 arch/x86/entry/entry_64.S:1079
RIP: 0010:ion_buffer_destroy+0xd4/0x190
drivers/staging/android/ion/ion.c:122
RSP: 0018:8801d3a9fd28 EFLAGS: 00010293
RAX: 8801d39ee700 RBX: 8801c00e57c0 RCX: 8415d2a4
RDX:  RSI: 0001 RDI: 8801d5ada5b8
RBP: 8801d3a9fd50 R08:  R09: 11003a753f8a
R10: 8801d3a9fc18 R11:  R12: 86e4c980
R13: 8801d5ada580 R14: 8801c00e57e0 R15: 0001
   ion_heap_deferred_free+0x290/0x650
drivers/staging/android/ion/ion_heap.c:236
   kthread+0x33c/0x400 kernel/kthread.c:238
   ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:524
Dumping ftrace buffer:
 (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..



This is catching that a buffer was freed with an existing kernel
map still present. The problem is this can easily be triggered from
userspace by calling DMA_BUF_SYNC_START without calling
DMA_BUF_SYNC_END. It's clearly not appropriate for userspace to
be able to trigger a warning so I'll see about switching this to
a pr_warn_once.


Hi Laura,

Any updates on this?



I thought I had sent a fix for this but I guess not. I'll see about
getting one out.

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


[PATCH] staging: speakup: use true/false instead of 1/0

2018-05-14 Thread Samuel Thibault
Signed-off-by: Samuel Thibault 
---
 drivers/staging/speakup/buffers.c |2 +-
 drivers/staging/speakup/main.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/staging/speakup/buffers.c
+++ b/drivers/staging/speakup/buffers.c
@@ -80,7 +80,7 @@ void synth_buffer_add(u16 ch)
/* We have written something to the speech synthesis, so we are not
 * paused any more.
 */
-   spk_paused = 0;
+   spk_paused = false;
 }
 
 u16 synth_buffer_getc(void)
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1784,7 +1784,7 @@ static void speakup_con_update(struct vc
speakup_date(vc);
if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0]) {
synth_printf("%s", spk_str_pause);
-   spk_paused = 1;
+   spk_paused = true;
}
spin_unlock_irqrestore(&speakup_info.spinlock, flags);
 }
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 02/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: space before ', '

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl errors of the type:
ERROR: space prohibited before that ','

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index c116bd895b50..065ede61a3cb 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -8,7 +8,7 @@ u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0
 u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
 u16 MCS_DATA_RATE[2][2][77] = {
-   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78 ,104, 156, 208, 
234, 260,
+   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78, 104, 156, 208, 
234, 260,
 39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416, 
468, 520,
 0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182, 182, 
208, 156, 195,
 195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 234, 
208, 234, 260, 260,
@@ -295,7 +295,7 @@ u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 
nMcsRate)
 u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 nDataRate)
 {
//PRT_HIGH_THROUGHPUT   pHTInfo = ieee->pHTInfo;
-   u16 CCKOFDMRate[12] = {0x02 , 0x04 , 0x0b , 0x16 , 0x0c , 
0x12 , 0x18 , 0x24 , 0x30 , 0x48 , 0x60 , 0x6c};
+   u16 CCKOFDMRate[12] = {0x02, 0x04, 0x0b, 0x16, 0x0c, 0x12, 
0x18, 0x24, 0x30, 0x48, 0x60, 0x6c};
u8  is40MHz = 0;
u8  isShortGI = 0;
 
-- 
2.16.3

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


[PATCH 07/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: correct indentation of switch statements

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl error:
ERROR: switch and case should be at the same indent

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 48 +++---
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index beecdbfe401b..5591cde8a5a0 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -177,35 +177,35 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tPrimary channel = %d\n", 
pHTInfoEle->ControlChl);
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tSecondary channel =");
switch (pHTInfoEle->ExtChlOffset) {
-   case 0:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n");
-   break;
-   case 1:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n");
-   break;
-   case 2:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. 
Eooro!!!\n");
-   break;
-   case 3:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
-   break;
+   case 0:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Not Present\n");
+   break;
+   case 1:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Upper channel\n");
+   break;
+   case 2:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Reserved. Eooro!!!\n");
+   break;
+   case 3:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
+   break;
}
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth) ? "20Mhz" : "40Mhz");
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = ");
switch (pHTInfoEle->OptMode) {
-   case 0:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n");
-   break;
-   case 1:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member 
protection mode\n");
-   break;
-   case 2:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open 
protection\n");
-   break;
-   case 3:
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n");
-   break;
+   case 0:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "No Protection\n");
+   break;
+   case 1:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT non-member protection 
mode\n");
+   break;
+   case 2:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "Suggest to open 
protection\n");
+   break;
+   case 3:
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "HT mixed mode\n");
+   break;
}
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tBasic MCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\
-- 
2.16.3

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


[PATCH 01/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: correct braces

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl errors of the type:
ERROR: that open brace { should be on the previous line

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 197 -
 1 file changed, 70 insertions(+), 127 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index bf7b7122d042..c116bd895b50 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -7,28 +7,28 @@ u8 MCS_FILTER_ALL[16] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 
0xff, 0xff, 0xff, 0
 
 u8 MCS_FILTER_1SS[16] = {0xff, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
-u16 MCS_DATA_RATE[2][2][77] =
-   {   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78 ,104, 
156, 208, 234, 260,
-   39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 
312, 416, 468, 520,
-   0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 
182, 182, 208, 156, 195,
-   195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 
234, 208, 234, 260, 260,
-   286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 
390, 429},   // Long GI, 20MHz
-   {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 
173, 231, 260, 289,
-   43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 
231, 347, 462, 520, 578,
-   0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 
202, 202, 231, 173, 217,
-   217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 
260, 231, 260, 289, 289,
-   318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 
433, 477}},  // Short GI, 20MHz
-   {   {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 
216, 324, 432, 486, 540,
-   81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 
432, 648, 864, 972, 1080,
-   12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 
378, 378, 432, 324, 405,
-   405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 
486, 432, 486, 540, 540,
-   594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 
810, 891},   // Long GI, 40MHz
-   {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 
240, 360, 480, 540, 600,
-   90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 
480, 720, 960, 1080, 1200,
-   13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 
420, 420, 480, 360, 450,
-   450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 
540, 480, 540, 600, 600,
-   660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 
900, 990}}   // Short GI, 40MHz
-   };
+u16 MCS_DATA_RATE[2][2][77] = {
+   {   {13, 26, 39, 52, 78, 104, 117, 130, 26, 52, 78 ,104, 156, 208, 
234, 260,
+39, 78, 117, 234, 312, 351, 390, 52, 104, 156, 208, 312, 416, 
468, 520,
+0, 78, 104, 130, 117, 156, 195, 104, 130, 130, 156, 182, 182, 
208, 156, 195,
+195, 234, 273, 273, 312, 130, 156, 181, 156, 181, 208, 234, 
208, 234, 260, 260,
+286, 195, 234, 273, 234, 273, 312, 351, 312, 351, 390, 390, 
429},  // Long GI, 20MHz
+   {14, 29, 43, 58, 87, 116, 130, 144, 29, 58, 87, 116, 173, 231, 
260, 289,
+43, 87, 130, 173, 260, 347, 390, 433, 58, 116, 173, 231, 347, 
462, 520, 578,
+0, 87, 116, 144, 130, 173, 217, 116, 144, 144, 173, 202, 202, 
231, 173, 217,
+217, 260, 303, 303, 347, 144, 173, 202, 173, 202, 231, 260, 
231, 260, 289, 289,
+318, 217, 260, 303, 260, 303, 347, 390, 347, 390, 433, 433, 
477}   },  // Short GI, 20MHz
+   {   {27, 54, 81, 108, 162, 216, 243, 270, 54, 108, 162, 216, 324, 
432, 486, 540,
+81, 162, 243, 324, 486, 648, 729, 810, 108, 216, 324, 432, 
648, 864, 972, 1080,
+12, 162, 216, 270, 243, 324, 405, 216, 270, 270, 324, 378, 
378, 432, 324, 405,
+405, 486, 567, 567, 648, 270, 324, 378, 324, 378, 432, 486, 
432, 486, 540, 540,
+594, 405, 486, 567, 486, 567, 648, 729, 648, 729, 810, 810, 
891},  // Long GI, 40MHz
+   {30, 60, 90, 120, 180, 240, 270, 300, 60, 120, 180, 240, 360, 
480, 540, 600,
+90, 180, 270, 360, 540, 720, 810, 900, 120, 240, 360, 480, 
720, 960, 1080, 1200,
+13, 180, 240, 300, 270, 360, 450, 240, 300, 300, 360, 420, 
420, 480, 360, 450,
+450, 540, 630, 630, 720, 300, 360, 420, 360, 420, 480, 540, 
480, 540, 600, 600,
+660, 450, 540, 630, 540, 630, 720, 810, 720, 810, 900, 900, 
990}   }   // Short G

[PATCH 03/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: correct space before ')'

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl errors of the type:
ERROR: space prohibited before that close parenthesis ')'

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 065ede61a3cb..d4ab8481ee30 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -122,7 +122,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
  *  return:  none
  *  notice:  Driver should not print out this message by default.
  * 
*/
-void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
+void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
 {
 
static u8   EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
@@ -135,7 +135,7 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString )
}else
pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[0]);
 
-   IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString );
+   IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString);
 
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth)?"20MHz": "20/40MHz");
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 20M = %s\n", 
(pCapELE->ShortGI20Mhz)?"YES": "NO");
@@ -308,17 +308,17 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
isShortGI = 0;
 
  // nDataRate = nDataRate - 12;
-   } else if(nDataRate >=0x20  && nDataRate <= 0x2f ) { //(27, 44)
+   } else if(nDataRate >=0x20  && nDataRate <= 0x2f) { //(27, 44)
is40MHz = 1;
isShortGI = 0;
 
//nDataRate = nDataRate - 28;
-   } else if(nDataRate >= 0x30  && nDataRate <= 0x3f ) { //(43, 60)
+   } else if(nDataRate >= 0x30  && nDataRate <= 0x3f) { //(43, 60)
is40MHz = 0;
isShortGI = 1;
 
//nDataRate = nDataRate - 44;
-   } else if(nDataRate >= 0x40  && nDataRate <= 0x4f ) { //(59, 76)
+   } else if(nDataRate >= 0x40  && nDataRate <= 0x4f) { //(59, 76)
is40MHz = 1;
isShortGI = 1;
 
@@ -373,7 +373,7 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
else if((memcmp(net->bssid, UNKNOWN_BORADCOM, 3)==0) ||
(memcmp(net->bssid, 
LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3)==0)||
(memcmp(net->bssid, 
LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3)==0)||
-   (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0) )
+   (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3)==0))
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
else if((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3)==0) ||
(memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3)==0) ||
@@ -967,7 +967,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
 
nMaxAMSDUSize = (pPeerHTCap->MaxAMSDUSize==0)?3839:7935;
 
-   if(pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize )
+   if(pHTInfo->nAMSDU_MaxSize > nMaxAMSDUSize)
pHTInfo->nCurrent_AMSDU_MaxSize = nMaxAMSDUSize;
else
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
@@ -1011,7 +1011,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
else
pHTInfo->CurrentMPDUDensity = pPeerHTCap->MPDUDensity;
-   if(ieee->pairwise_key_type != KEY_TYPE_NA )
+   if(ieee->pairwise_key_type != KEY_TYPE_NA)
pHTInfo->CurrentMPDUDensity = 7; // 8us
// Force TX AMSDU
 
-- 
2.16.3

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


[PATCH 09/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: removed redundant return statement

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl warning:
WARNING: void function return statements are not generally useful

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 74385b5d2e41..44a3b5a69a48 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -210,7 +210,6 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tBasic MCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pHTInfoEle->BasicMSC[0],\
pHTInfoEle->BasicMSC[1], 
pHTInfoEle->BasicMSC[2], pHTInfoEle->BasicMSC[3], pHTInfoEle->BasicMSC[4]);
-   return;
 }
 
 /*
@@ -669,7 +668,6 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
}
//IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, posHTInfo, 
*len - 2);
//HTDebugHTInfo(posHTInfo, "HTConstructInforElement");
-   return;
 }
 
 /*
-- 
2.16.3

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


[PATCH 04/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: correct spaces around operators

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl errors of the type:
ERROR: spaces required around that...

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 122 ++---
 1 file changed, 61 insertions(+), 61 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index d4ab8481ee30..f66f181e24f2 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -60,8 +60,8 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
//printk("pHTinfo:%p, &pHTinfo:%p, mptr:%p,  offsetof:%x\n", pHTInfo, 
&pHTInfo, __mptr, offsetof(struct ieee80211_device, pHTInfo));
//printk("===>ieee:%p,\n", ieee);
// ShortGI support
-   pHTInfo->bRegShortGI20MHz= 1;
-   pHTInfo->bRegShortGI40MHz= 1;
+   pHTInfo->bRegShortGI20MHz = 1;
+   pHTInfo->bRegShortGI40MHz = 1;
 
// 40MHz channel support
pHTInfo->bRegBW40MHz = 1;
@@ -137,12 +137,12 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
 
IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString);
 
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth)?"20MHz": "20/40MHz");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 20M = %s\n", 
(pCapELE->ShortGI20Mhz)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 40M = %s\n", 
(pCapELE->ShortGI40Mhz)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport TX STBC = %s\n", 
(pCapELE->TxSTBC)?"YES": "NO");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMSDU Size = %s\n", 
(pCapELE->MaxAMSDUSize)?"3839": "7935");
-   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport CCK in 20/40 mode = %s\n", 
(pCapELE->DssCCk)?"YES": "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth) ? "20MHz" : "20/40MHz");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 20M = %s\n", 
(pCapELE->ShortGI20Mhz) ? "YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport Short GI for 40M = %s\n", 
(pCapELE->ShortGI40Mhz) ? "YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport TX STBC = %s\n", 
(pCapELE->TxSTBC) ? "YES" : "NO");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMSDU Size = %s\n", 
(pCapELE->MaxAMSDUSize) ? "3839" : "7935");
+   IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupport CCK in 20/40 mode = %s\n", 
(pCapELE->DssCCk) ? "YES" : "NO");
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMax AMPDU Factor = %d\n", 
pCapELE->MaxRxAMPDUFactor);
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMPDU Density = %d\n", 
pCapELE->MPDUDensity);
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\
@@ -190,7 +190,7 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
IEEE80211_DEBUG(IEEE80211_DL_HT, "Lower Channel\n");
break;
}
-   IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth)?"20Mhz": "40Mhz");
+   IEEE80211_DEBUG(IEEE80211_DL_HT, "\tRecommended channel width = %s\n", 
(pHTInfoEle->RecommemdedTxWidth) ? "20Mhz" : "40Mhz");
 
IEEE80211_DEBUG(IEEE80211_DL_HT, "\tOperation mode for protection = ");
switch (pHTInfoEle->OptMode) {
@@ -266,8 +266,8 @@ u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee,  
u8  nMcsRate)
u8  is40MHz;
u8  isShortGI;
 
-   is40MHz  =  (IsHTHalfNmode40Bandwidth(ieee))?1:0;
-   isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz))? 1:0;
+   is40MHz  =  (IsHTHalfNmode40Bandwidth(ieee)) ? 1 : 0;
+   isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz)) ? 1 : 0;
 
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
 }
@@ -277,10 +277,10 @@ u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 
nMcsRate)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
 
-   u8  is40MHz = (pHTInfo->bCurBW40MHz)?1:0;
-   u8  isShortGI = (pHTInfo->bCurBW40MHz)?
-   
((pHTInfo->bCurShortGI40MHz)?1:0):
-   
((pHTInfo->bCurShortGI20MHz)?1:0);
+   u8  is40MHz = (pHTInfo->bCurBW40MHz) ? 1 : 0;
+   u8  isShortGI = (pHTInfo->bCurBW40MHz) ?
+   ((pHTInfo->bCurShortGI40MHz) ? 
1 : 0) :
+   ((pHTInfo->bCurShortGI20MHz) ? 
1 : 0);
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
 }
 
@@ -308,7 +308,7 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
isShortGI = 0;
 
  // nDataRate = nDataRate - 12;
-   } else if(nDataRate >=0x20  && nDataRate <= 0x2f) { //(27, 44)
+   } e

[PATCH 08/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: correct whitespace style errors

2018-05-14 Thread John Whitmore
Coding style edit to clear the remaining checkpatch.pl errors:
ERROR: trailing whitespace
ERROR: space prohibited after that open parenthesis '('
ERROR: space required before the open brace '{'

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 5591cde8a5a0..74385b5d2e41 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -301,7 +301,7 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
if (nDataRate < 12) {
return CCKOFDMRate[nDataRate];
} else {
-   if (nDataRate >= 0x10 && nDataRate <= 0x1f) {  //if(nDataRate > 
11 && nDataRate < 28 ) 
+   if (nDataRate >= 0x10 && nDataRate <= 0x1f) {  //if(nDataRate > 
11 && nDataRate < 28 )
is40MHz = 0;
isShortGI = 0;
 
@@ -641,7 +641,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
}
 
memset(posHTInfo, 0, *len);
-   if ( (ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == 
IW_MODE_MASTER)) { //ap mode is not currently supported
+   if ((ieee->iw_mode == IW_MODE_ADHOC) || (ieee->iw_mode == 
IW_MODE_MASTER)) { //ap mode is not currently supported
pHTInfoEle->ControlChl  = 
ieee->current_network.channel;
pHTInfoEle->ExtChlOffset= 
((!pHT->bRegBW40MHz) ? HT_EXTCHNL_OFFSET_NO_EXT :

(ieee->current_network.channel <= 6) ?
@@ -867,7 +867,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
u8 i = 0;
 
// filter out operational rate set not supported by AP, the length of 
it is 16
-   for (i = 0; i <= 15; i++){
+   for (i = 0; i <= 15; i++) {
pOperateMCS[i] = 
ieee->Regdot11HTOperationalRateSet[i]&pSupportMCS[i];
}
 
-- 
2.16.3

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


[PATCH 10/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: Added missing blank line after declarations.

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl warnings:
WARNING: Missing a blank line after declarations

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 44a3b5a69a48..3342c9ccec3f 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -331,6 +331,7 @@ bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee)
 {
boolretValue = false;
struct ieee80211_network *net = &ieee->current_network;
+
if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
(memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
(memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
@@ -363,6 +364,7 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
struct ieee80211_network *net = &ieee->current_network;
+
if (net->bssht.bdRT2RTAggregation)
pHTInfo->IOTPeer = HT_IOT_PEER_REALTEK;
else if (net->broadcom_cap_exist)
@@ -495,6 +497,7 @@ static u8 HTIOTActIsMgntUseCCK6M(struct ieee80211_network 
*network)
 static u8 HTIOTActIsCCDFsync(u8 *PeerMacAddr)
 {
u8  retValue = 0;
+
if ((memcmp(PeerMacAddr, UNKNOWN_BORADCOM, 3) == 0) ||
(memcmp(PeerMacAddr, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) == 0) 
||
(memcmp(PeerMacAddr, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) == 0))
@@ -535,6 +538,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
memset(posHTCap, 0, *len);
if (pHT->ePeerHTSpecVer == HT_SPEC_VER_EWC) {
u8  EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
+
memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
pCapELE = (PHT_CAPABILITY_ELE)&(posHTCap[4]);
} else {
@@ -592,6 +596,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
// For RTL819X, if pairwisekey = wep/tkip, ap is ralink, we support 
only MCS0~7.
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) {
int i;
+
for (i = 1; i < 16; i++)
pCapELE->MCS[i] = 0;
}
@@ -634,6 +639,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
 {
PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
PHT_INFORMATION_ELE pHTInfoEle = 
(PHT_INFORMATION_ELE)posHTInfo;
+
if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle 
can't be null in HTConstructInfoElement()\n");
return;
@@ -754,6 +760,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
 static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 *pOperateMCS)
 {
u8  i;
+
if (pOperateMCS == NULL) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in 
HT_PickMCSRate()\n");
return false;
@@ -818,6 +825,7 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
u8  bitMap;
u8  mcsRate = 0;
u8  availableMcsRate[16];
+
if (pMCSRateSet == NULL || pMCSFilter == NULL) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter 
can't be null in HTGetHighestMCSRate()\n");
return false;
@@ -1124,6 +1132,7 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
//MCS rate initialized here
{
u8 *RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]);
+
RegHTSuppRateSets[0] = 0xFF;//support MCS 0~7
RegHTSuppRateSets[1] = 0xFF;//support MCS 8~15
RegHTSuppRateSets[4] = 0x01;//support MCS 32
-- 
2.16.3

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


[PATCH 15/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: Use __func__ instead of hardcoded function name

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl warnings:
WARNING: Prefer using '"%s...", __func__' to using '', this function's 
name, in a string

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 3a636807226e..8a15d1c6bffa 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -536,7 +536,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
//u8 bIsDeclareMCS13;
 
if ((posHTCap == NULL) || (pHT == NULL)) {
-   IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTCap or pHTInfo can't be 
null in HTConstructCapabilityElement()\n");
+   IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTCap or pHTInfo can't be 
null in %s\n", __func__);
return;
}
memset(posHTCap, 0, *len);
@@ -646,7 +646,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
PHT_INFORMATION_ELE pHTInfoEle = 
(PHT_INFORMATION_ELE)posHTInfo;
 
if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) {
-   IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle 
can't be null in HTConstructInfoElement()\n");
+   IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle 
can't be null in %s\n", __func__);
return;
}
 
@@ -712,7 +712,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
 void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 
*posRT2RTAgg, u8 *len)
 {
if (posRT2RTAgg == NULL) {
-   IEEE80211_DEBUG(IEEE80211_DL_ERR, "posRT2RTAgg can't be null in 
HTConstructRT2RTAggElement()\n");
+   IEEE80211_DEBUG(IEEE80211_DL_ERR, "posRT2RTAgg can't be null in 
%s\n", __func__);
return;
}
memset(posRT2RTAgg, 0, *len);
@@ -766,7 +766,7 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 
*pOperateMCS)
u8  i;
 
if (pOperateMCS == NULL) {
-   IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in 
HT_PickMCSRate()\n");
+   IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in 
%s\n", __func__);
return false;
}
 
@@ -831,7 +831,7 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
u8  availableMcsRate[16];
 
if (pMCSRateSet == NULL || pMCSFilter == NULL) {
-   IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter 
can't be null in HTGetHighestMCSRate()\n");
+   IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter 
can't be null in %s\n", __func__);
return false;
}
for (i = 0; i < 16; i++)
@@ -912,7 +912,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
static u8   EWC11NHTInfo[] = {0x00, 0x90, 
0x4c, 0x34};  // For 11n EWC definition, 2007.07.17, by Emily
 
if (!pHTInfo->bCurrentHTSupport) {
-   IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== HTOnAssocRsp(): 
HT_DISABLE\n");
+   IEEE80211_DEBUG(IEEE80211_DL_ERR, "<=== %s: HT_DISABLE\n", 
__func__);
return;
}
IEEE80211_DEBUG(IEEE80211_DL_HT, "===> HTOnAssocRsp_wq(): HT_ENABLE\n");
-- 
2.16.3

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


coding style changes to drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c

2018-05-14 Thread John Whitmore

Second attempt at this commit, apologies for that.

Coding style changes to resolve some of the scripts/checkpatch.pl issues with
the file drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c.

There remain line length and CamelCase issues unresolved in the file.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 17/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: Added blank line after function

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: Please use a blank line after function/struct/union/enum declarations

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 169ab97458bb..9dd025b22ac4 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -112,6 +112,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
pHTInfo->UsbRxFwAggrTimeout = 16; usb rx FW aggregation timeout 
threshold.It's in units of 64us
 #endif
 }
+
 
/
  *function:  This function print out each field on HT capability IE mainly 
from (Beacon/ProbeRsp/AssocReq)
  *   input:  u8*   CapIE   //Capability IE to be printed out
@@ -147,6 +148,7 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
pCapELE->MCS[1], pCapELE->MCS[2], 
pCapELE->MCS[3], pCapELE->MCS[4]);
return;
 }
+
 
/
  *function:  This function print out each field on HT Information IE mainly 
from (Beacon/ProbeRsp)
  *   input:  u8*   InfoIE   //Capability IE to be printed out
@@ -387,6 +389,7 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
 
IEEE80211_DEBUG(IEEE80211_DL_IOT, "Joseph debug!! IOTPEER: %x\n", 
pHTInfo->IOTPeer);
 }
+
 
/***
  *function:  Check whether driver should declare received rate up to MCS13 
only since some chipset is not good
  *  at receiving MCS14~15 frame from some AP.
@@ -625,6 +628,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
 // HTDebugHTCapability(posHTCap, (u8*)"HTConstructCapability()");
return;
 }
+
 
/***
  *function:  Construct  Information Element in Beacon... if HTEnable is turned 
on
  *   input:  struct ieee80211_device*  ieee
@@ -890,6 +894,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
 
return true;
 }
+
 void HTSetConnectBwMode(struct ieee80211_device *ieee, HT_CHANNEL_WIDTH
Bandwidth, HT_EXTCHNL_OFFSETOffset);
 void HTOnAssocRsp(struct ieee80211_device *ieee)
 {
@@ -1130,6 +1135,7 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
RegHTSuppRateSets[4] = 0x01;//support MCS 32
}
 }
+
 
/***
  *function:  initialize Bss HT structure(struct PBSS_HT)
  *   input:  PBSS_HT pBssHT //to be initialized
@@ -1152,6 +1158,7 @@ void HTInitializeBssDesc(PBSS_HT pBssHT)
pBssHT->bdRT2RTAggregation = false;
pBssHT->bdRT2RTLongSlotTime = false;
 }
+
 
/***
  *function:  initialize Bss HT structure(struct PBSS_HT)
  *   input:  struct ieee80211_device   *ieee
-- 
2.16.3

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


[PATCH 24/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: coding style correction of NULL tests

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: Comparison to NULL could be written "!..."

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 86507155a54b..d2a5ce5549d5 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -525,7 +525,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
PHT_CAPABILITY_ELE  pCapELE = NULL;
//u8 bIsDeclareMCS13;
 
-   if ((posHTCap == NULL) || (pHT == NULL)) {
+   if (!posHTCap || !pHT) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTCap or pHTInfo can't be 
null in %s\n", __func__);
return;
}
@@ -630,7 +630,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
PRT_HIGH_THROUGHPUT pHT = ieee->pHTInfo;
PHT_INFORMATION_ELE pHTInfoEle = 
(PHT_INFORMATION_ELE)posHTInfo;
 
-   if ((posHTInfo == NULL) || (pHTInfoEle == NULL)) {
+   if (!posHTInfo || !pHTInfoEle) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "posHTInfo or pHTInfoEle 
can't be null in %s\n", __func__);
return;
}
@@ -695,7 +695,7 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
  */
 void HTConstructRT2RTAggElement(struct ieee80211_device *ieee, u8 
*posRT2RTAgg, u8 *len)
 {
-   if (posRT2RTAgg == NULL) {
+   if (!posRT2RTAgg) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "posRT2RTAgg can't be null in 
%s\n", __func__);
return;
}
@@ -744,7 +744,7 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 
*pOperateMCS)
 {
u8  i;
 
-   if (pOperateMCS == NULL) {
+   if (!pOperateMCS) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "pOperateMCS can't be null in 
%s\n", __func__);
return false;
}
@@ -808,7 +808,7 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
u8  mcsRate = 0;
u8  availableMcsRate[16];
 
-   if (pMCSRateSet == NULL || pMCSFilter == NULL) {
+   if (!pMCSRateSet || !pMCSFilter) {
IEEE80211_DEBUG(IEEE80211_DL_ERR, "pMCSRateSet or pMCSFilter 
can't be null in %s\n", __func__);
return false;
}
-- 
2.16.3

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


[PATCH 16/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: removed blank lines before closing brace

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: Blank lines aren't necessary before a close brace '}'

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 13 -
 1 file changed, 13 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 8a15d1c6bffa..169ab97458bb 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -111,8 +111,6 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
pHTInfo->UsbRxFwAggrPacketNum = 8;
pHTInfo->UsbRxFwAggrTimeout = 16; usb rx FW aggregation timeout 
threshold.It's in units of 64us
 #endif
-
-
 }
 
/
  *function:  This function print out each field on HT capability IE mainly 
from (Beacon/ProbeRsp/AssocReq)
@@ -148,7 +146,6 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\
pCapELE->MCS[1], pCapELE->MCS[2], 
pCapELE->MCS[3], pCapELE->MCS[4]);
return;
-
 }
 
/
  *function:  This function print out each field on HT Information IE mainly 
from (Beacon/ProbeRsp)
@@ -627,7 +624,6 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
//Print each field in detail. Driver should not print out this message 
by default
 // HTDebugHTCapability(posHTCap, (u8*)"HTConstructCapability()");
return;
-
 }
 
/***
  *function:  Construct  Information Element in Beacon... if HTEnable is turned 
on
@@ -746,10 +742,6 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
 
posRT2RTAgg->Length = 6;
 #endif
-
-
-
-
 }
 
 
@@ -797,7 +789,6 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 
*pOperateMCS)
default:
 
break;
-
}
 
return true;
@@ -1064,9 +1055,6 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
// Config current operation mode.
//
pHTInfo->CurrentOpMode = pPeerHTInfo->OptMode;
-
-
-
 }
 
 void HTSetConnectBwModeCallback(struct ieee80211_device *ieee);
@@ -1247,7 +1235,6 @@ void HTResetSelfAndSavePeerSetting(struct 
ieee80211_device *ieee, struct ieee802
 
pHTInfo->IOTAction = 0;
}
-
 }
 
 void HTUpdateSelfAndPeerSetting(struct ieee80211_device *ieee, struct 
ieee80211_network *pNetwork)
-- 
2.16.3

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


[PATCH 18/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: Removed blank lines after opening brace

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 9dd025b22ac4..b138057c619e 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -123,7 +123,6 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
  * 
*/
 void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
 {
-
static u8   EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
PHT_CAPABILITY_ELE  pCapELE;
 
@@ -159,7 +158,6 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
  * 
*/
 void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
 {
-
static u8   EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};  // For 
11n EWC definition, 2007.07.17, by Emily
PHT_INFORMATION_ELE pHTInfoEle;
 
@@ -259,7 +257,6 @@ static bool IsHTHalfNmodeSGI(struct ieee80211_device *ieee, 
bool is40MHz)
 
 u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee, u8  nMcsRate)
 {
-
u8  is40MHz;
u8  isShortGI;
 
@@ -868,7 +865,6 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
 static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 *pSupportMCS,
  u8 *pOperateMCS)
 {
-
u8 i = 0;
 
// filter out operational rate set not supported by AP, the length of 
it is 16
@@ -1146,7 +1142,6 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
  */
 void HTInitializeBssDesc(PBSS_HT pBssHT)
 {
-
pBssHT->bdSupportHT = false;
memset(pBssHT->bdHTCapBuf, 0, sizeof(pBssHT->bdHTCapBuf));
pBssHT->bdHTCapLen = 0;
-- 
2.16.3

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


[PATCH 06/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: correct braces of else statement

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl error:
ERROR: space required after that close brace '}'

And balanced the brace of the same else statement:
CHECK: Unbalanced braces around else statement

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index ed3e3acd78a3..beecdbfe401b 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -132,9 +132,9 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
//EWC IE
IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[4]);
-   }else
+   } else {
pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[0]);
-
+   }
IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called by %s\n", 
TitleString);
 
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tSupported Channel Width = %s\n", 
(pCapELE->ChlWidth) ? "20MHz" : "20/40MHz");
-- 
2.16.3

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


[PATCH 14/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: corrected block comment style

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl warning:
WARNING: Block comments use * on subsequent lines

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 34d319ed5cc5..3a636807226e 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -721,7 +721,7 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
*posRT2RTAgg++ = 0x4c;
*posRT2RTAgg++ = 0x02;
*posRT2RTAgg++ = 0x01;
-   *posRT2RTAgg = 0x10;//*posRT2RTAgg = 0x02;
+   *posRT2RTAgg = 0x10;// *posRT2RTAgg = 0x02;
 
if (ieee->bSupportRemoteWakeUp)
*posRT2RTAgg |= 0x08;//RT_HT_CAP_USE_WOW;
@@ -731,16 +731,14 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
 #ifdef TODO
 #if (HAL_CODE_BASE == RTL8192 && DEV_BUS_TYPE == USB_INTERFACE)
/*
-   //Emily. If it is required to Ask Realtek AP to send AMPDU during AES 
mode, enable this
-  section of code.
-   if(IS_UNDER_11N_AES_MODE(Adapter))
-   {
-   posRT2RTAgg->Octet[5] |=RT_HT_CAP_USE_AMPDU;
-   }else
-   {
-   posRT2RTAgg->Octet[5] &= 0xfb;
-   }
-   */
+* Emily. If it is required to Ask Realtek AP to send AMPDU during AES
+* mode, enable this section of code.
+*if(IS_UNDER_11N_AES_MODE(Adapter)) {
+*posRT2RTAgg->Octet[5] |=RT_HT_CAP_USE_AMPDU;
+*} else {
+*posRT2RTAgg->Octet[5] &= 0xfb;
+*}
+*/
 
 #else
// Do Nothing
-- 
2.16.3

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


[PATCH 19/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: removed extra blank lines

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: Please don't use multiple blank lines

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 24 --
 1 file changed, 24 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index b138057c619e..b076ff66bc8f 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -266,7 +266,6 @@ u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee,  
u8  nMcsRate)
return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
 }
 
-
 u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate)
 {
PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo;
@@ -321,8 +320,6 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
}
 }
 
-
-
 bool IsHTHalfNmodeAPs(struct ieee80211_device *ieee)
 {
boolretValue = false;
@@ -401,7 +398,6 @@ static u8 HTIOTActIsDisableMCS14(struct ieee80211_device 
*ieee, u8 *PeerMacAddr)
return 0;
 }
 
-
 /**
  * Function:   HTIOTActIsDisableMCS15
  *
@@ -514,7 +510,6 @@ void HTResetIOTSetting(
pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
 }
 
-
 
/***
  *function:  Construct Capablility Element in Beacon... if HTEnable is turned 
on
  *   input:  struct ieee80211_device*  ieee
@@ -546,7 +541,6 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
pCapELE = (PHT_CAPABILITY_ELE)posHTCap;
}
 
-
//HT capability info
pCapELE->AdvCoding  = 0; // This feature is not supported 
now!!
if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))
@@ -569,7 +563,6 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
pCapELE->PSMP   = 0; // Do not support now!!
pCapELE->LSigTxopProtect= 0; // Do not support now!!
 
-
//MAC HT parameters info
// TODO: Nedd to take care of this part
IEEE80211_DEBUG(IEEE80211_DL_HT, "TX HT cap/info ele BW=%d 
MaxAMSDUSize:%d DssCCk:%d\n", pCapELE->ChlWidth, pCapELE->MaxAMSDUSize, 
pCapELE->DssCCk);
@@ -605,7 +598,6 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
//Extended HT Capability Info
memset(&pCapELE->ExtHTCapInfo, 0, 2);
 
-
//TXBF Capabilities
memset(pCapELE->TxBFCap, 0, 4);
 
@@ -617,8 +609,6 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
else
*len = 26 + 2;
 
-
-
 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, posHTCap, 
*len -2);
 
//Print each field in detail. Driver should not print out this message 
by default
@@ -667,7 +657,6 @@ void HTConstructInfoElement(struct ieee80211_device *ieee, 
u8 *posHTInfo, u8 *le
 
memset(pHTInfoEle->BasicMSC, 0, 16);
 
-
*len = 22 + 2; //same above
 
} else {
@@ -745,7 +734,6 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
 #endif
 }
 
-
 
/***
  *function:  Pick the right Rate Adaptive table to use
  *   input:  struct ieee80211_device*  ieee
@@ -851,8 +839,6 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
return (mcsRate|0x80);
 }
 
-
-
 /*
  *
  * 1.Filter our operation rate set with AP's rate set
@@ -924,7 +910,6 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
else
pPeerHTInfo = (PHT_INFORMATION_ELE)(pHTInfo->PeerHTInfoBuf);
 
-

// Configurations:

@@ -957,7 +942,6 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
pHTInfo->bCurSuppCCK = pHTInfo->bRegSuppCCK &&
   (pPeerHTCap->DssCCk == 1);
 
-
//
// Config and configure A-MSDU setting
//
@@ -970,7 +954,6 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)
else
pHTInfo->nCurrent_AMSDU_MaxSize = pHTInfo->nAMSDU_MaxSize;
 
-
//
// Config A-MPDU setting
//
@@ -1102,8 +1085,6 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
pHTInfo->CurrentMPDUDensity = pHTInfo->MPDU_Density;
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
 
-
-
// Initialize all of the parameters related to 11n
memset((void *)(&(pHTInfo->SelfHTCap)), 0, sizeof(pHTInfo->SelfHTCap));
memset((void *)(&(pHTInfo->SelfHTInfo)), 0, 
sizeof(pHTInfo->SelfHTInfo));
@@ -1216,7 +1197,6 @@ void HTResetSelfAndSavePeerSetting(struct 
ieee80211_device *ieee, struct ieee802

[PATCH 11/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: corrected block comments

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl Warnings:
WARNING: Block comments should align the * on each line

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 181 +++--
 1 file changed, 97 insertions(+), 84 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 3342c9ccec3f..425ea1279b87 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -213,8 +213,8 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
 }
 
 /*
-*  Return: true if station in half n mode and AP supports 40 bw
-*/
+ * Return: true if station in half n mode and AP supports 40 bw
+ */
 static bool IsHTHalfNmode40Bandwidth(struct ieee80211_device *ieee)
 {
boolretValue = false;
@@ -390,14 +390,15 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
 
IEEE80211_DEBUG(IEEE80211_DL_IOT, "Joseph debug!! IOTPEER: %x\n", 
pHTInfo->IOTPeer);
 }
-/
+/***
  *function:  Check whether driver should declare received rate up to MCS13 
only since some chipset is not good
  *  at receiving MCS14~15 frame from some AP.
  *   input:  struct ieee80211_device*  ieee
  *  u8 *   PeerMacAddr
  *  output:  none
  *  return:  return 1 if driver should declare MCS13 only(otherwise return 0)
-  * 
*/
+ 
***
+ */
 static u8 HTIOTActIsDisableMCS14(struct ieee80211_device *ieee, u8 
*PeerMacAddr)
 {
return 0;
@@ -405,17 +406,17 @@ static u8 HTIOTActIsDisableMCS14(struct ieee80211_device 
*ieee, u8 *PeerMacAddr)
 
 
 /**
-* Function:HTIOTActIsDisableMCS15
-*
-* Overview:Check whether driver should declare capability of receiving 
MCS15
-*
-* Input:
-*  PADAPTERAdapter,
-*
-* Output:  None
-* Return:  true if driver should disable MCS15
-* 2008.04.15   Emily
-*/
+ * Function:   HTIOTActIsDisableMCS15
+ *
+ * Overview:   Check whether driver should declare capability of receiving 
MCS15
+ *
+ * Input:
+ * PADAPTERAdapter,
+ *
+ * Output: None
+ * Return: true if driver should disable MCS15
+ * 2008.04.15  Emily
+ */
 static bool HTIOTActIsDisableMCS15(struct ieee80211_device *ieee)
 {
bool retValue = false;
@@ -442,17 +443,17 @@ static bool HTIOTActIsDisableMCS15(struct 
ieee80211_device *ieee)
 }
 
 /**
-* Function:HTIOTActIsDisableMCSTwoSpatialStream
-*
-* Overview:Check whether driver should declare capability of receiving All 
2 ss packets
-*
-* Input:
-*  PADAPTERAdapter,
-*
-* Output:  None
-* Return:  true if driver should disable all two spatial stream packet
-* 2008.04.21   Emily
-*/
+ * Function:   HTIOTActIsDisableMCSTwoSpatialStream
+ *
+ * Overview:   Check whether driver should declare capability of receiving All 
2 ss packets
+ *
+ * Input:
+ * PADAPTERAdapter,
+ *
+ * Output: None
+ * Return: true if driver should disable all two spatial stream packet
+ * 2008.04.21  Emily
+ */
 static bool HTIOTActIsDisableMCSTwoSpatialStream(struct ieee80211_device *ieee,
 u8 *PeerMacAddr)
 {
@@ -462,25 +463,27 @@ static bool HTIOTActIsDisableMCSTwoSpatialStream(struct 
ieee80211_device *ieee,
return false;
 }
 
-/
+/***
  *function:  Check whether driver should disable EDCA turbo mode
  *   input:  struct ieee80211_device*  ieee
  *  u8*PeerMacAddr
  *  output:  none
  *  return:  return 1 if driver should disable EDCA turbo mode(otherwise 
return 0)
-  * 
*/
+ 
***
+ */
 static u8 HTIOTActIsDisableEDCATurbo(struct ieee80211_device *ieee,
 u8 *PeerMacAddr)
 {  /* default enable EDCA Turbo mode. */
return false;
 }
 
-/
+/***
  *function:  Check whether

[PATCH 13/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: removed redundant braces

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl warning:
WARNING: braces {} are not necessary for single statement blocks

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 0cc3e7f18c53..34d319ed5cc5 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -723,9 +723,8 @@ void HTConstructRT2RTAggElement(struct ieee80211_device 
*ieee, u8 *posRT2RTAgg,
*posRT2RTAgg++ = 0x01;
*posRT2RTAgg = 0x10;//*posRT2RTAgg = 0x02;
 
-   if (ieee->bSupportRemoteWakeUp) {
+   if (ieee->bSupportRemoteWakeUp)
*posRT2RTAgg |= 0x08;//RT_HT_CAP_USE_WOW;
-   }
 
*len = 6 + 2;
return;
@@ -780,9 +779,8 @@ static u8 HT_PickMCSRate(struct ieee80211_device *ieee, u8 
*pOperateMCS)
//legacy rate routine handled at selectedrate
 
//no MCS rate
-   for (i = 0; i <= 15; i++) {
+   for (i = 0; i <= 15; i++)
pOperateMCS[i] = 0;
-   }
break;
 
case IEEE_N_24G://assume CCK rate ok
@@ -881,10 +879,8 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, 
u8 *pSupportMCS,
u8 i = 0;
 
// filter out operational rate set not supported by AP, the length of 
it is 16
-   for (i = 0; i <= 15; i++) {
+   for (i = 0; i <= 15; i++)
pOperateMCS[i] = 
ieee->Regdot11HTOperationalRateSet[i]&pSupportMCS[i];
-   }
-
 
// TODO: adjust our operational rate set  according to our channel 
bandwidth, STBC and Antenna number
 
-- 
2.16.3

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


[PATCH 21/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: corrected indentation

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: Alignment should match open parenthesis

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 0eea1ec1b25f..e92600b26f66 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -363,16 +363,16 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
else if (net->broadcom_cap_exist)
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
else if ((memcmp(net->bssid, UNKNOWN_BORADCOM, 3) == 0) ||
-   (memcmp(net->bssid, 
LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) == 0) ||
-   (memcmp(net->bssid, 
LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) == 0) ||
-   (memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3) == 0))
+(memcmp(net->bssid, LINKSYSWRT330_LINKSYSWRT300_BROADCOM, 3) 
== 0) ||
+(memcmp(net->bssid, LINKSYSWRT350_LINKSYSWRT150_BROADCOM, 3) 
== 0) ||
+(memcmp(net->bssid, NETGEAR834Bv2_BROADCOM, 3) == 0))
pHTInfo->IOTPeer = HT_IOT_PEER_BROADCOM;
else if ((memcmp(net->bssid, BELKINF5D8233V1_RALINK, 3) == 0) ||
-   (memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
-   (memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
-   (memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
-   (memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
-net->ralink_cap_exist)
+(memcmp(net->bssid, BELKINF5D82334V3_RALINK, 3) == 0) ||
+(memcmp(net->bssid, PCI_RALINK, 3) == 0) ||
+(memcmp(net->bssid, EDIMAX_RALINK, 3) == 0) ||
+(memcmp(net->bssid, AIRLINK_RALINK, 3) == 0) ||
+net->ralink_cap_exist)
pHTInfo->IOTPeer = HT_IOT_PEER_RALINK;
else if (net->atheros_cap_exist)
pHTInfo->IOTPeer = HT_IOT_PEER_ATHEROS;
-- 
2.16.3

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


[PATCH 05/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: correct missing space before '('

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl errors of the type:
ERROR: space required before the open parenthesis '('

Signed-off-by: John Whitmore 
---
 .../staging/rtl8192u/ieee80211/rtl819x_HTProc.c| 176 ++---
 1 file changed, 87 insertions(+), 89 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index f66f181e24f2..ed3e3acd78a3 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -67,7 +67,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
pHTInfo->bRegBW40MHz = 1;
 
// CCK rate support in 40MHz channel
-   if(pHTInfo->bRegBW40MHz)
+   if (pHTInfo->bRegBW40MHz)
pHTInfo->bRegSuppCCK = 1;
else
pHTInfo->bRegSuppCCK = true;
@@ -83,7 +83,7 @@ void HTUpdateDefaultSetting(struct ieee80211_device *ieee)
 
// MIMO Power Save
pHTInfo->SelfMimoPs = 3;// 0: Static Mimo Ps, 1: Dynamic Mimo Ps, 3: No 
Limitation, 2: Reserved(Set to 3 automatically.)
-   if(pHTInfo->SelfMimoPs == 2)
+   if (pHTInfo->SelfMimoPs == 2)
pHTInfo->SelfMimoPs = 3;
// 8190 only. Assign rate operation mode to firmware
ieee->bTxDisableRateFallBack = 0;
@@ -128,7 +128,7 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
static u8   EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
PHT_CAPABILITY_ELE  pCapELE;
 
-   if(!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) {
+   if (!memcmp(CapIE, EWC11NHTCap, sizeof(EWC11NHTCap))) {
//EWC IE
IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
pCapELE = (PHT_CAPABILITY_ELE)(&CapIE[4]);
@@ -164,13 +164,13 @@ void HTDebugHTInfo(u8 *InfoIE, u8 *TitleString)
static u8   EWC11NHTInfo[] = {0x00, 0x90, 0x4c, 0x34};  // For 
11n EWC definition, 2007.07.17, by Emily
PHT_INFORMATION_ELE pHTInfoEle;
 
-   if(!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo))) {
+   if (!memcmp(InfoIE, EWC11NHTInfo, sizeof(EWC11NHTInfo))){
// Not EWC IE
IEEE80211_DEBUG(IEEE80211_DL_HT, "EWC IE in %s()\n", __func__);
pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[4]);
-   }else
+   } else {
pHTInfoEle = (PHT_INFORMATION_ELE)(&InfoIE[0]);
-
+   }
 
IEEE80211_DEBUG(IEEE80211_DL_HT, ". Called 
by %s\n", TitleString);
 
@@ -221,13 +221,13 @@ static bool IsHTHalfNmode40Bandwidth(struct 
ieee80211_device *ieee)
boolretValue = false;
PRT_HIGH_THROUGHPUT  pHTInfo = ieee->pHTInfo;
 
-   if(!pHTInfo->bCurrentHTSupport) // wireless is n mode
+   if (!pHTInfo->bCurrentHTSupport)// wireless is n mode
retValue = false;
-   else if(!pHTInfo->bRegBW40MHz)  // station supports 40 bw
+   else if (!pHTInfo->bRegBW40MHz) // station supports 40 bw
retValue = false;
-   else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))  // 
station in half n mode
+   else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // 
station in half n mode
retValue = false;
-   else if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap 
support 40 bw
+   else if (((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ChlWidth) // ap 
support 40 bw
retValue = true;
else
retValue = false;
@@ -240,18 +240,17 @@ static bool IsHTHalfNmodeSGI(struct ieee80211_device 
*ieee, bool is40MHz)
boolretValue = false;
PRT_HIGH_THROUGHPUT  pHTInfo = ieee->pHTInfo;
 
-   if(!pHTInfo->bCurrentHTSupport) // wireless is n mode
+   if (!pHTInfo->bCurrentHTSupport)// wireless is n mode
retValue = false;
-   else if(!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev))  // 
station in half n mode
+   else if (!ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) // 
station in half n mode
retValue = false;
-   else if(is40MHz) { // ap support 40 bw
-   if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) 
// ap support 40 bw short GI
+   else if (is40MHz) { // ap support 40 bw
+   if 
(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI40Mhz) // ap support 40 
bw short GI
retValue = true;
else
retValue = false;
-   }
-   else {
-   if(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI20Mhz) 
// ap support 40 bw short GI
+   } else {
+   if 
(((PHT_CAPABILITY_ELE)(pHTInfo->PeerHTCapBuf))->ShortGI20Mhz) // ap support 40 
bw short GI
   

[PATCH 26/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: Spelling correction in a comment

2018-05-14 Thread John Whitmore
Spelling correction in comment: singal -> signal

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index f9d664890622..833b3574d155 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -858,7 +858,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
// TODO: adjust our operational rate set  according to our channel 
bandwidth, STBC and Antenna number
 
// TODO: fill suggested rate adaptive rate index and give firmware info 
using Tx command packet
-   // we also shall suggested the first start rate set according to our 
singal strength
+   // we also shall suggested the first start rate set according to our 
signal strength
HT_PickMCSRate(ieee, pOperateMCS);
 
// For RTL819X, if pairwisekey = wep/tkip, we support only MCS0~7.
-- 
2.16.3

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


[PATCH 25/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: Added prefered spacing around operators

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: spaces preferred around that 'x'

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index d2a5ce5549d5..f9d664890622 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -826,15 +826,15 @@ u8 HTGetHighestMCSRate(struct ieee80211_device *ieee, u8 
*pMCSRateSet, u8 *pMCSF
if (availableMcsRate[i] != 0) {
bitMap = availableMcsRate[i];
for (j = 0; j < 8; j++) {
-   if ((bitMap%2) != 0) {
-   if (HTMcsToDataRate(ieee, (8*i+j)) > 
HTMcsToDataRate(ieee, mcsRate))
-   mcsRate = (8*i+j);
+   if ((bitMap % 2) != 0) {
+   if (HTMcsToDataRate(ieee, (8 * i + j)) 
> HTMcsToDataRate(ieee, mcsRate))
+   mcsRate = (8 * i + j);
}
bitMap >>= 1;
}
}
}
-   return (mcsRate|0x80);
+   return (mcsRate | 0x80);
 }
 
 /*
@@ -911,7 +911,7 @@ void HTOnAssocRsp(struct ieee80211_device *ieee)

// Configurations:

-   IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTCap, 
sizeof(HT_CAPABILITY_ELE));
+   IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA | IEEE80211_DL_HT, pPeerHTCap, 
sizeof(HT_CAPABILITY_ELE));
 // IEEE80211_DEBUG_DATA(IEEE80211_DL_DATA|IEEE80211_DL_HT, pPeerHTInfo, 
sizeof(HT_INFORMATION_ELE));
// Config Supported Channel Width setting
//
@@ -1045,7 +1045,7 @@ void HTSetConnectBwModeCallback(struct ieee80211_device 
*ieee);
  *   input:  struct ieee80211_device*  ieee
  *  output:  none
  *  return:  none
- *  notice: This function is called when *  (1) MPInitialization Phase 
+ *  notice: This function is called when *  (1) MPInitialization Phase
  *   *  (2) Receiving of Deauthentication 
from AP
  
***
  */
@@ -1312,9 +1312,9 @@ void HTSetConnectBwModeCallback(struct ieee80211_device 
*ieee)
 
if (pHTInfo->bCurBW40MHz) {
if (pHTInfo->CurSTAExtChnlOffset == HT_EXTCHNL_OFFSET_UPPER)
-   ieee->set_chan(ieee->dev, 
ieee->current_network.channel+2);
+   ieee->set_chan(ieee->dev, ieee->current_network.channel 
+ 2);
else if (pHTInfo->CurSTAExtChnlOffset == 
HT_EXTCHNL_OFFSET_LOWER)
-   ieee->set_chan(ieee->dev, 
ieee->current_network.channel-2);
+   ieee->set_chan(ieee->dev, ieee->current_network.channel 
- 2);
else
ieee->set_chan(ieee->dev, 
ieee->current_network.channel);
 
-- 
2.16.3

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


[PATCH 27/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: removed redundant return statement

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl warnings:
WARNING: void function return statements are not generally useful

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 833b3574d155..519601f5bfee 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -145,7 +145,6 @@ void HTDebugHTCapability(u8 *CapIE, u8 *TitleString)
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMPDU Density = %d\n", 
pCapELE->MPDUDensity);
IEEE80211_DEBUG(IEEE80211_DL_HT,  "\tMCS Rate Set = 
[%x][%x][%x][%x][%x]\n", pCapELE->MCS[0],\
pCapELE->MCS[1], pCapELE->MCS[2], 
pCapELE->MCS[3], pCapELE->MCS[4]);
-   return;
 }
 
 
/
@@ -611,7 +610,6 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
 
//Print each field in detail. Driver should not print out this message 
by default
 // HTDebugHTCapability(posHTCap, (u8*)"HTConstructCapability()");
-   return;
 }
 
 
/***
-- 
2.16.3

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


[PATCH 22/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: coding style correction of a function declaration

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: Lines should not end with a '('

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index e92600b26f66..5c45d37a8f0e 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -502,9 +502,7 @@ static u8 HTIOTActIsCCDFsync(u8 *PeerMacAddr)
return retValue;
 }
 
-void HTResetIOTSetting(
-   PRT_HIGH_THROUGHPUT pHTInfo
-)
+void HTResetIOTSetting(PRT_HIGH_THROUGHPUT pHTInfo)
 {
pHTInfo->IOTAction = 0;
pHTInfo->IOTPeer = HT_IOT_PEER_UNKNOWN;
-- 
2.16.3

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


[PATCH 12/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: removed space from start of line

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl warning:
WARNING: please, no spaces at the start of a line

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 425ea1279b87..0cc3e7f18c53 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -402,7 +402,7 @@ static void HTIOTPeerDetermine(struct ieee80211_device 
*ieee)
 static u8 HTIOTActIsDisableMCS14(struct ieee80211_device *ieee, u8 
*PeerMacAddr)
 {
return 0;
- }
+}
 
 
 /**
-- 
2.16.3

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


[PATCH 23/27] drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc: removed unnecessary parentheses

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: Unnecessary parentheses around ...

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index 5c45d37a8f0e..86507155a54b 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -534,7 +534,7 @@ void HTConstructCapabilityElement(struct ieee80211_device 
*ieee, u8 *posHTCap, u
u8  EWC11NHTCap[] = {0x00, 0x90, 0x4c, 0x33};   // For 
11n EWC definition, 2007.07.17, by Emily
 
memcpy(posHTCap, EWC11NHTCap, sizeof(EWC11NHTCap));
-   pCapELE = (PHT_CAPABILITY_ELE)&(posHTCap[4]);
+   pCapELE = (PHT_CAPABILITY_ELE)&posHTCap[4];
} else {
pCapELE = (PHT_CAPABILITY_ELE)posHTCap;
}
@@ -1084,10 +1084,10 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
pHTInfo->CurrentAMPDUFactor = pHTInfo->AMPDU_Factor;
 
// Initialize all of the parameters related to 11n
-   memset((void *)(&(pHTInfo->SelfHTCap)), 0, sizeof(pHTInfo->SelfHTCap));
-   memset((void *)(&(pHTInfo->SelfHTInfo)), 0, 
sizeof(pHTInfo->SelfHTInfo));
-   memset((void *)(&(pHTInfo->PeerHTCapBuf)), 0, 
sizeof(pHTInfo->PeerHTCapBuf));
-   memset((void *)(&(pHTInfo->PeerHTInfoBuf)), 0, 
sizeof(pHTInfo->PeerHTInfoBuf));
+   memset((void *)(&pHTInfo->SelfHTCap), 0, sizeof(pHTInfo->SelfHTCap));
+   memset((void *)(&pHTInfo->SelfHTInfo), 0, sizeof(pHTInfo->SelfHTInfo));
+   memset((void *)(&pHTInfo->PeerHTCapBuf), 0, 
sizeof(pHTInfo->PeerHTCapBuf));
+   memset((void *)(&pHTInfo->PeerHTInfoBuf), 0, 
sizeof(pHTInfo->PeerHTInfoBuf));
 
pHTInfo->bSwBwInProgress = false;
pHTInfo->ChnlOp = CHNLOP_NONE;
@@ -1103,7 +1103,7 @@ void HTInitializeHTInfo(struct ieee80211_device *ieee)
 
//MCS rate initialized here
{
-   u8 *RegHTSuppRateSets = &(ieee->RegHTSuppRateSet[0]);
+   u8 *RegHTSuppRateSets = &ieee->RegHTSuppRateSet[0];
 
RegHTSuppRateSets[0] = 0xFF;//support MCS 0~7
RegHTSuppRateSets[1] = 0xFF;//support MCS 8~15
-- 
2.16.3

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


driverdev-devel@linuxdriverproject.org

2018-05-14 Thread John Whitmore
Coding style edit to clear the checkpatch.pl check:
CHECK: spaces preferred around that '&'

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c 
b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
index b076ff66bc8f..0eea1ec1b25f 100644
--- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
+++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c
@@ -263,7 +263,7 @@ u16 HTHalfMcsToDataRate(struct ieee80211_device *ieee,  
u8  nMcsRate)
is40MHz  =  (IsHTHalfNmode40Bandwidth(ieee)) ? 1 : 0;
isShortGI = (IsHTHalfNmodeSGI(ieee, is40MHz)) ? 1 : 0;
 
-   return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
+   return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)];
 }
 
 u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 nMcsRate)
@@ -274,7 +274,7 @@ u16 HTMcsToDataRate(struct ieee80211_device *ieee, u8 
nMcsRate)
u8  isShortGI = (pHTInfo->bCurBW40MHz) ?
((pHTInfo->bCurShortGI40MHz) ? 
1 : 0) :
((pHTInfo->bCurShortGI20MHz) ? 
1 : 0);
-   return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate&0x7f)];
+   return MCS_DATA_RATE[is40MHz][isShortGI][(nMcsRate & 0x7f)];
 }
 
 
/
@@ -316,7 +316,7 @@ u16  TxCountToDataRate(struct ieee80211_device *ieee, u8 
nDataRate)
 
//nDataRate = nDataRate - 60;
}
-   return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate&0xf];
+   return MCS_DATA_RATE[is40MHz][isShortGI][nDataRate & 0xf];
}
 }
 
@@ -855,7 +855,7 @@ static u8 HTFilterMCSRate(struct ieee80211_device *ieee, u8 
*pSupportMCS,
 
// filter out operational rate set not supported by AP, the length of 
it is 16
for (i = 0; i <= 15; i++)
-   pOperateMCS[i] = 
ieee->Regdot11HTOperationalRateSet[i]&pSupportMCS[i];
+   pOperateMCS[i] = ieee->Regdot11HTOperationalRateSet[i] & 
pSupportMCS[i];
 
// TODO: adjust our operational rate set  according to our channel 
bandwidth, STBC and Antenna number
 
-- 
2.16.3

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


Re: [PATCH] ANDROID: binder: remove 32-bit binder interface.

2018-05-14 Thread Martijn Coenen
On Mon, May 14, 2018 at 4:00 PM, Geert Uytterhoeven
 wrote:
> Patch sent.

Thanks for the quick turn-around!

>
> BTW, sh also doesn't seem to have 64-bit get_user().
> There may be others.

I checked quickly, nios2 is the only other arch that explicitly
doesn't support it and would result in a build error; some other archs
don't define __get_user, but in that case they just fall back to
raw_copy_from_user().

>
> BTW2, does the Android Binder need to care about endianness when talking
> to userspace?

No, I don't think it should.

Thanks,
Martijn

>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android: ion: Switch to pr_warn_once in ion_buffer_destroy

2018-05-14 Thread Laura Abbott
Syzbot reported yet another warning with Ion:

WARNING: CPU: 0 PID: 1467 at drivers/staging/android/ion/ion.c:122
ion_buffer_destroy+0xd4/0x190 drivers/staging/android/ion/ion.c:122
Kernel panic - not syncing: panic_on_warn set ...

This is catching that a buffer was freed with an existing kernel mapping
still present. This can be easily be triggered from userspace by calling
DMA_BUF_SYNC_START without calling DMA_BUF_SYNC_END. Switch to a single
pr_warn_once to indicate the error without being disruptive.

Reported-by: syzbot+cd8bcd40cb049efa2...@syzkaller.appspotmail.com
Reported-by: syzbot 
Signed-off-by: Laura Abbott 
---
 drivers/staging/android/ion/ion.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index e74db7902549..a68329411b29 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -114,8 +114,11 @@ static struct ion_buffer *ion_buffer_create(struct 
ion_heap *heap,
 
 void ion_buffer_destroy(struct ion_buffer *buffer)
 {
-   if (WARN_ON(buffer->kmap_cnt > 0))
+   if (buffer->kmap_cnt > 0) {
+   pr_warn_once("%s: buffer still mapped in the kernel\n",
+__func__);
buffer->heap->ops->unmap_kernel(buffer->heap, buffer);
+   }
buffer->heap->ops->free(buffer);
kfree(buffer);
 }
-- 
2.17.0

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


[PATCH] Drivers: hv: vmbus: Removed an unnecessary cast from void *

2018-05-14 Thread Dexuan Cui

In C, we don't need such a cast.

Fixes: ae20b254306a ("Drivers: hv: vmbus: enable VMBus protocol version 5.0")
Signed-off-by: Dexuan Cui 
Cc: Stephen Hemminger 
Cc: K. Y. Srinivasan 
---

Thanks Stephen Hemminger for pointing this out!

So far, ae20b254306a ("Drivers: hv: vmbus: enable VMBus protocol version 5.0") 
only
appears in the char-misc tree's char-misc-testing and char-misc-next branches. 
If 
possible, please merge both patches into one.

 drivers/hv/connection.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 19e0468..ced0418 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -409,7 +409,7 @@ int vmbus_post_msg(void *buffer, size_t buflen, bool 
can_sleep)
 * HV_STATUS_INVALID_CONNECTION_ID and we should
 * return an error immediately without retrying.
 */
-   hdr = (struct vmbus_channel_message_header *)buffer;
+   hdr = buffer;
if (hdr->msgtype == CHANNELMSG_INITIATE_CONTACT)
return -EINVAL;
/*
-- 
2.7.4

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


Re: [PATCH 4/4] staging: lustre: obdclass: change object lookup to no wait mode

2018-05-14 Thread James Simmons

> On Wed, May 02 2018, James Simmons wrote:
> 
> > From: Lai Siyao 
> >
> > Currently we set LU_OBJECT_HEARD_BANSHEE on object when we want
> > to remove object from cache, but this may lead to deadlock, because
> > when other process lookup such object, it needs to wait for this
> > object until release (done at last refcount put), while that process
> > maybe already hold an LDLM lock.
> >
> > Now that current code can handle dying object correctly, we can just
> > return such object in lookup, thus the above deadlock can be avoided.
> 
> I think one of the reasons that I didn't apply this to mainline myself
> is that "Now that" comment.  When is the "now" that it is referring to?
> Are were sure that all code in mainline "can handle dying objects
> correctly"??

So I talked to Lai and he posted the LU-9049 ticket what patches need to
land before this one. Only one patch is of concern and its for LU-9203
which doesn't apply to the staging tree since we don't have the LNet SMP
updates in our tree. I saved notes about making sure LU-9203 lands 
together with the future LNet SMP changes. As it stands it is safe to
land to staging.
 
> > Signed-off-by: Lai Siyao 
> > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9049
> > Reviewed-on: https://review.whamcloud.com/26965
> > Reviewed-by: Alex Zhuravlev 
> > Tested-by: Cliff White 
> > Reviewed-by: Fan Yong 
> > Reviewed-by: Oleg Drokin 
> > Signed-off-by: James Simmons 
> > ---
> >  drivers/staging/lustre/lustre/include/lu_object.h  |  2 +-
> >  drivers/staging/lustre/lustre/obdclass/lu_object.c | 82 
> > +-
> >  2 files changed, 36 insertions(+), 48 deletions(-)
> >
> > diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
> > b/drivers/staging/lustre/lustre/include/lu_object.h
> > index f29bbca..232063a 100644
> > --- a/drivers/staging/lustre/lustre/include/lu_object.h
> > +++ b/drivers/staging/lustre/lustre/include/lu_object.h
> > @@ -673,7 +673,7 @@ static inline void lu_object_get(struct lu_object *o)
> >  }
> >  
> >  /**
> > - * Return true of object will not be cached after last reference to it is
> > + * Return true if object will not be cached after last reference to it is
> >   * released.
> >   */
> >  static inline int lu_object_is_dying(const struct lu_object_header *h)
> > diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c 
> > b/drivers/staging/lustre/lustre/obdclass/lu_object.c
> > index 8b507f1..9311703 100644
> > --- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
> > +++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
> > @@ -589,19 +589,13 @@ static struct lu_object *htable_lookup(struct lu_site 
> > *s,
> >const struct lu_fid *f,
> >__u64 *version)
> >  {
> > -   struct cfs_hash *hs = s->ls_obj_hash;
> > struct lu_site_bkt_data *bkt;
> > struct lu_object_header *h;
> > struct hlist_node   *hnode;
> > -   __u64 ver;
> > -   wait_queue_entry_t waiter;
> > +   u64 ver = cfs_hash_bd_version_get(bd);
> >  
> > -retry:
> > -   ver = cfs_hash_bd_version_get(bd);
> > -
> > -   if (*version == ver) {
> > +   if (*version == ver)
> > return ERR_PTR(-ENOENT);
> > -   }
> >  
> > *version = ver;
> > bkt = cfs_hash_bd_extra_get(s->ls_obj_hash, bd);
> > @@ -615,31 +609,13 @@ static struct lu_object *htable_lookup(struct lu_site 
> > *s,
> > }
> >  
> > h = container_of(hnode, struct lu_object_header, loh_hash);
> > -   if (likely(!lu_object_is_dying(h))) {
> > -   cfs_hash_get(s->ls_obj_hash, hnode);
> > -   lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT);
> > -   if (!list_empty(&h->loh_lru)) {
> > -   list_del_init(&h->loh_lru);
> > -   percpu_counter_dec(&s->ls_lru_len_counter);
> > -   }
> > -   return lu_object_top(h);
> > +   cfs_hash_get(s->ls_obj_hash, hnode);
> > +   lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT);
> > +   if (!list_empty(&h->loh_lru)) {
> > +   list_del_init(&h->loh_lru);
> > +   percpu_counter_dec(&s->ls_lru_len_counter);
> > }
> > -
> > -   /*
> > -* Lookup found an object being destroyed this object cannot be
> > -* returned (to assure that references to dying objects are eventually
> > -* drained), and moreover, lookup has to wait until object is freed.
> > -*/
> > -
> > -   init_waitqueue_entry(&waiter, current);
> > -   add_wait_queue(&bkt->lsb_marche_funebre, &waiter);
> > -   set_current_state(TASK_UNINTERRUPTIBLE);
> > -   lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_DEATH_RACE);
> > -   cfs_hash_bd_unlock(hs, bd, 1);
> > -   schedule();
> > -   remove_wait_queue(&bkt->lsb_marche_funebre, &waiter);
> > -   cfs_hash_bd_lock(hs, bd, 1);
> > -   goto retry;
> > +   return lu_object_top(h);
> >  }
> >  
> >  /**
> > @@ -680,6 +656,8 @@ static void lu_object_limit(const struct lu_env *env, 
> > struct lu_device *dev)
> >  }
> >  

Re: [PATCH] staging: mt7621-eth: Remove unused variable

2018-05-14 Thread NeilBrown
On Mon, May 14 2018, Kamal Heib wrote:

> Remove unused variable 'condition' which was set but not used.
>
> Signed-off-by: Kamal Heib 

Reviewed-by: NeilBrown 

This is the same patch as

Commit: f03b06f3bae8 ("net: ethernet: mediatek: remove useless code in 
mtk_poll_tx()")

which applies to drivers/net/ethernet/mediatek/mtk_eth_soc.c
It would be really good to migrate the staging driver to be close to
the main line drivers so that the differences become obvious.
My understanding is that the mainline driver is written/tested for
ARM SOCs, and the staging driver works on (nearly) the same ethernet
controller in MIPS SOCs.
One difference that I noticed is that in the ARM there appear to be
separate interrupts for send and receive.  In the MIPS there is just
one.
Also the MIPS driver has both "pdma" (paged DMA I think) and "qdma"
(which might be quick DMA).  The ARM only has qdma.
I couldn't make the MIPS work with qdma, though I didn't try very hard.
John Crispin wrote:

There are 2 types of DMA engine, PDMA and the newer QDMA. PDMA uses a
typical ring buffer while QDMA uses a linked list. Unfortunatley we have
the MT7621 which has a few silicon issues. Due to these issues we need to
PDMA for RX and QDMA for TX. All SoCs newer than the MT7621 can can run on
QDMA exclusively.

so we would eventually need to add PDMA to the mainline driver, but and
make the QDMA in the staging drive looks exactly like the QDMA in th
mainline driver.

The other issue here is interfacing with drivers/net/dsa/mt7530.c 
That might not be difficult, but I haven't had a chance to look at the
code yet.

Thanks for your contributions and anything else you might contribute in
any of these areas.
NeilBrown


> ---
>  drivers/staging/mt7621-eth/mtk_eth_soc.c | 5 +
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
> b/drivers/staging/mt7621-eth/mtk_eth_soc.c
> index 86209b3d0a0e..2c7a2e666bfb 100644
> --- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
> +++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
> @@ -1194,7 +1194,6 @@ static int mtk_qdma_tx_poll(struct mtk_eth *eth, int 
> budget, bool *tx_again)
>   int total = 0, done[MTK_MAX_DEVS];
>   unsigned int bytes[MTK_MAX_DEVS];
>   u32 cpu, dma;
> - static int condition;
>   int i;
>  
>   memset(done, 0, sizeof(done));
> @@ -1219,10 +1218,8 @@ static int mtk_qdma_tx_poll(struct mtk_eth *eth, int 
> budget, bool *tx_again)
>  
>   tx_buf = mtk_desc_to_tx_buf(ring, desc);
>   skb = tx_buf->skb;
> - if (!skb) {
> - condition = 1;
> + if (!skb)
>   break;
> - }
>  
>   if (skb != (struct sk_buff *)DMA_DUMMY_DESC) {
>   bytes[mac] += skb->len;
> -- 
> 2.14.3


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


Re: [PATCH 0/5] staging: mt7621-gpio: some driver cleanups

2018-05-14 Thread NeilBrown
On Mon, May 14 2018, Sergio Paracuellos wrote:

> The following patch series fix all remaining checkpatch complains
> about this driver. Changes have not been tested and also compiled
> but it should not have any problem about them.

Thanks for these.  As you say, nothing in them could change behaviour of
the driver, but I tested them anyway and gpio still works (both in and
out) - no surprises.

I can give
  Reviewed-by: NeilBrown 
for all exect "dt-bindings: gpio: add documentation for mt7621-gpio".
I'll reply to the separately.

Of course the dt-binding patches will need broader review once they seem
ready to us.

Thanks,
NeilBrown


>
> Sergio Paracuellos (5):
>   staging: mt7621-gpio: fix some warnings because of lines exceded 80
> characters
>   staging: mt7621-gpio: add SPDX identifier
>   dt-bindings: add compatible string for 'mtk' MediaTek
>   dt-bindings: gpio: add documentation for mt7621-gpio
>   staging: mt7621-gpio: remove device tree related stuff from TODO file
>
>  .../devicetree/bindings/gpio/mtk,mt7621-gpio.txt   | 51 
> ++
>  .../devicetree/bindings/vendor-prefixes.txt|  1 +
>  drivers/staging/mt7621-gpio/TODO   |  1 -
>  drivers/staging/mt7621-gpio/gpio-mt7621.c  | 24 +-
>  4 files changed, 66 insertions(+), 11 deletions(-)
>  create mode 100644 Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt
>
> -- 
> 2.7.4


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


Re: [PATCH 4/5] dt-bindings: gpio: add documentation for mt7621-gpio

2018-05-14 Thread NeilBrown
On Mon, May 14 2018, Sergio Paracuellos wrote:

> This commit add missing dt bindings documentation for mt7621-gpio
> driver. After this checkpatch script complain about this
> issue dissapears.
>
> Signed-off-by: Sergio Paracuellos 
> ---
>  .../devicetree/bindings/gpio/mtk,mt7621-gpio.txt   | 51 
> ++
>  1 file changed, 51 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt
>
> diff --git a/Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt 
> b/Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt
> new file mode 100644
> index 000..5fe4bb5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/mtk,mt7621-gpio.txt
> @@ -0,0 +1,51 @@
> +Mediatek SoC GPIO controller bindings
> +
> +The IP core used inside these SoCs has 3 banks of 32 GPIOs each.
> +The registers of all the banks are interwoven inside one single IO range.
> +We load one GPIO controller instance per bank. To make this possible
> +we support 2 types of nodes. The parent node defines the memory I/O range and
> +has 3 children each describing a single bank.
> +
> +Required properties for the top level node:
> +- compatible:
> +  - "mtk,mt7621-gpio" for Mediatek controllers
> +- reg : Physical base address and length of the controller's registers
> +
> +Required properties for the GPIO bank node:
> +- compatible:
> +  - "mtk,mt7621-gpio-bank" for Mediatek banks
> +- #gpio-cells : Should be two.
> +  - first cell is the pin number
> +  - second cell is used to specify optional parameters (unused)
> +- gpio-controller : Marks the device node as a GPIO controller
> +- reg : The id of the bank that the node describes.

This is really good, but not quite complete.
Searching for "of_" in gpio-mt7621.c I find code handling everything
you've described, but also:

mediatek_gpio_irq = irq_of_parse_and_map(np, 0);
if (mediatek_gpio_irq) {
mediatek_gpio_irq_domain = irq_domain_add_linear(np,

The GPIO controller can receive interrupts on any of the GPIOs,
either edge or level.  It then interrupts the CPU using GIC INT12.

so
interrupt-parent = <&gic>;
interrupts = 
(I think).
Then you need whatever irq_domain_add_linear() expects.
I don't know what that is...  I tried following through
code and got lost in little twisty mazes.

So if you change this patch to add the file to
drivers/staging/mt7621-gpio
then I can give it
  Reviewed-by: NeilBrown 

and then we can fix it when an understanding of the interrupts is
available.
But I cannot approve it for Documentation/devicetree/bindings yet.

Thanks a lot,
NeilBrown


> +
> +Example:
> + gpio@600 {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + compatible = "mtk,mt7621-gpio";
> + reg = <0x600 0x100>;
> +
> + gpio0: bank@0 {
> + reg = <0>;
> + compatible = "mtk,mt7621-gpio-bank";
> + gpio-controller;
> + #gpio-cells = <2>;
> + };
> +
> + gpio1: bank@1 {
> + reg = <1>;
> + compatible = "mtk,mt7621-gpio-bank";
> + gpio-controller;
> + #gpio-cells = <2>;
> + };
> +
> + gpio2: bank@2 {
> + reg = <2>;
> + compatible = "mtk,mt7621-gpio-bank";
> + gpio-controller;
> + #gpio-cells = <2>;
> + };
> + };
> -- 
> 2.7.4


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


Re: [PATCH 5/5] staging: mt7621-gpio: remove device tree related stuff from TODO file

2018-05-14 Thread NeilBrown
On Mon, May 14 2018, Sergio Paracuellos wrote:

> Documentation related with device tree and its checkpatch complains
> have been added. Update TODO file accordingly.
>
> Signed-off-by: Sergio Paracuellos 
> ---
>  drivers/staging/mt7621-gpio/TODO | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/drivers/staging/mt7621-gpio/TODO 
> b/drivers/staging/mt7621-gpio/TODO
> index 7143905..492dbaa 100644
> --- a/drivers/staging/mt7621-gpio/TODO
> +++ b/drivers/staging/mt7621-gpio/TODO
> @@ -1,5 +1,4 @@
>  
>  - general code review and clean up
> -- ensure device-tree requirements are documented
>  
>  Cc:  NeilBrown 
> -- 
> 2.7.4

I said before that I could give a reviewed-by for this, but obviously I
cannot as it depend on the bindings documentation which I didn't
approve.

However, it does look like I need to add things to the list.
Apart from making sure interrupts work, the only thing I see in the code
is various global variables (mediatek_gpio_membase, mediatek_gpio_irq,
mediatek_gpio_irq_domain, gc_map) which should probably be in a
drvdata allocated structure (stored with platform_set_drvdata() -
plenty of examples in drivers/gpio/gpio-*.c)
I think it would then be ready for submission to drivers/gpio
and linux-g...@vger.kernel.org.

Thanks,
NeilBrown


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


Re: [PATCH 4/4] staging: lustre: obdclass: change object lookup to no wait mode

2018-05-14 Thread NeilBrown
On Tue, May 15 2018, James Simmons wrote:

>> On Wed, May 02 2018, James Simmons wrote:
>> 
>> > From: Lai Siyao 
>> >
>> > Currently we set LU_OBJECT_HEARD_BANSHEE on object when we want
>> > to remove object from cache, but this may lead to deadlock, because
>> > when other process lookup such object, it needs to wait for this
>> > object until release (done at last refcount put), while that process
>> > maybe already hold an LDLM lock.
>> >
>> > Now that current code can handle dying object correctly, we can just
>> > return such object in lookup, thus the above deadlock can be avoided.
>> 
>> I think one of the reasons that I didn't apply this to mainline myself
>> is that "Now that" comment.  When is the "now" that it is referring to?
>> Are were sure that all code in mainline "can handle dying objects
>> correctly"??
>
> So I talked to Lai and he posted the LU-9049 ticket what patches need to
> land before this one. Only one patch is of concern and its for LU-9203
> which doesn't apply to the staging tree since we don't have the LNet SMP
> updates in our tree. I saved notes about making sure LU-9203 lands 
> together with the future LNet SMP changes. As it stands it is safe to
> land to staging.

Thanks a lot for looking into this.  Nice to have the safety of this
change confirmed.

What do you think of:

>> > @@ -713,36 +691,46 @@ struct lu_object *lu_object_find_at(const struct 
>> > lu_env *env,
>> > * It is unnecessary to perform lookup-alloc-lookup-insert, instead,
>> > * just alloc and insert directly.
>> > *
>> > +   * If dying object is found during index search, add @waiter to the
>> > +   * site wait-queue and return ERR_PTR(-EAGAIN).
>> 
>> It seems odd to add this comment here, when it seems to describe code
>> that is being removed.
>> I can see that this comment is added by the upstream patch
>> Commit: fa14bdf6b648 ("LU-9049 obdclass: change object lookup to no wait 
>> mode")
>> but I cannot see what it refers to.
>> 

??

Am I misunderstanding something, or is that comment wrong?

Thanks,
NeilBrown


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


Re: [PATCH 4/4] staging: lustre: obdclass: change object lookup to no wait mode

2018-05-14 Thread James Simmons

> >> On Wed, May 02 2018, James Simmons wrote:
> >> 
> >> > From: Lai Siyao 
> >> >
> >> > Currently we set LU_OBJECT_HEARD_BANSHEE on object when we want
> >> > to remove object from cache, but this may lead to deadlock, because
> >> > when other process lookup such object, it needs to wait for this
> >> > object until release (done at last refcount put), while that process
> >> > maybe already hold an LDLM lock.
> >> >
> >> > Now that current code can handle dying object correctly, we can just
> >> > return such object in lookup, thus the above deadlock can be avoided.
> >> 
> >> I think one of the reasons that I didn't apply this to mainline myself
> >> is that "Now that" comment.  When is the "now" that it is referring to?
> >> Are were sure that all code in mainline "can handle dying objects
> >> correctly"??
> >
> > So I talked to Lai and he posted the LU-9049 ticket what patches need to
> > land before this one. Only one patch is of concern and its for LU-9203
> > which doesn't apply to the staging tree since we don't have the LNet SMP
> > updates in our tree. I saved notes about making sure LU-9203 lands 
> > together with the future LNet SMP changes. As it stands it is safe to
> > land to staging.
> 
> Thanks a lot for looking into this.  Nice to have the safety of this
> change confirmed.
> 
> What do you think of:
> 
> >> > @@ -713,36 +691,46 @@ struct lu_object *lu_object_find_at(const struct 
> >> > lu_env *env,
> >> >   * It is unnecessary to perform lookup-alloc-lookup-insert, 
> >> > instead,
> >> >   * just alloc and insert directly.
> >> >   *
> >> > + * If dying object is found during index search, add @waiter to 
> >> > the
> >> > + * site wait-queue and return ERR_PTR(-EAGAIN).
> >> 
> >> It seems odd to add this comment here, when it seems to describe code
> >> that is being removed.
> >> I can see that this comment is added by the upstream patch
> >> Commit: fa14bdf6b648 ("LU-9049 obdclass: change object lookup to no wait 
> >> mode")
> >> but I cannot see what it refers to.
> >> 
> 
> ??
> 
> Am I misunderstanding something, or is that comment wrong?

I think the comment is wrong. That comment was in the other tree before 
the patch was landed. It got included with this push due to me diffing the
tree by accident. I will remove it with the next push.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: lustre: obdclass: change object lookup to no wait mode

2018-05-14 Thread James Simmons
From: Lai Siyao 

Currently we set LU_OBJECT_HEARD_BANSHEE on object when we want
to remove object from cache, but this may lead to deadlock, because
when other process lookup such object, it needs to wait for this
object until release (done at last refcount put), while that process
maybe already hold an LDLM lock.

Now that current code can handle dying object correctly, we can just
return such object in lookup, thus the above deadlock can be avoided.

Signed-off-by: Lai Siyao 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9049
Reviewed-on: https://review.whamcloud.com/26965
Reviewed-by: Alex Zhuravlev 
Tested-by: Cliff White 
Reviewed-by: Fan Yong 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
Changelog:

v1) Initial patch that didn't apply to staging-testing branch
v2) Rebased after Neil's patches landed. Remove unlikely() test
as requested by Dan Carpenter

 drivers/staging/lustre/lustre/obdclass/lu_object.c | 39 +-
 1 file changed, 9 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/lu_object.c 
b/drivers/staging/lustre/lustre/obdclass/lu_object.c
index f14e350..e0abd4f 100644
--- a/drivers/staging/lustre/lustre/obdclass/lu_object.c
+++ b/drivers/staging/lustre/lustre/obdclass/lu_object.c
@@ -593,15 +593,10 @@ static struct lu_object *htable_lookup(struct lu_site *s,
   const struct lu_fid *f,
   __u64 *version)
 {
-   struct cfs_hash *hs = s->ls_obj_hash;
struct lu_site_bkt_data *bkt;
struct lu_object_header *h;
struct hlist_node   *hnode;
-   __u64 ver;
-   wait_queue_entry_t waiter;
-
-retry:
-   ver = cfs_hash_bd_version_get(bd);
+   u64 ver = cfs_hash_bd_version_get(bd);
 
if (*version == ver)
return ERR_PTR(-ENOENT);
@@ -618,31 +613,13 @@ static struct lu_object *htable_lookup(struct lu_site *s,
}
 
h = container_of(hnode, struct lu_object_header, loh_hash);
-   if (likely(!lu_object_is_dying(h))) {
-   cfs_hash_get(s->ls_obj_hash, hnode);
-   lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT);
-   if (!list_empty(&h->loh_lru)) {
-   list_del_init(&h->loh_lru);
-   percpu_counter_dec(&s->ls_lru_len_counter);
-   }
-   return lu_object_top(h);
+   cfs_hash_get(s->ls_obj_hash, hnode);
+   lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_HIT);
+   if (!list_empty(&h->loh_lru)) {
+   list_del_init(&h->loh_lru);
+   percpu_counter_dec(&s->ls_lru_len_counter);
}
-
-   /*
-* Lookup found an object being destroyed this object cannot be
-* returned (to assure that references to dying objects are eventually
-* drained), and moreover, lookup has to wait until object is freed.
-*/
-
-   init_waitqueue_entry(&waiter, current);
-   add_wait_queue(&bkt->lsb_marche_funebre, &waiter);
-   set_current_state(TASK_UNINTERRUPTIBLE);
-   lprocfs_counter_incr(s->ls_stats, LU_SS_CACHE_DEATH_RACE);
-   cfs_hash_bd_unlock(hs, bd, 1);
-   schedule();
-   remove_wait_queue(&bkt->lsb_marche_funebre, &waiter);
-   cfs_hash_bd_lock(hs, bd, 1);
-   goto retry;
+   return lu_object_top(h);
 }
 
 /**
@@ -683,6 +660,8 @@ static void lu_object_limit(const struct lu_env *env, 
struct lu_device *dev)
 }
 
 /**
+ * Core logic of lu_object_find*() functions.
+ *
  * Much like lu_object_find(), but top level device of object is specifically
  * \a dev rather than top level device of the site. This interface allows
  * objects of different "stacking" to be created within the same site.
-- 
1.8.3.1

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


[PATCH 3/5] staging: lustre: acl: increase ACL entries limitation

2018-05-14 Thread James Simmons
From: Fan Yong 

Originally, the limitation of ACL entries is 32, that is not
enough for some use cases. In fact, restricting ACL entries
count is mainly for preparing the RPC reply buffer to receive
the ACL data. So we cannot make the ACL entries count to be
unlimited. But we can enlarge the RPC reply buffer to hold
more ACL entries. On the other hand, MDT backend filesystem
has its own EA size limitation. For example, for ldiskfs case,
if large EA enable, then the max ACL size is 1048492 bytes;
otherwise, it is 4012 bytes. For ZFS backend, such value is
32768 bytes. With such hard limitation, we can calculate how
many ACL entries we can have at most. This patch increases
the RPC reply buffer to match such hard limitation. For old
client, to avoid buffer overflow because of large ACL data
(more than 32 ACL entries), the MDT will forbid the old client
to access the file with large ACL data. As for how to know
whether it is old client or new, a new connection flag
OBD_CONNECT_LARGE_ACL is used for that.

Signed-off-by: Fan Yong 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7473
Reviewed-on: https://review.whamcloud.com/19790
Reviewed-by: Andreas Dilger 
Reviewed-by: Li Xi 
Reviewed-by: Lai Siyao 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h | 2 +-
 drivers/staging/lustre/lustre/include/lustre_acl.h| 7 ++-
 drivers/staging/lustre/lustre/llite/llite_lib.c   | 3 ++-
 drivers/staging/lustre/lustre/mdc/mdc_locks.c | 6 ++
 drivers/staging/lustre/lustre/mdc/mdc_reint.c | 2 ++
 drivers/staging/lustre/lustre/mdc/mdc_request.c   | 4 
 drivers/staging/lustre/lustre/ptlrpc/layout.c | 4 +---
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c   | 4 ++--
 8 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h 
b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h
index aac98db..8778c6f 100644
--- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_idl.h
@@ -615,7 +615,7 @@ struct ptlrpc_body_v2 {
 #define OBD_CONNECT_REQPORTAL   0x40ULL /*Separate non-IO req portal */
 #define OBD_CONNECT_ACL 0x80ULL /*access control lists 
*/
 #define OBD_CONNECT_XATTR  0x100ULL /*client use extended attr */
-#define OBD_CONNECT_CROW   0x200ULL /*MDS+OST create obj on write*/
+#define OBD_CONNECT_LARGE_ACL  0x200ULL /* more than 32 ACL entries */
 #define OBD_CONNECT_TRUNCLOCK  0x400ULL /*locks on server for punch */
 #define OBD_CONNECT_TRANSNO0x800ULL /*replay sends init transno */
 #define OBD_CONNECT_IBITS 0x1000ULL /*support for inodebits locks*/
diff --git a/drivers/staging/lustre/lustre/include/lustre_acl.h 
b/drivers/staging/lustre/lustre/include/lustre_acl.h
index 35ff61c..e7575a1 100644
--- a/drivers/staging/lustre/lustre/include/lustre_acl.h
+++ b/drivers/staging/lustre/lustre/include/lustre_acl.h
@@ -36,11 +36,16 @@
 
 #include 
 #include 
+#ifdef CONFIG_FS_POSIX_ACL
 #include 
 
 #define LUSTRE_POSIX_ACL_MAX_ENTRIES   32
-#define LUSTRE_POSIX_ACL_MAX_SIZE  
\
+#define LUSTRE_POSIX_ACL_MAX_SIZE_OLD  
\
(sizeof(struct posix_acl_xattr_header) +
\
 LUSTRE_POSIX_ACL_MAX_ENTRIES * sizeof(struct posix_acl_xattr_entry))
 
+#else /* ! CONFIG_FS_POSIX_ACL */
+#define LUSTRE_POSIX_ACL_MAX_SIZE_OLD 0
+#endif /* CONFIG_FS_POSIX_ACL */
+
 #endif
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 83eb2da..b5c287b 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -198,7 +198,8 @@ static int client_common_fill_super(struct super_block *sb, 
char *md, char *dt)
if (sbi->ll_flags & LL_SBI_LRU_RESIZE)
data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
 #ifdef CONFIG_FS_POSIX_ACL
-   data->ocd_connect_flags |= OBD_CONNECT_ACL | OBD_CONNECT_UMASK;
+   data->ocd_connect_flags |= OBD_CONNECT_ACL | OBD_CONNECT_UMASK |
+  OBD_CONNECT_LARGE_ACL;
 #endif
 
if (OBD_FAIL_CHECK(OBD_FAIL_MDC_LIGHTWEIGHT))
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 253a545..65a5341 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -308,6 +308,8 @@ static void mdc_realloc_openmsg(struct ptlrpc_request *req,
 
req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
 obddev->u.cli.cl_max_mds_easize);
+   req_capsule_set_size(&req->rq_

[PATCH v2 2/5] staging: lustre: llite: remove unused parameters from md_{get, set}xattr()

2018-05-14 Thread James Simmons
From: "John L. Hammond" 

md_getxattr() and md_setxattr() each have several unused
parameters. Remove them and improve the naming or remaining
parameters.

Signed-off-by: John L. Hammond 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10792
Reviewed-on: https://review.whamcloud.com/
Reviewed-by: Dmitry Eremin 
Reviewed-by: James Simmons 
Signed-off-by: James Simmons 
---
Changelog:

v1) Initial patch ported to staging tree
v2) Rebased on fixed parent patch

 drivers/staging/lustre/lustre/include/obd.h   |  7 ++---
 drivers/staging/lustre/lustre/include/obd_class.h | 21 ++
 drivers/staging/lustre/lustre/llite/file.c|  5 ++--
 drivers/staging/lustre/lustre/llite/xattr.c   |  6 ++--
 drivers/staging/lustre/lustre/lmv/lmv_obd.c   | 22 +++
 drivers/staging/lustre/lustre/mdc/mdc_request.c   | 34 +--
 6 files changed, 46 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd.h 
b/drivers/staging/lustre/lustre/include/obd.h
index fe21987..a69564d 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -940,12 +940,11 @@ struct md_ops {
  struct ptlrpc_request **);
 
int (*setxattr)(struct obd_export *, const struct lu_fid *,
-   u64, const char *, const char *, int, int, int, __u32,
-   struct ptlrpc_request **);
+   u64, const char *, const void *, size_t, unsigned int,
+   u32, struct ptlrpc_request **);
 
int (*getxattr)(struct obd_export *, const struct lu_fid *,
-   u64, const char *, const char *, int, int, int,
-   struct ptlrpc_request **);
+   u64, const char *, size_t, struct ptlrpc_request **);
 
int (*init_ea_size)(struct obd_export *, u32, u32);
 
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h 
b/drivers/staging/lustre/lustre/include/obd_class.h
index a76f016..0081578 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -1385,29 +1385,26 @@ static inline int md_merge_attr(struct obd_export *exp,
 }
 
 static inline int md_setxattr(struct obd_export *exp, const struct lu_fid *fid,
- u64 valid, const char *name,
- const char *input, int input_size,
- int output_size, int flags, __u32 suppgid,
+ u64 obd_md_valid, const char *name,
+ const char *value, size_t value_size,
+ unsigned int xattr_flags, u32 suppgid,
  struct ptlrpc_request **request)
 {
EXP_CHECK_MD_OP(exp, setxattr);
EXP_MD_COUNTER_INCREMENT(exp, setxattr);
-   return MDP(exp->exp_obd, setxattr)(exp, fid, valid, name, input,
-  input_size, output_size, flags,
+   return MDP(exp->exp_obd, setxattr)(exp, fid, obd_md_valid, name,
+  value, value_size, xattr_flags,
   suppgid, request);
 }
 
 static inline int md_getxattr(struct obd_export *exp, const struct lu_fid *fid,
- u64 valid, const char *name,
- const char *input, int input_size,
- int output_size, int flags,
- struct ptlrpc_request **request)
+ u64 obd_md_valid, const char *name,
+ size_t buf_size, struct ptlrpc_request **req)
 {
EXP_CHECK_MD_OP(exp, getxattr);
EXP_MD_COUNTER_INCREMENT(exp, getxattr);
-   return MDP(exp->exp_obd, getxattr)(exp, fid, valid, name, input,
-  input_size, output_size, flags,
-  request);
+   return MDP(exp->exp_obd, getxattr)(exp, fid, obd_md_valid, name,
+  buf_size, req);
 }
 
 static inline int md_set_open_replay_data(struct obd_export *exp,
diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 64a5698..de30df2 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3088,7 +3088,7 @@ int ll_set_acl(struct inode *inode, struct posix_acl 
*acl, int type)
 
rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode),
 value ? OBD_MD_FLXATTR : OBD_MD_FLXATTRRM,
-name, value, value_size, 0, 0, 0, &req);
+name, value, value_size, 0, 0, &req);
 
ptlrpc_req_finished(req);
 out_value:
@@ -3400,8 +3400,7 @@ static int ll_layout_fetch(struct inode *inode, struct 
ldlm_lock *lock)
rc = ll_get_default_mdsize(sbi, &lmmsize

[PATCH v2 1/5] staging: lustre: llite: add support set_acl method in inode operations

2018-05-14 Thread James Simmons
From: Dmitry Eremin 

Linux kernel v3.14 adds set_acl method to inode operations.
This patch adds support to Lustre for proper acl management.

Signed-off-by: Dmitry Eremin 
Signed-off-by: John L. Hammond 
Signed-off-by: James Simmons 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9183
Reviewed-on: https://review.whamcloud.com/25965
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10541
Reviewed-on: https://review.whamcloud.com/31588
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-10926
Reviewed-on: https://review.whamcloud.com/32045
Reviewed-by: Bob Glossman 
Reviewed-by: James Simmons 
Reviewed-by: Andreas Dilger 
Reviewed-by: Dmitry Eremin 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
Changelog:

v1) Initial patch ported to staging tree
v2) Fixed up goto handling and avoid BUG() when calling
forget_cached_acl()with invalid type as pointed out by Dan Carpenter

 drivers/staging/lustre/lustre/llite/file.c | 62 ++
 .../staging/lustre/lustre/llite/llite_internal.h   |  4 ++
 drivers/staging/lustre/lustre/llite/namei.c| 10 +++-
 3 files changed, 74 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 0026fde..64a5698 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3030,6 +3030,7 @@ static int ll_fiemap(struct inode *inode, struct 
fiemap_extent_info *fieinfo,
return rc;
 }
 
+#ifdef CONFIG_FS_POSIX_ACL
 struct posix_acl *ll_get_acl(struct inode *inode, int type)
 {
struct ll_inode_info *lli = ll_i2info(inode);
@@ -3043,6 +3044,64 @@ struct posix_acl *ll_get_acl(struct inode *inode, int 
type)
return acl;
 }
 
+int ll_set_acl(struct inode *inode, struct posix_acl *acl, int type)
+{
+   struct ll_sb_info *sbi = ll_i2sbi(inode);
+   struct ptlrpc_request *req = NULL;
+   const char *name = NULL;
+   size_t value_size = 0;
+   char *value = NULL;
+   int rc;
+
+   switch (type) {
+   case ACL_TYPE_ACCESS:
+   name = XATTR_NAME_POSIX_ACL_ACCESS;
+   if (acl)
+   rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+   break;
+
+   case ACL_TYPE_DEFAULT:
+   name = XATTR_NAME_POSIX_ACL_DEFAULT;
+   if (!S_ISDIR(inode->i_mode))
+   rc = acl ? -EACCES : 0;
+   break;
+
+   default:
+   rc = -EINVAL;
+   break;
+   }
+   if (rc)
+   return rc;
+
+   if (acl) {
+   value_size = posix_acl_xattr_size(acl->a_count);
+   value = kmalloc(value_size, GFP_NOFS);
+   if (!value) {
+   rc = -ENOMEM;
+   goto out;
+   }
+
+   rc = posix_acl_to_xattr(&init_user_ns, acl, value, value_size);
+   if (rc < 0)
+   goto out_value;
+   }
+
+   rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode),
+value ? OBD_MD_FLXATTR : OBD_MD_FLXATTRRM,
+name, value, value_size, 0, 0, 0, &req);
+
+   ptlrpc_req_finished(req);
+out_value:
+   kfree(value);
+out:
+   if (rc)
+   forget_cached_acl(inode, type);
+   else
+   set_cached_acl(inode, type, acl);
+   return rc;
+}
+#endif /* CONFIG_FS_POSIX_ACL */
+
 int ll_inode_permission(struct inode *inode, int mask)
 {
struct ll_sb_info *sbi;
@@ -3164,7 +3223,10 @@ int ll_inode_permission(struct inode *inode, int mask)
.permission = ll_inode_permission,
.listxattr  = ll_listxattr,
.fiemap = ll_fiemap,
+#ifdef CONFIG_FS_POSIX_ACL
.get_acl= ll_get_acl,
+   .set_acl= ll_set_acl,
+#endif
 };
 
 /* dynamic ioctl number support routines */
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 6504850..2280327 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -754,7 +754,11 @@ enum ldlm_mode ll_take_md_lock(struct inode *inode, __u64 
bits,
 int ll_md_real_close(struct inode *inode, fmode_t fmode);
 int ll_getattr(const struct path *path, struct kstat *stat,
   u32 request_mask, unsigned int flags);
+#ifdef CONFIG_FS_POSIX_ACL
 struct posix_acl *ll_get_acl(struct inode *inode, int type);
+int ll_set_acl(struct inode *inode, struct posix_acl *acl, int type);
+#endif /* CONFIG_FS_POSIX_ACL */
+
 int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
   const char *name, int namelen);
 int ll_get_fid_by_name(struct inode *parent, const char *name,
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 9ac7f09..b41f189 100644
--- a/driver

[PATCH 0/5] staging: lustre: llite: remaining xattr fixes

2018-05-14 Thread James Simmons
Fixed the bugs in the set_acl patch pointed out by Dan Carpenter.
Rebased the next patch 'remove unused parameter..." on the parent
patch. Added newer xattr fixes that were recently pushed.

Andrew Perepechko (1):
  staging: lustre: mdc: excessive memory consumption by the xattr cache

Dmitry Eremin (1):
  staging: lustre: llite: add support set_acl method in inode operations

Fan Yong (1):
  staging: lustre: acl: increase ACL entries limitation

John L. Hammond (2):
  staging: lustre: llite: remove unused parameters from md_{get,set}xattr()
  staging: lustre: mdc: use large xattr buffers for old servers

 .../lustre/include/uapi/linux/lustre/lustre_idl.h  |  2 +-
 drivers/staging/lustre/lustre/include/lustre_acl.h |  7 ++-
 drivers/staging/lustre/lustre/include/obd.h|  7 +--
 drivers/staging/lustre/lustre/include/obd_class.h  | 21 +++
 drivers/staging/lustre/lustre/llite/file.c | 65 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |  4 ++
 drivers/staging/lustre/lustre/llite/llite_lib.c|  3 +-
 drivers/staging/lustre/lustre/llite/namei.c| 10 +++-
 drivers/staging/lustre/lustre/llite/xattr.c|  6 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c| 22 
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  | 42 +++---
 drivers/staging/lustre/lustre/mdc/mdc_reint.c  |  2 +
 drivers/staging/lustre/lustre/mdc/mdc_request.c| 38 -
 drivers/staging/lustre/lustre/ptlrpc/layout.c  |  4 +-
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c|  4 +-
 15 files changed, 171 insertions(+), 66 deletions(-)

-- 
1.8.3.1

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


[PATCH 4/5] staging: lustre: mdc: excessive memory consumption by the xattr cache

2018-05-14 Thread James Simmons
From: Andrew Perepechko 

The refill operation of the xattr cache does not know the
reply size in advance, so it makes a guess based on
the maxeasize value returned by the MDS.

In practice, it allocates 16 KiB for the common case and
4 MiB for the large xattr case. However, a typical reply
is just a few hundred bytes.

If we follow the conservative approach, we can prepare a
single memory page for the reply. It is large enough for
any reasonable xattr set and, at the same time, it does
not require multiple page memory reclaim, which can be
costly.

If, for a specific file, the reply is larger than a single
page, the client is prepared to handle that and will fall back
to non-cached xattr code. Indeed, if this happens often and
xattrs are often used to store large values, it makes sense to
disable the xattr cache at all since it wasn't designed for
such [mis]use.

Signed-off-by: Andrew Perepechko 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-9417
Reviewed-on: https://review.whamcloud.com/26887
Reviewed-by: Fan Yong 
Reviewed-by: Ben Evans 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/mdc/mdc_locks.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 65a5341..a8aa0fa 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -315,6 +315,10 @@ static void mdc_realloc_openmsg(struct ptlrpc_request *req,
return req;
 }
 
+#define GA_DEFAULT_EA_NAME_LEN 20
+#define GA_DEFAULT_EA_VAL_LEN  250
+#define GA_DEFAULT_EA_NUM  10
+
 static struct ptlrpc_request *
 mdc_intent_getxattr_pack(struct obd_export *exp,
 struct lookup_intent *it,
@@ -323,7 +327,6 @@ static void mdc_realloc_openmsg(struct ptlrpc_request *req,
struct ptlrpc_request   *req;
struct ldlm_intent  *lit;
int rc, count = 0;
-   u32 maxdata;
LIST_HEAD(cancels);
 
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
@@ -341,20 +344,20 @@ static void mdc_realloc_openmsg(struct ptlrpc_request 
*req,
lit = req_capsule_client_get(&req->rq_pill, &RMF_LDLM_INTENT);
lit->opc = IT_GETXATTR;
 
-   maxdata = class_exp2cliimp(exp)->imp_connect_data.ocd_max_easize;
-
/* pack the intended request */
-   mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid, maxdata, -1,
- 0);
+   mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid,
+ GA_DEFAULT_EA_NAME_LEN * GA_DEFAULT_EA_NUM, -1, 0);
 
-   req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_SERVER, maxdata);
+   req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_SERVER,
+GA_DEFAULT_EA_NAME_LEN * GA_DEFAULT_EA_NUM);
 
-   req_capsule_set_size(&req->rq_pill, &RMF_EAVALS, RCL_SERVER, maxdata);
+   req_capsule_set_size(&req->rq_pill, &RMF_EAVALS, RCL_SERVER,
+GA_DEFAULT_EA_NAME_LEN * GA_DEFAULT_EA_NUM);
 
-   req_capsule_set_size(&req->rq_pill, &RMF_EAVALS_LENS,
-RCL_SERVER, maxdata);
+   req_capsule_set_size(&req->rq_pill, &RMF_EAVALS_LENS, RCL_SERVER,
+sizeof(u32) * GA_DEFAULT_EA_NUM);
 
-   req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER, maxdata);
+   req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER, 0);
 
ptlrpc_request_set_replen(req);
 
-- 
1.8.3.1

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


  1   2   >