[PATCH v2] staging: rtlwifi: refactor rtl_get_tcb_desc

2018-08-02 Thread Luke Triantafyllidis
Refactored rtl_get_tcb_desc slightly to stay within the 80 character
line limit.

Signed-off-by: Luke Triantafyllidis 
---

Changes in v2:
 - Fixed the formatting of the comments
 - Unwrapped some of the lines that were originally wrapped over multiple
   lines to stay within the 80 character limit

Note:
 - I didn't CC the first version of this patch to a public mailing list, so if
   you're not Greg KH, you probably want to look at this in its entirety

 drivers/staging/rtlwifi/base.c |  102 +++-
 1 files changed, 48 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/rtlwifi/base.c b/drivers/staging/rtlwifi/base.c
index e46e47d..b1b2f78 100644
--- a/drivers/staging/rtlwifi/base.c
+++ b/drivers/staging/rtlwifi/base.c
@@ -1237,67 +1237,61 @@ void rtl_get_tcb_desc(struct ieee80211_hw *hw,
if (rtl_is_tx_report_skb(hw, skb))
tcb_desc->use_spe_rpt = 1;
 
-   if (ieee80211_is_data(fc)) {
-   /*
-*we set data rate INX 0
-*in rtl_rc.c   if skb is special data or
-*mgt which need low data rate.
-*/
-
-   /*
-*So tcb_desc->hw_rate is just used for
-*special data and mgt frames
-*/
-   if (info->control.rates[0].idx == 0 ||
-   ieee80211_is_nullfunc(fc)) {
-   tcb_desc->use_driver_rate = true;
-   tcb_desc->ratr_index =
-   SET_RATE_ID(RATR_INX_WIRELESS_MC);
+   if (!ieee80211_is_data(fc)) {
+   tcb_desc->use_driver_rate = true;
+   tcb_desc->ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
+   tcb_desc->disable_ratefallback = 1;
+   tcb_desc->mac_id = 0;
+   tcb_desc->packet_bw = false;
 
-   tcb_desc->disable_ratefallback = 1;
-   } else {
-   /* because hw will never use hw_rate
-* when tcb_desc->use_driver_rate = false
-* so we never set highest N rate here,
-* and N rate will all be controlled by FW
-* when tcb_desc->use_driver_rate = false
-*/
-   if (sta && sta->vht_cap.vht_supported) {
-   tcb_desc->hw_rate =
-   _rtl_get_vht_highest_n_rate(hw, sta);
-   } else {
-   if (sta && sta->ht_cap.ht_supported) {
-   tcb_desc->hw_rate =
-   _rtl_get_highest_n_rate(hw, sta);
-   } else {
-   if (rtlmac->mode == WIRELESS_MODE_B) {
-   tcb_desc->hw_rate =
-   
rtlpriv->cfg->maps[RTL_RC_CCK_RATE11M];
-   } else {
-   tcb_desc->hw_rate =
-   
rtlpriv->cfg->maps[RTL_RC_OFDM_RATE54M];
-   }
-   }
-   }
-   }
+   return;
+   }
 
-   if (is_multicast_ether_addr(hdr->addr1))
-   tcb_desc->multicast = 1;
-   else if (is_broadcast_ether_addr(hdr->addr1))
-   tcb_desc->broadcast = 1;
+   /*
+* We set data rate INX 0
+* in rtl_rc.c if skb is special data or
+* mgt which need low data rate.
+*/
 
-   _rtl_txrate_selectmode(hw, sta, tcb_desc);
-   _rtl_query_bandwidth_mode(hw, sta, tcb_desc);
-   _rtl_qurey_shortpreamble_mode(hw, tcb_desc, info);
-   _rtl_query_shortgi(hw, sta, tcb_desc, info);
-   _rtl_query_protection_mode(hw, tcb_desc, info);
-   } else {
+   /*
+* So tcb_desc->hw_rate is just used for
+* special data and mgt frames
+*/
+   if (info->control.rates[0].idx == 0 || ieee80211_is_nullfunc(fc)) {
tcb_desc->use_driver_rate = true;
tcb_desc->ratr_index = SET_RATE_ID(RATR_INX_WIRELESS_MC);
+
tcb_desc->disable_ratefallback = 1;
-   tcb_desc->mac_id = 0;
-   tcb_desc->packet_bw = false;
+   } else if (sta && sta->vht_cap.vht_supported) {
+   /*
+* Because hw will never use hw_rate
+* when tcb_desc->use_driver_rate = false
+* so we never set highest N rate here,
+* and N rate will all be controlled by FW
+* when tcb_desc->use_driver_rate = false
+*/
+   tcb_desc->hw_rate = _rtl_get_vht_highest_n_rate(hw, sta);
+ 

Re: [PATCH v9 00/15] staging: mt7621-pci: avoid custom pci config read and writes

2018-08-02 Thread NeilBrown
On Thu, Aug 02 2018, Sergio Paracuellos wrote:

> This patch series include an attempt to avoid the use of custom
> read and writes in driver code and use PCI subsystem common ones.
>
> In order to do this 'map_bus' callback is implemented and also
> data structures for driver are included. The regs base address
> ranges and data is being readed from device tree and the driver
> gets clean a lot of code.
>
> This patchet also removes all legacy PCI code using now PCI_DRIVERS_GENERIC
> kernel api.
>
> Changes in v9:
> - PATCH 1: Use 'res' as resources list and void store resources in
>   the pcie data struct.
> - PATCH 1: Rewrite 'mt7621_pci_parse_request_of_pci_ranges' to use
>   'devm_of_pci_get_host_bridge_resources' and use 'remap' directly
>   with the returned 'iobase' address instead of 'devm_pci_remap_iospace' 
>   which get into a WARN_ONCE statement because 'PCI_IOBASE' is not
>   defined for mips.
> - Other patches rebased and adapted to this changes.

You probably expected this, but still no change.
Just for completeness boot log is below.

Thanks,
NeilBrown

Starting kernel ...

[0.00] Linux version 4.18.0-rc7+ (neilb@noble) (gcc version 7.2.0 
(GCC)) #277 SMP Fri Aug 3 14:30:02 AEST 2018
[0.00] SoC Type: MediaTek MT7621 ver:1 eco:3
[0.00] bootconsole [early0] enabled
[0.00] CPU0 revision is: 0001992f (MIPS 1004Kc)
[0.00] MIPS: machine is GB-PC1
[0.00] Determined physical RAM map:
[0.00]  memory: 1c00 @  (usable)
[0.00]  memory: 0400 @ 2000 (usable)
[0.00] Initrd not found or empty - disabling initrd
[0.00] VPE topology {2,2} total 4
[0.00] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[0.00] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 
bytes
[0.00] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[0.00] Zone ranges:
[0.00]   Normal   [mem 0x-0x1fff]
[0.00]   HighMem  [mem 0x2000-0x23ff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x1bff]
[0.00]   node   0: [mem 0x2000-0x23ff]
[0.00] Initmem setup node 0 [mem 0x-0x23ff]
[0.00] random: get_random_bytes called from start_kernel+0xb4/0x4ec 
with crng_init=0
[0.00] percpu: Embedded 15 pages/cpu @(ptrval) s30480 r8192 d22768 
u61440
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 130048
[0.00] Kernel command line: console=ttyS0,57600
[0.00] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[0.00] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[0.00] Writing ErrCtl register=000108a2
[0.00] Readback ErrCtl register=000108a2
[0.00] Memory: 504788K/524288K available (6135K kernel code, 228K 
rwdata, 1052K rodata, 6524K init, 241K bss, 19500K reserved, 0K cma-reserved, 
65536K highmem)
[0.00] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[0.00] Hierarchical RCU implementation.
[0.00] NR_IRQS: 256
[0.00] clocksource: GIC: mask: 0x max_cycles: 
0xcf914c9718, max_idle_ns: 440795231327 ns
[0.00] sched_clock: 32 bits at 100 Hz, resolution 1000ns, wraps 
every 2147483647500ns
[0.01] Calibrating delay loop... 597.60 BogoMIPS (lpj=2988032)
[0.07] pid_max: default: 32768 minimum: 301
[0.08] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[0.09] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[0.10] Hierarchical SRCU implementation.
[0.11] smp: Bringing up secondary CPUs ...
[0.12] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[0.12] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 
bytes
[0.12] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[0.12] CPU1 revision is: 0001992f (MIPS 1004Kc)
[0.18] Synchronize counters for CPU 1: done.
[0.22] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[0.22] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 
bytes
[0.22] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[0.22] CPU2 revision is: 0001992f (MIPS 1004Kc)
[0.28] Synchronize counters for CPU 2: done.
[0.32] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[0.32] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 
bytes
[0.32] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[0.32] CPU3 revision is: 0001992f (MIPS 1004Kc)
[0.38] Synchronize counters for CPU 3: done.
[0.42] smp: Brought up 1 node, 4 CPUs
[0.43] devtmpfs: initialized

Re: [PATCH] staging: wilc1000: fix compilation warning for ARCH PowerPC

2018-08-02 Thread Ajay Singh
Hi Greg,

On Thu, 2 Aug 2018 21:31:16 +0200
Greg KH  wrote:

> On Thu, Aug 02, 2018 at 04:57:02PM +0530, Ajay Singh wrote:
> > Fix below warning reported for PowerPC arch compilation
> > 
> > include/uapi/linux/byteorder/big_endian.h:95:37: warning: passing
> > argument 1 of '__swab32s' makes pointer from integer without a cast
> > [-Wint-conversion]
> > 
> > Fixes: 02211edc9a1f ("staging: wilc1000: fix endianness warnings
> > reported by sparse")
> > 
> > Signed-off-by: Ajay Singh 
> > ---  
> 
> You forgot the reported-by: line :(
> 

Sorry for the trouble.

> I'll go add it, but be more careful in the future please.
> 

Thank you for adding it up. I will take care in future patches.

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


[PATCH 2/4] staging: gasket: core: device register debug log cleanups

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

At device/driver registration time, convert a not-very-informative
info message to a more informative debug message, drop some not overly
helpful debug messages.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index fa477d0c3c74c..91db71c238804 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1735,7 +1735,8 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
int desc_idx = -1;
struct gasket_internal_desc *internal;
 
-   pr_info("Initializing Gasket framework device\n");
+   pr_debug("Loading %s driver version %s\n", driver_desc->name,
+driver_desc->driver_version);
/* Check for duplicates and find a free slot. */
mutex_lock(_mutex);
 
@@ -1764,8 +1765,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
return -EBUSY;
}
 
-   /* Internal structure setup. */
-   pr_debug("Performing initial internal structure setup.\n");
internal = _descs[desc_idx];
mutex_init(>mutex);
memset(internal->devs, 0, sizeof(struct gasket_dev *) * GASKET_DEV_MAX);
@@ -1788,7 +1787,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
 * Not using pci_register_driver() (without underscores), as it
 * depends on KBUILD_MODNAME, and this is a shared file.
 */
-   pr_debug("Registering PCI driver.\n");
ret = __pci_register_driver(>pci, driver_desc->module,
driver_desc->name);
if (ret) {
@@ -1796,7 +1794,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
goto fail1;
}
 
-   pr_debug("Registering char driver.\n");
ret = register_chrdev_region(MKDEV(driver_desc->major,
   driver_desc->minor), GASKET_DEV_MAX,
 driver_desc->name);
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 4/4] Revert "staging: gasket: core: hold reference to pci_dev while used"

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

There's no need to take an additional reference on the pci_dev structure
for the pointer copy saved in gasket data structures.

This reverts commit:
8dd8a48b9a7d ("staging: gasket: core: hold reference to pci_dev while used")

Reported-by: Dmitry Torokhov 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 93a4d9f08eaab..2d209e36cf372 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -255,7 +255,6 @@ static void gasket_free_dev(struct gasket_dev *gasket_dev)
internal_desc->devs[gasket_dev->dev_idx] = NULL;
mutex_unlock(_desc->mutex);
put_device(gasket_dev->dev);
-   pci_dev_put(gasket_dev->pci_dev);
kfree(gasket_dev);
 }
 
@@ -1477,7 +1476,7 @@ static int gasket_pci_probe(struct pci_dev *pci_dev,
ret = gasket_alloc_dev(internal_desc, parent, _dev, kobj_name);
if (ret)
return ret;
-   gasket_dev->pci_dev = pci_dev_get(pci_dev);
+   gasket_dev->pci_dev = pci_dev;
if (IS_ERR_OR_NULL(gasket_dev->dev_info.device)) {
pr_err("Cannot create %s device %s [ret = %ld]\n",
   driver_desc->name, gasket_dev->dev_info.name,
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 1/4] staging: gasket: core: remove registration logs

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

Remove logs for loading gasket drivers.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 2b75f100da4d3..fa477d0c3c74c 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1758,9 +1758,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
}
mutex_unlock(_mutex);
 
-   pr_info("Loaded %s driver, framework version %s\n",
-   driver_desc->name, GASKET_FRAMEWORK_VERSION);
-
if (desc_idx == -1) {
pr_err("Too many Gasket drivers loaded: %d\n",
   GASKET_FRAMEWORK_DESC_MAX);
@@ -1808,7 +1805,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
goto fail2;
}
 
-   pr_info("Driver registered successfully.\n");
return 0;
 
 fail2:
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 3/4] staging: gasket: core: add subsystem and device info to logs

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

Identify gasket as the subsystem printing various messages.
Add the driver name to appropriate messages to indicate which driver
has a problem.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 91db71c238804..93a4d9f08eaab 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -6,6 +6,9 @@
  *
  * Copyright (C) 2018 Google, Inc.
  */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "gasket_core.h"
 
 #include "gasket_interrupt.h"
@@ -208,7 +211,7 @@ static int gasket_alloc_dev(struct gasket_internal_desc 
*internal_desc,
 
gasket_dev = *pdev = kzalloc(sizeof(*gasket_dev), GFP_KERNEL);
if (!gasket_dev) {
-   pr_err("no memory for device\n");
+   pr_err("no memory for device %s\n", kobj_name);
return -ENOMEM;
}
internal_desc->devs[dev_idx] = gasket_dev;
@@ -1760,7 +1763,7 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
mutex_unlock(_mutex);
 
if (desc_idx == -1) {
-   pr_err("Too many Gasket drivers loaded: %d\n",
+   pr_err("too many drivers loaded, max %d\n",
   GASKET_FRAMEWORK_DESC_MAX);
return -EBUSY;
}
@@ -1790,7 +1793,8 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
ret = __pci_register_driver(>pci, driver_desc->module,
driver_desc->name);
if (ret) {
-   pr_err("cannot register pci driver [ret=%d]\n", ret);
+   pr_err("cannot register %s pci driver [ret=%d]\n",
+  driver_desc->name, ret);
goto fail1;
}
 
@@ -1798,7 +1802,8 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
   driver_desc->minor), GASKET_DEV_MAX,
 driver_desc->name);
if (ret) {
-   pr_err("cannot register char driver [ret=%d]\n", ret);
+   pr_err("cannot register %s char driver [ret=%d]\n",
+  driver_desc->name, ret);
goto fail2;
}
 
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 0/4 v2] staging: gasket: cleanups du jour

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

More cleanups for the gasket+apex drivers.

Patched changed in v2 from v1:
  staging: gasket: core: print driver version code at registration time
  staging: gasket: core: move driver loaded log after error cases
 Above 2 patches replaced by new patch:
staging: gasket: core: remove registration logs
  staging: gasket: core: device register debug log cleanups
 Drop explicit "gasket:" prefix, use pr_fmt instead (in following patch)
  staging: gasket: core: add subsystem and device info to error logs
 Renamed: staging: gasket: core: add subsystem and device info to logs
 Use pr_fmt for modname prefix on logs
  Revert "staging: gasket: core: hold reference to pci_dev while used"
 Fixup SHA format in commit text.

Patches dropped from v2, already merged from v1:
  staging: gasket: apex: enable power save mode by default
  staging: gasket: remove "reset type" param from framework
  staging: gasket: apex: drop reset type param

Todd Poynor (4):
  staging: gasket: core: remove registration logs
  staging: gasket: core: device register debug log cleanups
  staging: gasket: core: add subsystem and device info to logs
  Revert "staging: gasket: core: hold reference to pci_dev while used"

 drivers/staging/gasket/gasket_core.c | 27 ---
 1 file changed, 12 insertions(+), 15 deletions(-)

-- 
2.18.0.597.ga71716f1ad-goog

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


Re: [PATCH v3] staging: erofs: disable compiling temporarile

2018-08-02 Thread Chao Yu
On 2018/8/3 1:33, Greg KH wrote:
> On Thu, Aug 02, 2018 at 10:34:55PM +0800, Chao Yu wrote:
>> From: Chao Yu 
>>
>> As Stephen Rothwell reported:
>>
>> "After merging the staging tree, today's linux-next build (x86_64
>> allmodconfig) failed like this:
>>
>> drivers/staging/erofs/super.c: In function 'erofs_read_super':
>> drivers/staging/erofs/super.c:343:17: error: 'MS_RDONLY' undeclared (first 
>> use in this function); did you mean 'IS_RDONLY'?
>>   sb->s_flags |= MS_RDONLY | MS_NOATIME;
>>  ^
>>  IS_RDONLY
>> drivers/staging/erofs/super.c:343:17: note: each undeclared identifier is 
>> reported only once for each function it appears in
>> drivers/staging/erofs/super.c:343:29: error: 'MS_NOATIME' undeclared (first 
>> use in this function); did you mean 'S_NOATIME'?
>>   sb->s_flags |= MS_RDONLY | MS_NOATIME;
>>  ^~
>>  S_NOATIME
>> drivers/staging/erofs/super.c: In function 'erofs_mount':
>> drivers/staging/erofs/super.c:501:10: warning: passing argument 5 of 
>> 'mount_bdev' makes integer from pointer without a cast [-Wint-conversion]
>>, erofs_fill_super);
>>   ^~~~
>> In file included from include/linux/buffer_head.h:12:0,
>>  from drivers/staging/erofs/super.c:14:
>> include/linux/fs.h:2151:23: note: expected 'size_t {aka long unsigned int}' 
>> but argument is of type 'int (*)(struct super_block *, void *, int)'
>>  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
>>^~
>> drivers/staging/erofs/super.c:500:9: error: too few arguments to function 
>> 'mount_bdev'
>>   return mount_bdev(fs_type, flags, dev_name,
>>  ^~
>> In file included from include/linux/buffer_head.h:12:0,
>>  from drivers/staging/erofs/super.c:14:
>> include/linux/fs.h:2151:23: note: declared here
>>  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
>>^~
>> drivers/staging/erofs/super.c: At top level:
>> drivers/staging/erofs/super.c:518:20: error: initialization from 
>> incompatible pointer type [-Werror=incompatible-pointer-types]
>>   .mount  = erofs_mount,
>> ^~~
>> drivers/staging/erofs/super.c:518:20: note: (near initialization for 
>> 'erofs_fs_type.mount')
>> drivers/staging/erofs/super.c: In function 'erofs_remount':
>> drivers/staging/erofs/super.c:630:12: error: 'MS_RDONLY' undeclared (first 
>> use in this function); did you mean 'IS_RDONLY'?
>>   *flags |= MS_RDONLY;
>> ^
>> IS_RDONLY
>> drivers/staging/erofs/super.c: At top level:
>> drivers/staging/erofs/super.c:640:16: error: initialization from 
>> incompatible pointer type [-Werror=incompatible-pointer-types]
>>   .remount_fs = erofs_remount,
>> ^
>>
>> Caused by various commits creating erofs in the staging tree interacting
>> with various commits redoing the mount infrastructure in the vfs tree.
>>
>> I have disabed CONFIG_EROFS_FS for now:"
>>
>> The reason of compiling error is:
>>
>> Since -next collects and merges developing patches including common vfs
>> stuff from multi-trees, but those patches didn't cover erofs, such as:
>>
>> ('vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
>> https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=109b45090d7d3ce2797bb1ef7f70eead5bfe0ff3
>>
>> ("vfs: Require specification of size of mount data for internal mounts")
>> https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=0a191e4505a4f255e6513b49426213da69bf0e80
>>
>> Above vfs related patches has not been merged in staging tree, if we
>> submit those erofs patches to staging mailing list and after including
>> them in staging-{test,nexts} tree, it can easily cause compiling error.
>>
>> We worked out some patches to adjust those vfs change, but now we just
>> submit them to -next tree temporarily to avoid compiling error.
>>
>> For potentail conflict in between erofs and vfs changes in incoming
>> merge window, Stephen suggested that we can disable CONFIG_EROFS_FS
>> temporarily to pass merge window, and after that we can do restore by
>> reenabling CONFIG_EROFS_FS and applying those fixing patches. Also
>> Greg confirmed this solution.
>>
>> So, let's disable compiling erofs for a while.
>>
>> Suggested-by: Stephen Rothwell 
>> Signed-off-by: Gao Xiang 
>> Reviewed-by: Gao Xiang 
>> Signed-off-by: Chao Yu 
>> ---
>> v3: remain "depends on BLOCK".
>>  drivers/staging/erofs/Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/staging/erofs/Kconfig b/drivers/staging/erofs/Kconfig
>> index 663b755bf2fb..b37d994aa687 100644
>> --- a/drivers/staging/erofs/Kconfig
>> +++ b/drivers/staging/erofs/Kconfig
>> @@ -3,6 +3,7 @@
>>  config EROFS_FS
>>  tristate "EROFS filesystem support"
>>  depends on 

Re: [PATCH v3] staging: erofs: disable compiling temporarile

2018-08-02 Thread Gao Xiang
Hi Greg,

On 2018/8/3 1:33, Greg KH wrote:
> Sorry, I already took the first version in my tree.  Don't worry about
> it for now you can fix this up after 4.19-rc1 is out when we enable the
> filesystem again.
> 

OK, We will fix it and enable erofs after 4.19-rc1 is out. :)

Thanks,
Gao Xiang

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


[PATCH 17/18] staging:rtl8192u: Rename Register Constants - Style

2018-08-02 Thread John Whitmore
The four register constants, 'Current_Tx_Rate_Reg',
'Initial_Tx_Rate_Reg', 'Tx_Retry_Count_Reg' and 'RegC38_TH' all cause
checkpatch issue with CamelCase naming. The three have been renamed to
'CURRENT_TX_RATE_REG', 'INITIAL_TX_RATE_REG', 'TX_RETRY_COUNT_REG' and
'REG_C38_TH' respectively.

These are coding style changes which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 16 
 drivers/staging/rtl8192u/r8192U_dm.h |  8 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 0e4f55c6493f..5fb5f583f703 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2875,13 +2875,13 @@ void dm_check_fsync(struct net_device *dev)
 
if (priv->framesyncMonitor) {
if (priv->ieee80211->state == IEEE80211_LINKED) {
-   if (priv->undecorated_smoothed_pwdb <= 
RegC38_TH) {
+   if (priv->undecorated_smoothed_pwdb <= 
REG_C38_TH) {
if (reg_c38_State != 
RegC38_NonFsync_Other_AP) {
write_nic_byte(dev, 
rOFDM0_RxDetector3, 0x90);
 
reg_c38_State = 
RegC38_NonFsync_Other_AP;
}
-   } else if (priv->undecorated_smoothed_pwdb >= 
(RegC38_TH+5)) {
+   } else if (priv->undecorated_smoothed_pwdb >= 
(REG_C38_TH + 5)) {
if (reg_c38_State) {
write_nic_byte(dev, 
rOFDM0_RxDetector3, priv->framesync);
reg_c38_State = RegC38_Default;
@@ -3046,15 +3046,15 @@ static void dm_check_txrateandretrycount(struct 
net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
struct ieee80211_device *ieee = priv->ieee80211;
/* for 11n tx rate */
-   /*priv->stats.CurrentShowTxate = read_nic_byte(dev, 
Current_Tx_Rate_Reg);*/
-   read_nic_byte(dev, Current_Tx_Rate_Reg, 
>softmac_stats.CurrentShowTxate);
+   /*priv->stats.CurrentShowTxate = read_nic_byte(dev, 
CURRENT_TX_RATE_REG);*/
+   read_nic_byte(dev, CURRENT_TX_RATE_REG, 
>softmac_stats.CurrentShowTxate);
/*printk("=>tx_rate_reg:%x\n", 
ieee->softmac_stats.CurrentShowTxate);*/
/* for initial tx rate */
-   /*priv->stats.last_packet_rate = read_nic_byte(dev, 
Initial_Tx_Rate_Reg);*/
-   read_nic_byte(dev, Initial_Tx_Rate_Reg, 
>softmac_stats.last_packet_rate);
+   /*priv->stats.last_packet_rate = read_nic_byte(dev, 
INITIAL_TX_RATE_REG);*/
+   read_nic_byte(dev, INITIAL_TX_RATE_REG, 
>softmac_stats.last_packet_rate);
/* for tx tx retry count */
-   /*priv->stats.txretrycount = read_nic_dword(dev, Tx_Retry_Count_Reg);*/
-   read_nic_dword(dev, Tx_Retry_Count_Reg, 
>softmac_stats.txretrycount);
+   /*priv->stats.txretrycount = read_nic_dword(dev, TX_RETRY_COUNT_REG);*/
+   read_nic_dword(dev, TX_RETRY_COUNT_REG, 
>softmac_stats.txretrycount);
 }
 
 static void dm_send_rssi_tofw(struct net_device *dev)
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 30241d91e44a..d93817f2a45b 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -56,10 +56,10 @@
 #defineTX_POWER_ATHEROAP_THRESH_LOW72
 
 /* defined by vivi, for showing on UI */
-#defineCurrent_Tx_Rate_Reg 0x1b8
-#defineInitial_Tx_Rate_Reg   0x1b9
-#defineTx_Retry_Count_Reg 0x1ac
-#defineRegC38_TH20
+#defineCURRENT_TX_RATE_REG 0x1b8
+#defineINITIAL_TX_RATE_REG   0x1b9
+#defineTX_RETRY_COUNT_REG 0x1ac
+#defineREG_C38_TH   20
 /*--Define Parameters---*/
 
 
-- 
2.18.0

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


[PATCH 18/18] staging:rtl8192u: Clean up of spacing - Style

2018-08-02 Thread John Whitmore
Multiple blank line, which cause an issue with checkpath, have been
removed and the spacing of definitions have been aligned to look
cleaner.

These are coding style changes which should have no impact on
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.h | 123 +--
 1 file changed, 58 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index d93817f2a45b..0de0332906bd 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -21,48 +21,46 @@
 #ifndef__R8192UDM_H__
 #define __R8192UDM_H__
 
-
 /*--Define Parameters---*/
-#defineDM_DIG_THRESH_HIGH  
40
-#defineDM_DIG_THRESH_LOW   
35
+#define DM_DIG_THRESH_HIGH  40
+#define DM_DIG_THRESH_LOW   35
 
-#defineDM_DIG_HIGH_PWR_THRESH_HIGH 75
-#defineDM_DIG_HIGH_PWR_THRESH_LOW  70
+#define DM_DIG_HIGH_PWR_THRESH_HIGH 75
+#define DM_DIG_HIGH_PWR_THRESH_LOW  70
 
-#defineBW_AUTO_SWITCH_HIGH_LOW 25
-#defineBW_AUTO_SWITCH_LOW_HIGH 30
+#define BW_AUTO_SWITCH_HIGH_LOW 25
+#define BW_AUTO_SWITCH_LOW_HIGH 30
 
-#defineDM_DIG_BACKOFF  12
-#defineDM_DIG_MAX  0x36
-#defineDM_DIG_MIN  0x1c
-#defineDM_DIG_MIN_NETCORE  0x12
+#define DM_DIG_BACKOFF  12
+#define DM_DIG_MAX0x36
+#define DM_DIG_MIN0x1c
+#define DM_DIG_MIN_NETCORE0x12
 
-#defineRX_PATH_SELECTION_SS_TH_LOW 30
-#defineRX_PATH_SELECTION_DIFF_TH   18
+#define RX_PATH_SELECTION_SS_TH_LOW 30
+#define RX_PATH_SELECTION_DIFF_TH   18
 
-#defineRATE_ADAPTIVE_TH_HIGH   50
-#defineRATE_ADAPTIVE_TH_LOW_20M30
-#defineRATE_ADAPTIVE_TH_LOW_40M10
-#defineVERY_LOW_RSSI   15
-#defineCTS_TO_SELF_TH_VAL  
30
+#define RATE_ADAPTIVE_TH_HIGH   50
+#define RATE_ADAPTIVE_TH_LOW_20M30
+#define RATE_ADAPTIVE_TH_LOW_40M10
+#define VERY_LOW_RSSI   15
+#define CTS_TO_SELF_TH_VAL  30
 
 /* defined by vivi, for tx power track */
-#defineE_FOR_TX_POWER_TRACK   300
+#define E_FOR_TX_POWER_TRACK   300
 /* Dynamic Tx Power Control Threshold */
-#defineTX_POWER_NEAR_FIELD_THRESH_HIGH 68
-#defineTX_POWER_NEAR_FIELD_THRESH_LOW  62
+#define TX_POWER_NEAR_FIELD_THRESH_HIGH 68
+#define TX_POWER_NEAR_FIELD_THRESH_LOW  62
 /* added by amy for atheros AP */
 #define TX_POWER_ATHEROAP_THRESH_HIGH   78
-#defineTX_POWER_ATHEROAP_THRESH_LOW72
+#define TX_POWER_ATHEROAP_THRESH_LOW72
 
 /* defined by vivi, for showing on UI */
-#defineCURRENT_TX_RATE_REG 0x1b8
-#defineINITIAL_TX_RATE_REG   0x1b9
-#defineTX_RETRY_COUNT_REG 0x1ac
-#defineREG_C38_TH   20
+#define CURRENT_TX_RATE_REG  0x1b8
+#define INITIAL_TX_RATE_REG  0x1b9
+#define TX_RETRY_COUNT_REG   0x1ac
+#define REG_C38_TH  20
 /*--Define Parameters---*/
 
-
 /*--Define structure*/
 
 enum dig_algorithm {
@@ -78,49 +76,49 @@ enum dynamic_init_gain_state {
 
 enum dig_connect {
DIG_DISCONNECT = 0,
-   DIG_CONNECT = 1,
+   DIG_CONNECT= 1,
 };
 
 enum dig_pkt_detection_threshold {
-   DIG_PD_AT_LOW_POWER = 0,
+   DIG_PD_AT_LOW_POWER= 0,
DIG_PD_AT_NORMAL_POWER = 1,
-   DIG_PD_AT_HIGH_POWER = 2,
+   DIG_PD_AT_HIGH_POWER   = 2,
 };
 
 enum dig_cck_cs_ratio_state {
-   DIG_CS_RATIO_LOWER = 0,
+   DIG_CS_RATIO_LOWER  = 0,
DIG_CS_RATIO_HIGHER = 1,
 };
 
 /* 2007/10/04 MH Define upper and 

[PATCH 11/18] staging:rtl8192u: Remove member reserved - Style

2018-08-02 Thread John Whitmore
The structure dynamic_rx_path_sel contains a u8 member variable called
reserved. This member variable is never actually used in the code.

The naming suggests that the sizeof the structure is significant but
the only use of the structure is a local static in r8192U_dm.c:

static struct dynamic_rx_path_sel DM_RxPathSelTable;

There is no apparent significance to the sizeof the declared structure
DM_RxPathSelTable. As a result the reserved member variable has been
removed from the structure.

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 74742cb27a2c..66dfcbbf6e43 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -133,7 +133,6 @@ struct dynamic_rx_path_sel {
u8  cck_rx_path;
 
u8  disabled_rf;
-   u8  reserved;
 
u8  rf_rssi[4];
u8  rf_enable_rssi_th[4];
-- 
2.18.0

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


[PATCH 07/18] staging:rtl8192u: Rename cck_Rx_path - Style

2018-08-02 Thread John Whitmore
Rename the member variable cck_Rx_path to cck_rx_path. This clears
the checkpatch issue with CamelCase naming.

This is a coding style change which should have no impact one runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 8 
 drivers/staging/rtl8192u/r8192U_dm.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 611bf3e34bf3..495f563879c8 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2417,8 +2417,8 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
return;
 
if (!cck_Rx_Path_initialized) {
-   read_nic_byte(dev, 0xa07, _RxPathSelTable.cck_Rx_path);
-   DM_RxPathSelTable.cck_Rx_path &= 0xf;
+   read_nic_byte(dev, 0xa07, _RxPathSelTable.cck_rx_path);
+   DM_RxPathSelTable.cck_rx_path &= 0xf;
cck_Rx_Path_initialized = 1;
}
 
@@ -2573,8 +2573,8 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
}
 
if (update_cck_rx_path) {
-   DM_RxPathSelTable.cck_Rx_path = 
(cck_default_Rx<<2)|(cck_optional_Rx);
-   rtl8192_setBBreg(dev, rCCK0_AFESetting, 0x0f00, 
DM_RxPathSelTable.cck_Rx_path);
+   DM_RxPathSelTable.cck_rx_path = 
(cck_default_Rx<<2)|(cck_optional_Rx);
+   rtl8192_setBBreg(dev, rCCK0_AFESetting, 0x0f00, 
DM_RxPathSelTable.cck_rx_path);
}
 
if (DM_RxPathSelTable.disabledRF) {
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 53daec820ca7..b1f19bad2c30 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -130,7 +130,7 @@ enum cck_rx_path_method {
 
 struct dynamic_rx_path_sel {
enum cck_rx_path_method cck_method;
-   u8  cck_Rx_path;
+   u8  cck_rx_path;
 
u8  SS_TH_low;
u8  diff_TH;
-- 
2.18.0

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


[PATCH 09/18] staging:rtl8192u: Remove member diff_TH - Style

2018-08-02 Thread John Whitmore
The member variable diff_TH is assigned a constant value and then used
in a comparison. The variable is never changed so the comparison can
as easily be performed directly with the defined constant.

The member variable has been removed and the defined constant
RxPathSelection_diff_TH renamed to RX_PATH_SELECTION_DIFF_TH, to clear
the checkpatch issue with CamelCase naming.

These are coding style changes which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 3 +--
 drivers/staging/rtl8192u/r8192U_dm.h | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index f01d2f8d7fd2..d847adf57f60 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2385,7 +2385,6 @@ static void dm_init_rxpath_selection(struct net_device 
*dev)
u8 i;
struct r8192_priv *priv = ieee80211_priv(dev);
 
-   DM_RxPathSelTable.diff_TH = RxPathSelection_diff_TH;
if (priv->CustomerID == RT_CID_819x_Netcore)
DM_RxPathSelTable.cck_method = CCK_RX_VERSION_2;
else
@@ -2555,7 +2554,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
}
 
if (tmp_min_rssi < RX_PATH_SELECTION_SS_TH_LOW && disabled_rf_cnt < 2) {
-   if ((tmp_max_rssi - tmp_min_rssi) >= DM_RxPathSelTable.diff_TH) 
{
+   if ((tmp_max_rssi - tmp_min_rssi) >= RX_PATH_SELECTION_DIFF_TH) 
{
/* record the enabled rssi threshold */
DM_RxPathSelTable.rf_enable_rssi_th[min_rssi_index] = 
tmp_max_rssi+5;
/* disable the BB Rx path, OFDM */
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 0aaac0fca110..a7cce1fdd626 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -38,7 +38,7 @@
 #defineDM_DIG_MIN_Netcore  0x12
 
 #defineRX_PATH_SELECTION_SS_TH_LOW 30
-#defineRxPathSelection_diff_TH 18
+#defineRX_PATH_SELECTION_DIFF_TH   18
 
 #defineRateAdaptiveTH_High 50
 #defineRateAdaptiveTH_Low_20M  30
@@ -132,7 +132,6 @@ struct dynamic_rx_path_sel {
enum cck_rx_path_method cck_method;
u8  cck_rx_path;
 
-   u8  diff_TH;
u8  disabledRF;
u8  reserved;
 
-- 
2.18.0

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


[PATCH 05/18] staging:rtl8192u: Remove unused extern DM_RxPathSelTable - Style

2018-08-02 Thread John Whitmore
The file r8192U_dm.h defines the structure DM_RxPathSelTable as being
external. The structure is however declared in r8192U_dm.c and only
used locally in that file.

As a result the external definition has been removed and the declaration
in r8192U_dm.c changed to being of type static.

This is a coding style change which should not impact runtime code
execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 2 +-
 drivers/staging/rtl8192u/r8192U_dm.h | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 86f443ad75f5..54390587ba07 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -41,7 +41,7 @@ struct dig dm_digtable;
 /* Store current software write register content for MAC PHY. */
 u8 dm_shadow[16][256] = { {0} };
 /* For Dynamic Rx Path Selection by Signal Strength */
-struct dynamic_rx_path_sel DM_RxPathSelTable;
+static struct dynamic_rx_path_sel DM_RxPathSelTable;
 
 /*Define global variable-*/
 
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index d51c20eafef4..06ebd820de52 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -154,7 +154,6 @@ typedef struct tag_Tx_Config_Cmd_Format {
 /*Export global variable*/
 extern struct dig dm_digtable;
 extern u8 dm_shadow[16][256];
-extern struct dynamic_rx_path_sel DM_RxPathSelTable;
 /*Export global variable*/
 
 
-- 
2.18.0

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


[PATCH 15/18] staging:rtl8192u: Rename constants RateAdaptiveTH_Low_* - Style

2018-08-02 Thread John Whitmore
The two constants, RateAdaptiveTH_Low_20M and RateAdaptiveTH_Low_40M
generate a checkpatch warning about CamelCase naming. The two have been
renamed to clear this issue. RATE_ADAPTIVE_TH_LOW_20M and
RATE_ADAPTIVE_TH_LOW_40M

This is a coding style change which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_core.c | 8 
 drivers/staging/rtl8192u/r8192U_dm.c   | 8 
 drivers/staging/rtl8192u/r8192U_dm.h   | 4 ++--
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index d4a063afca55..6129ac55656f 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3082,14 +3082,14 @@ static bool HalRxCheckStuck819xUsb(struct net_device 
*dev)
if (priv->undecorated_smoothed_pwdb >= (RATE_ADAPTIVE_TH_HIGH + 5)) {
rx_chk_cnt = 0; /* high rssi, check rx stuck right now. */
} else if (priv->undecorated_smoothed_pwdb < (RATE_ADAPTIVE_TH_HIGH + 
5) &&
-  ((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_40M) ||
-   (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_20M))) {
+  ((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb >= RATE_ADAPTIVE_TH_LOW_40M) ||
+   (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb >= RATE_ADAPTIVE_TH_LOW_20M))) {
if (rx_chk_cnt < 2)
return bStuck;
 
rx_chk_cnt = 0;
-   } else if (((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_40M) ||
-   (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb < RateAdaptiveTH_Low_20M)) &&
+   } else if (((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb < RATE_ADAPTIVE_TH_LOW_40M) ||
+   (priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb < RATE_ADAPTIVE_TH_LOW_20M)) &&
 priv->undecorated_smoothed_pwdb >= VeryLowRSSI) {
if (rx_chk_cnt < 4)
return bStuck;
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index b9b751fb96c3..21107a00776f 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -244,12 +244,12 @@ void init_rate_adaptive(struct net_device *dev)
 
pra->ratr_state = DM_RATR_STA_MAX;
pra->high2low_rssi_thresh_for_ra = RATE_ADAPTIVE_TH_HIGH;
-   pra->low2high_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M+5;
-   pra->low2high_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M+5;
+   pra->low2high_rssi_thresh_for_ra20M = RATE_ADAPTIVE_TH_LOW_20M + 5;
+   pra->low2high_rssi_thresh_for_ra40M = RATE_ADAPTIVE_TH_LOW_40M + 5;
 
pra->high_rssi_thresh_for_ra = RATE_ADAPTIVE_TH_HIGH + 5;
-   pra->low_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M;
-   pra->low_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M;
+   pra->low_rssi_thresh_for_ra20M = RATE_ADAPTIVE_TH_LOW_20M;
+   pra->low_rssi_thresh_for_ra40M = RATE_ADAPTIVE_TH_LOW_40M;
 
if (priv->CustomerID == RT_CID_819x_Netcore)
pra->ping_rssi_enable = 1;
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 07e80e064f76..a1378488423b 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -41,8 +41,8 @@
 #defineRX_PATH_SELECTION_DIFF_TH   18
 
 #defineRATE_ADAPTIVE_TH_HIGH   50
-#defineRateAdaptiveTH_Low_20M  30
-#defineRateAdaptiveTH_Low_40M  10
+#defineRATE_ADAPTIVE_TH_LOW_20M30
+#defineRATE_ADAPTIVE_TH_LOW_40M10
 #defineVeryLowRSSI 15
 #defineCTSToSelfTHVal  30
 
-- 
2.18.0

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


[PATCH 16/18] staging:rtl8192u: Rename constants - Style

2018-08-02 Thread John Whitmore
The constants 'VeryLowRSSI' and 'CTSToSelfTHVal' generate warnings from
checkpatch due to the use of CamelCase naming. The two constants have
been renamed to 'VERY_LOW_RSSI' and 'CTS_TO_SELF_TH_VAL' respectively.

These are coding style changes which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_core.c | 2 +-
 drivers/staging/rtl8192u/r8192U_dm.c   | 2 +-
 drivers/staging/rtl8192u/r8192U_dm.h   | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 6129ac55656f..e218b5c20642 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3090,7 +3090,7 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev)
rx_chk_cnt = 0;
} else if (((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb < RATE_ADAPTIVE_TH_LOW_40M) ||
(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb < RATE_ADAPTIVE_TH_LOW_20M)) &&
-priv->undecorated_smoothed_pwdb >= VeryLowRSSI) {
+priv->undecorated_smoothed_pwdb >= VERY_LOW_RSSI) {
if (rx_chk_cnt < 4)
return bStuck;
 
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 21107a00776f..0e4f55c6493f 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2268,7 +2268,7 @@ static void dm_init_ctstoself(struct net_device *dev)
struct r8192_priv *priv = ieee80211_priv(dev);
 
priv->ieee80211->bCTSToSelfEnable = true;
-   priv->ieee80211->CTSToSelfTH = CTSToSelfTHVal;
+   priv->ieee80211->CTSToSelfTH = CTS_TO_SELF_TH_VAL;
 }
 
 static void dm_ctstoself(struct net_device *dev)
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index a1378488423b..30241d91e44a 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -43,8 +43,8 @@
 #defineRATE_ADAPTIVE_TH_HIGH   50
 #defineRATE_ADAPTIVE_TH_LOW_20M30
 #defineRATE_ADAPTIVE_TH_LOW_40M10
-#defineVeryLowRSSI 15
-#defineCTSToSelfTHVal  30
+#defineVERY_LOW_RSSI   15
+#defineCTS_TO_SELF_TH_VAL  
30
 
 /* defined by vivi, for tx power track */
 #defineE_FOR_TX_POWER_TRACK   300
-- 
2.18.0

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


[PATCH 14/18] staging:rtl8192u: Rename RateAdaptiveTH_High - Style

2018-08-02 Thread John Whitmore
The constant RateAdaptiveTH_High causes a checkpatch issue with respect
to CamelCase naming. As a result the constant has been renamed to
RATE_ADAPTIVE_TH_HIGH.

This is purely a coding style change which should have no impact on
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_core.c | 4 ++--
 drivers/staging/rtl8192u/r8192U_dm.c   | 4 ++--
 drivers/staging/rtl8192u/r8192U_dm.h   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 28592a8d6dd0..d4a063afca55 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -3079,9 +3079,9 @@ static bool HalRxCheckStuck819xUsb(struct net_device *dev)
 * or maybe it will continuous silent reset every 2 seconds.
 */
rx_chk_cnt++;
-   if (priv->undecorated_smoothed_pwdb >= (RateAdaptiveTH_High + 5)) {
+   if (priv->undecorated_smoothed_pwdb >= (RATE_ADAPTIVE_TH_HIGH + 5)) {
rx_chk_cnt = 0; /* high rssi, check rx stuck right now. */
-   } else if (priv->undecorated_smoothed_pwdb < (RateAdaptiveTH_High + 5) 
&&
+   } else if (priv->undecorated_smoothed_pwdb < (RATE_ADAPTIVE_TH_HIGH + 
5) &&
   ((priv->CurrentChannelBW != HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_40M) ||
(priv->CurrentChannelBW == HT_CHANNEL_WIDTH_20 && 
priv->undecorated_smoothed_pwdb >= RateAdaptiveTH_Low_20M))) {
if (rx_chk_cnt < 2)
diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 3043b84e9237..b9b751fb96c3 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -243,11 +243,11 @@ void init_rate_adaptive(struct net_device *dev)
prate_adaptive  pra = (prate_adaptive)>rate_adaptive;
 
pra->ratr_state = DM_RATR_STA_MAX;
-   pra->high2low_rssi_thresh_for_ra = RateAdaptiveTH_High;
+   pra->high2low_rssi_thresh_for_ra = RATE_ADAPTIVE_TH_HIGH;
pra->low2high_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M+5;
pra->low2high_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M+5;
 
-   pra->high_rssi_thresh_for_ra = RateAdaptiveTH_High+5;
+   pra->high_rssi_thresh_for_ra = RATE_ADAPTIVE_TH_HIGH + 5;
pra->low_rssi_thresh_for_ra20M = RateAdaptiveTH_Low_20M;
pra->low_rssi_thresh_for_ra40M = RateAdaptiveTH_Low_40M;
 
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 655b1afd9294..07e80e064f76 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -40,7 +40,7 @@
 #defineRX_PATH_SELECTION_SS_TH_LOW 30
 #defineRX_PATH_SELECTION_DIFF_TH   18
 
-#defineRateAdaptiveTH_High 50
+#defineRATE_ADAPTIVE_TH_HIGH   50
 #defineRateAdaptiveTH_Low_20M  30
 #defineRateAdaptiveTH_Low_40M  10
 #defineVeryLowRSSI 15
-- 
2.18.0

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


[PATCH 13/18] staging:rtl8192u: Rename DM_DIG_MIN_Netcore - Style

2018-08-02 Thread John Whitmore
The constant DM_DIG_MIN_Netcore causes a checkpatch issue with CamelCase
naming so has been renamed to DM_DIG_MIN_NETCORE.

This is a simple coding style change which should have no impact on
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 2 +-
 drivers/staging/rtl8192u/r8192U_dm.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 4c8f674cf54d..3043b84e9237 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -1650,7 +1650,7 @@ static void dm_dig_init(struct net_device *dev)
dm_digtable.rssi_val = 50;  /* for new dig debug rssi value */
dm_digtable.backoff_val = DM_DIG_BACKOFF;
if (priv->CustomerID == RT_CID_819x_Netcore)
-   dm_digtable.rx_gain_range_min = DM_DIG_MIN_Netcore;
+   dm_digtable.rx_gain_range_min = DM_DIG_MIN_NETCORE;
else
dm_digtable.rx_gain_range_min = DM_DIG_MIN;
 
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 9a0105412350..655b1afd9294 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -35,7 +35,7 @@
 #defineDM_DIG_BACKOFF  12
 #defineDM_DIG_MAX  0x36
 #defineDM_DIG_MIN  0x1c
-#defineDM_DIG_MIN_Netcore  0x12
+#defineDM_DIG_MIN_NETCORE  0x12
 
 #defineRX_PATH_SELECTION_SS_TH_LOW 30
 #defineRX_PATH_SELECTION_DIFF_TH   18
-- 
2.18.0

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


[PATCH 06/18] staging:rtl8192u: Remove member variable Enable - Style

2018-08-02 Thread John Whitmore
The structure dynamic_rx_path_sel defines a member variable 'Enable'
which is initialised and later tested. The variable is however never
changed to the test is redundant and the member variable is then never
used.

The member variable, initialisation and test have all been removed.

This is a coding style change which should not impact runtime code
execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 3 ---
 drivers/staging/rtl8192u/r8192U_dm.h | 1 -
 2 files changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 54390587ba07..611bf3e34bf3 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2376,8 +2376,6 @@ void dm_rf_pathcheck_workitemcallback(struct work_struct 
*work)
else
priv->brfpath_rxenable[i] = false;
}
-   if (!DM_RxPathSelTable.Enable)
-   return;
 
dm_rxpath_sel_byrssi(dev);
 }  /* DM_RFPathCheckWorkItemCallBack */
@@ -2387,7 +2385,6 @@ static void dm_init_rxpath_selection(struct net_device 
*dev)
u8 i;
struct r8192_priv *priv = ieee80211_priv(dev);
 
-   DM_RxPathSelTable.Enable = 1;   /* default enabled */
DM_RxPathSelTable.SS_TH_low = RxPathSelection_SS_TH_low;
DM_RxPathSelTable.diff_TH = RxPathSelection_diff_TH;
if (priv->CustomerID == RT_CID_819x_Netcore)
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 06ebd820de52..53daec820ca7 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -129,7 +129,6 @@ enum cck_rx_path_method {
 };
 
 struct dynamic_rx_path_sel {
-   u8  Enable;
enum cck_rx_path_method cck_method;
u8  cck_Rx_path;
 
-- 
2.18.0

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


[PATCH 08/18] staging:rtl8192u: Remove SS_TH_low - Style

2018-08-02 Thread John Whitmore
The member variable SS_TH_low is assigned a constant and then used
in a comparison. This member variable is redundant as the constant
can be used directly for the comparison.

In addition the constant RxPathSelection_SS_TH_low has been renamed
to RX_PATH_SELECTION_SS_TH_LOW, to clear the checkpatch issue with
CamelCase naming.

These changes are coding style in nature and should not impact
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 3 +--
 drivers/staging/rtl8192u/r8192U_dm.h | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 495f563879c8..f01d2f8d7fd2 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2385,7 +2385,6 @@ static void dm_init_rxpath_selection(struct net_device 
*dev)
u8 i;
struct r8192_priv *priv = ieee80211_priv(dev);
 
-   DM_RxPathSelTable.SS_TH_low = RxPathSelection_SS_TH_low;
DM_RxPathSelTable.diff_TH = RxPathSelection_diff_TH;
if (priv->CustomerID == RT_CID_819x_Netcore)
DM_RxPathSelTable.cck_method = CCK_RX_VERSION_2;
@@ -2555,7 +2554,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
update_cck_rx_path = 1;
}
 
-   if (tmp_min_rssi < DM_RxPathSelTable.SS_TH_low && disabled_rf_cnt < 2) {
+   if (tmp_min_rssi < RX_PATH_SELECTION_SS_TH_LOW && disabled_rf_cnt < 2) {
if ((tmp_max_rssi - tmp_min_rssi) >= DM_RxPathSelTable.diff_TH) 
{
/* record the enabled rssi threshold */
DM_RxPathSelTable.rf_enable_rssi_th[min_rssi_index] = 
tmp_max_rssi+5;
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index b1f19bad2c30..0aaac0fca110 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -37,7 +37,7 @@
 #defineDM_DIG_MIN  0x1c
 #defineDM_DIG_MIN_Netcore  0x12
 
-#defineRxPathSelection_SS_TH_low   30
+#defineRX_PATH_SELECTION_SS_TH_LOW 30
 #defineRxPathSelection_diff_TH 18
 
 #defineRateAdaptiveTH_High 50
@@ -132,7 +132,6 @@ struct dynamic_rx_path_sel {
enum cck_rx_path_method cck_method;
u8  cck_rx_path;
 
-   u8  SS_TH_low;
u8  diff_TH;
u8  disabledRF;
u8  reserved;
-- 
2.18.0

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


[PATCH 10/18] staging:rtl8192u: Rename member disabledRF - Style

2018-08-02 Thread John Whitmore
Rename the member variable disabledRF to disabled_rf. This change
resolves the checkpatch issue with CamelCase naming.

The change is purely a coding style change which should have no impact
on runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 10 +-
 drivers/staging/rtl8192u/r8192U_dm.h |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index d847adf57f60..6f17732d038d 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2389,7 +2389,7 @@ static void dm_init_rxpath_selection(struct net_device 
*dev)
DM_RxPathSelTable.cck_method = CCK_RX_VERSION_2;
else
DM_RxPathSelTable.cck_method = CCK_RX_VERSION_1;
-   DM_RxPathSelTable.disabledRF = 0;
+   DM_RxPathSelTable.disabled_rf = 0;
for (i = 0; i < 4; i++) {
DM_RxPathSelTable.rf_rssi[i] = 50;
DM_RxPathSelTable.cck_pwdb_sta[i] = -64;
@@ -2420,8 +2420,8 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
cck_Rx_Path_initialized = 1;
}
 
-   read_nic_byte(dev, 0xc04, _RxPathSelTable.disabledRF);
-   DM_RxPathSelTable.disabledRF = ~DM_RxPathSelTable.disabledRF & 0xf;
+   read_nic_byte(dev, 0xc04, _RxPathSelTable.disabled_rf);
+   DM_RxPathSelTable.disabled_rf = ~DM_RxPathSelTable.disabled_rf & 0xf;
 
if (priv->ieee80211->mode == WIRELESS_MODE_B) {
DM_RxPathSelTable.cck_method = CCK_RX_VERSION_2;/* pure 
B mode, fixed cck version2 */
@@ -2575,9 +2575,9 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
rtl8192_setBBreg(dev, rCCK0_AFESetting, 0x0f00, 
DM_RxPathSelTable.cck_rx_path);
}
 
-   if (DM_RxPathSelTable.disabledRF) {
+   if (DM_RxPathSelTable.disabled_rf) {
for (i = 0; i < 4; i++) {
-   if ((DM_RxPathSelTable.disabledRF>>i) & 0x1) {  /* 
disabled rf */
+   if ((DM_RxPathSelTable.disabled_rf >> i) & 0x1) {   
/* disabled rf */
if (tmp_max_rssi >= 
DM_RxPathSelTable.rf_enable_rssi_th[i]) {
/* enable the BB Rx path */
/*DbgPrint("RF-%d is enabled.\n", 
0x1

[PATCH 12/18] staging:rtl8192u: Refactor DCMD_TXCMD_T structure - Style

2018-08-02 Thread John Whitmore
The structure DCMD_TXCMD_T is declared with a typedef, which causes a
checkpatch issue with defining new types. As a result the typedef has
been removed.

The structure's name DCMD_TXCMD_T, as a type, is meant to be lowercase
so has been renamed to tx_config_cmd.

The structures three members, (Op, Length, and Value) are all violating
the coding standard policy on CamelCase naming, so have all been renamed.
They have been renamed with longer names, (cmd_op, cmd_length and
cmd_value), to make the variable names easier to search for in code.

The magic numbers '4' and '12' have both been replaced with sizeof()
calls, as they both represent the size of data elements.

These are coding style changes which should have no impact on runtime
code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 10 +-
 drivers/staging/rtl8192u/r8192U_dm.h | 11 ++-
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 6f17732d038d..4c8f674cf54d 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -510,7 +510,7 @@ static void dm_TXPowerTrackingCallback_TSSI(struct 
net_device *dev)
 {
struct r8192_priv *priv = ieee80211_priv(dev);
boolviviflag = false;
-   DCMD_TXCMD_Ttx_cmd;
+   struct tx_config_cmdtx_cmd;
u8  powerlevelOFDM24G;
int i = 0, j = 0, k = 0;
u8  RF_Type, tmp_report[5] 
= {0, 0, 0, 0, 0};
@@ -532,10 +532,10 @@ static void dm_TXPowerTrackingCallback_TSSI(struct 
net_device *dev)
RT_TRACE(COMP_POWER_TRACKING, "powerlevelOFDM24G = %x\n", 
powerlevelOFDM24G);
 
for (j = 0; j <= 30; j++) { /* fill tx_cmd */
-   tx_cmd.Op = TXCMD_SET_TX_PWR_TRACKING;
-   tx_cmd.Length = 4;
-   tx_cmd.Value = Value;
-   rtStatus = SendTxCommandPacket(dev, _cmd, 12);
+   tx_cmd.cmd_op = TXCMD_SET_TX_PWR_TRACKING;
+   tx_cmd.cmd_length = sizeof(tx_cmd.cmd_op);
+   tx_cmd.cmd_value = Value;
+   rtStatus = SendTxCommandPacket(dev, _cmd, sizeof(struct 
tx_config_cmd));
if (rtStatus == RT_STATUS_FAILURE)
RT_TRACE(COMP_POWER_TRACKING, "Set configuration with 
tx cmd queue fail!\n");
usleep_range(1000, 2000);
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 66dfcbbf6e43..9a0105412350 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -139,11 +139,12 @@ struct dynamic_rx_path_sel {
longcck_pwdb_sta[4];
 };
 
-typedef struct tag_Tx_Config_Cmd_Format {
-   u32 Op; /* Command packet type. */
-   u32 Length; /* Command packet length. */
-   u32 Value;
-} DCMD_TXCMD_T, *PDCMD_TXCMD_T;
+struct tx_config_cmd {
+   u32 cmd_op; /* Command packet type. */
+   u32 cmd_length; /* Command packet length. */
+   u32 cmd_value;
+};
+
 /*--Define structure*/
 
 
-- 
2.18.0

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


[PATCH 00/18] staging:rtl8192u: Clean up ofr8192U_dm.h

2018-08-02 Thread John Whitmore
This series of patches is a clean up of the file:
drivers/staging/rtl8192u/r8192U_dm.h

Whilst I consider all the changes to be coding style changes some have
removed structure member variables which were not implementing any
logic, which required them to be a member of a structure. The first
patch removes member variables from two separate structures which
seem to have been intended to add functionality for debugging. Whether
that feature was forgotten about I'm not sure but as it serves no
purpose both member variables were removed.

I hope I've not missed something 

John Whitmore (18):
  staging:rtl8192u: Remove debug member from structures - Style
  staging:rtl8192u: Remove member variable rx_gain_range_max - Style
  staging:rtl8192u: Remove member initialgain_lowerbound_state - Style
  staging:rtl8192u: Rename enum constants - Style
  staging:rtl8192u: Remove unused extern DM_RxPathSelTable - Style
  staging:rtl8192u: Remove member variable Enable - Style
  staging:rtl8192u: Rename cck_Rx_path - Style
  staging:rtl8192u: Remove SS_TH_low - Style
  staging:rtl8192u: Remove member diff_TH - Style
  staging:rtl8192u: Rename member disabledRF - Style
  staging:rtl8192u: Remove member reserved - Style
  staging:rtl8192u: Refactor DCMD_TXCMD_T structure - Style
  staging:rtl8192u: Rename DM_DIG_MIN_Netcore - Style
  staging:rtl8192u: Rename RateAdaptiveTH_High - Style
  staging:rtl8192u: Rename constants RateAdaptiveTH_Low_* - Style
  staging:rtl8192u: Rename constants - Style
  staging:rtl8192u: Rename Register Constants - Style
  staging:rtl8192u: Clean up of spacing - Style

 drivers/staging/rtl8192u/r8192U_core.c |  14 +--
 drivers/staging/rtl8192u/r8192U_dm.c   |  97 +++-
 drivers/staging/rtl8192u/r8192U_dm.h   | 151 +++--
 3 files changed, 115 insertions(+), 147 deletions(-)

-- 
2.18.0

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


[PATCH 02/18] staging:rtl8192u: Remove member variable rx_gain_range_max - Style

2018-08-02 Thread John Whitmore
The structure 'dig' defines a member variable, (rx_gain_range_max)
which is initialised to the value 'DM_DIG_MAX', (a defined constant).
The variable is then used to test and set another variable. Since
the member rx_gain_range_max is never assigned any other value then
the constant 'DM_DIG_MAX' the code might as well simply use that
constant, rather the a member variable set to that constant.

The member variable has been removed and the constant used directly
in the code. This is a coding style change which should not impact
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 5 ++---
 drivers/staging/rtl8192u/r8192U_dm.h | 1 -
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 3336798310ac..8b9d011e9eec 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -1650,7 +1650,6 @@ static void dm_dig_init(struct net_device *dev)
 
dm_digtable.rssi_val = 50;  /* for new dig debug rssi value */
dm_digtable.backoff_val = DM_DIG_BACKOFF;
-   dm_digtable.rx_gain_range_max = DM_DIG_MAX;
if (priv->CustomerID == RT_CID_819x_Netcore)
dm_digtable.rx_gain_range_min = DM_DIG_MIN_Netcore;
else
@@ -1968,8 +1967,8 @@ static void dm_initial_gain(
 
if (dm_digtable.pre_connect_state == dm_digtable.cur_connect_state) {
if (dm_digtable.cur_connect_state == DIG_CONNECT) {
-   if ((dm_digtable.rssi_val+10-dm_digtable.backoff_val) > 
dm_digtable.rx_gain_range_max)
-   dm_digtable.cur_ig_value = 
dm_digtable.rx_gain_range_max;
+   if ((dm_digtable.rssi_val + 10 - 
dm_digtable.backoff_val) > DM_DIG_MAX)
+   dm_digtable.cur_ig_value = DM_DIG_MAX;
else if 
((dm_digtable.rssi_val+10-dm_digtable.backoff_val) < 
dm_digtable.rx_gain_range_min)
dm_digtable.cur_ig_value = 
dm_digtable.rx_gain_range_min;
else
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index bc736f2f5a5c..f3e3db18fdd0 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -118,7 +118,6 @@ struct dig {
u32 cur_ig_value;
 
u8  backoff_val;
-   u8  rx_gain_range_max;
u8  rx_gain_range_min;
boolinitialgain_lowerbound_state;
 
-- 
2.18.0

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


[PATCH 03/18] staging:rtl8192u: Remove member initialgain_lowerbound_state - Style

2018-08-02 Thread John Whitmore
The structure 'dig' defines a member variable
'initialgain_lowerbound_state', which although initialised to false,
is never used in the code. As a result this unused member variable
has been removed.

This is a coding style change which should not impact runtime code
execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 1 -
 drivers/staging/rtl8192u/r8192U_dm.h | 1 -
 2 files changed, 2 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 8b9d011e9eec..ede596a91c03 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -1640,7 +1640,6 @@ static void dm_dig_init(struct net_device *dev)
/* 2007/10/04 MH Define init gain threshold. */
dm_digtable.dig_state   = DM_STA_DIG_MAX;
dm_digtable.dig_highpwr_state   = DM_STA_DIG_MAX;
-   dm_digtable.initialgain_lowerbound_state = false;
 
dm_digtable.rssi_low_thresh = DM_DIG_THRESH_LOW;
dm_digtable.rssi_high_thresh= DM_DIG_THRESH_HIGH;
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index f3e3db18fdd0..ba73dd1d1793 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -119,7 +119,6 @@ struct dig {
 
u8  backoff_val;
u8  rx_gain_range_min;
-   boolinitialgain_lowerbound_state;
 
longrssi_val;
 };
-- 
2.18.0

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


[PATCH 01/18] staging:rtl8192u: Remove debug member from structures - Style

2018-08-02 Thread John Whitmore
Two structures, (struct dig and struct dynamic_rx_path_sel) contain
a u8 member variable representing debug setting. In the file r8192U_dm.c
these member variables, for both structures, are initialised to an
enumerated constant 'DM_DBG_OFF'. The member variables are never
assigned another value, other then off. Later in code the member
variables are tested to for equality to 'DM_DBG_OFF' and if that is the
case an assignment statement is executed.

Since the value of the variables is always off the test is redundant and
the conditional branch can just be executed without the test. Since the
member variables are then actually used both have been removed, along
with the enumerated type which defines debug status, on/off.

These are coding style changes to remove unused or redundant code, there
should be no impact on runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 8 ++--
 drivers/staging/rtl8192u/r8192U_dm.h | 8 
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index 0ba1b1e2bc6e..3336798310ac 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -1635,7 +1635,6 @@ static void dm_dig_init(struct net_device *dev)
/* 2007/10/05 MH Disable DIG scheme now. Not tested. */
dm_digtable.dig_enable_flag = true;
dm_digtable.dig_algorithm = DIG_ALGO_BY_RSSI;
-   dm_digtable.dbg_mode = DM_DBG_OFF;  /* off=by real rssi value, 
on=by DM_DigTable.Rssi_val for new dig */
dm_digtable.dig_algorithm_switch = 0;
 
/* 2007/10/04 MH Define init gain threshold. */
@@ -1720,8 +1719,7 @@ static void dm_ctrl_initgain_byrssi_by_driverrssi(
/*DbgPrint("DM_DigTable.PreConnectState = %d, 
DM_DigTable.CurConnectState = %d\n",
DM_DigTable.PreConnectState, DM_DigTable.CurConnectState);*/
 
-   if (dm_digtable.dbg_mode == DM_DBG_OFF)
-   dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb;
+   dm_digtable.rssi_val = priv->undecorated_smoothed_pwdb;
/*DbgPrint("DM_DigTable.Rssi_val = %d\n", DM_DigTable.Rssi_val);*/
dm_initial_gain(dev);
dm_pd_th(dev);
@@ -2398,7 +2396,6 @@ static void dm_init_rxpath_selection(struct net_device 
*dev)
DM_RxPathSelTable.cck_method = CCK_Rx_Version_2;
else
DM_RxPathSelTable.cck_method = CCK_Rx_Version_1;
-   DM_RxPathSelTable.DbgMode = DM_DBG_OFF;
DM_RxPathSelTable.disabledRF = 0;
for (i = 0; i < 4; i++) {
DM_RxPathSelTable.rf_rssi[i] = 50;
@@ -2440,8 +2437,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
 
/* decide max/sec/min rssi index */
for (i = 0; i < RF90_PATH_MAX; i++) {
-   if (!DM_RxPathSelTable.DbgMode)
-   DM_RxPathSelTable.rf_rssi[i] = 
priv->stats.rx_rssi_percentage[i];
+   DM_RxPathSelTable.rf_rssi[i] = 
priv->stats.rx_rssi_percentage[i];
 
if (priv->brfpath_rxenable[i]) {
rf_num++;
diff --git a/drivers/staging/rtl8192u/r8192U_dm.h 
b/drivers/staging/rtl8192u/r8192U_dm.h
index 2ba6a4208870..bc736f2f5a5c 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.h
+++ b/drivers/staging/rtl8192u/r8192U_dm.h
@@ -96,7 +96,6 @@ enum dig_cck_cs_ratio_state {
 struct dig {
u8  dig_enable_flag;
enum dig_algorithm  dig_algorithm;
-   u8  dbg_mode;
u8  dig_algorithm_switch;
 
longrssi_low_thresh;
@@ -133,7 +132,6 @@ enum cck_rx_path_method {
 
 struct dynamic_rx_path_sel {
u8  Enable;
-   u8  DbgMode;
enum cck_rx_path_method cck_method;
u8  cck_Rx_path;
 
@@ -147,12 +145,6 @@ struct dynamic_rx_path_sel {
longcck_pwdb_sta[4];
 };
 
-typedef enum tag_DM_DbgMode_Definition {
-   DM_DBG_OFF = 0,
-   DM_DBG_ON = 1,
-   DM_DBG_MAX
-} DM_DBG_E;
-
 typedef struct tag_Tx_Config_Cmd_Format {
u32 Op; /* Command packet type. */
u32 Length; /* Command packet length. */
-- 
2.18.0

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


[PATCH 04/18] staging:rtl8192u: Rename enum constants - Style

2018-08-02 Thread John Whitmore
Rename the two constants defined in the enumerated type enum
cck_rx_path_method so that they are both uppercase, as suggested by
the coding style.

This is purely a coding style change and should have no impact on
runtime code execution.

Signed-off-by: John Whitmore 
---
 drivers/staging/rtl8192u/r8192U_dm.c | 12 ++--
 drivers/staging/rtl8192u/r8192U_dm.h |  4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_dm.c 
b/drivers/staging/rtl8192u/r8192U_dm.c
index ede596a91c03..86f443ad75f5 100644
--- a/drivers/staging/rtl8192u/r8192U_dm.c
+++ b/drivers/staging/rtl8192u/r8192U_dm.c
@@ -2391,9 +2391,9 @@ static void dm_init_rxpath_selection(struct net_device 
*dev)
DM_RxPathSelTable.SS_TH_low = RxPathSelection_SS_TH_low;
DM_RxPathSelTable.diff_TH = RxPathSelection_diff_TH;
if (priv->CustomerID == RT_CID_819x_Netcore)
-   DM_RxPathSelTable.cck_method = CCK_Rx_Version_2;
+   DM_RxPathSelTable.cck_method = CCK_RX_VERSION_2;
else
-   DM_RxPathSelTable.cck_method = CCK_Rx_Version_1;
+   DM_RxPathSelTable.cck_method = CCK_RX_VERSION_1;
DM_RxPathSelTable.disabledRF = 0;
for (i = 0; i < 4; i++) {
DM_RxPathSelTable.rf_rssi[i] = 50;
@@ -2429,7 +2429,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
DM_RxPathSelTable.disabledRF = ~DM_RxPathSelTable.disabledRF & 0xf;
 
if (priv->ieee80211->mode == WIRELESS_MODE_B) {
-   DM_RxPathSelTable.cck_method = CCK_Rx_Version_2;/* pure 
B mode, fixed cck version2 */
+   DM_RxPathSelTable.cck_method = CCK_RX_VERSION_2;/* pure 
B mode, fixed cck version2 */
/*DbgPrint("Pure B mode, use cck rx version2\n");*/
}
 
@@ -2493,7 +2493,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
 
rf_num = 0;
/* decide max/sec/min cck pwdb index */
-   if (DM_RxPathSelTable.cck_method == CCK_Rx_Version_2) {
+   if (DM_RxPathSelTable.cck_method == CCK_RX_VERSION_2) {
for (i = 0; i < RF90_PATH_MAX; i++) {
if (priv->brfpath_rxenable[i]) {
rf_num++;
@@ -2551,7 +2551,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
 * reg0xA07[3:2]=cck default rx path, reg0xa07[1:0]=cck optional rx 
path.
 */
update_cck_rx_path = 0;
-   if (DM_RxPathSelTable.cck_method == CCK_Rx_Version_2) {
+   if (DM_RxPathSelTable.cck_method == CCK_RX_VERSION_2) {
cck_default_Rx = cck_rx_ver2_max_index;
cck_optional_Rx = cck_rx_ver2_sec_index;
if (tmp_cck_max_pwdb != -64)
@@ -2567,7 +2567,7 @@ static void dm_rxpath_sel_byrssi(struct net_device *dev)
rtl8192_setBBreg(dev, rOFDM1_TRxPathEnable, 
0x1

Re: [PATCH] staging: wilc1000: fix compilation warning for ARCH PowerPC

2018-08-02 Thread Greg KH
On Thu, Aug 02, 2018 at 04:57:02PM +0530, Ajay Singh wrote:
> Fix below warning reported for PowerPC arch compilation
> 
> include/uapi/linux/byteorder/big_endian.h:95:37: warning: passing
> argument 1 of '__swab32s' makes pointer from integer without a cast
> [-Wint-conversion]
> 
> Fixes: 02211edc9a1f ("staging: wilc1000: fix endianness warnings
> reported by sparse")
> 
> Signed-off-by: Ajay Singh 
> ---

You forgot the reported-by: line :(

I'll go add it, but be more careful in the future please.

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


[PATCH char-misc 1/1] Drivers: hv: vmbus: Fix synic per-cpu context initialization

2018-08-02 Thread mhkelley58
From: Michael Kelley 

If hv_synic_alloc() errors out, the state of the per-cpu context
for some CPUs is unknown since the zero'ing is done as each
CPU is iterated over.  In such case, hv_synic_cleanup() may try to
free memory based on uninitialized values.  Fix this by zero'ing
the per-cpu context for all CPUs before doing any memory
allocations that might fail.

Signed-off-by: Michael Kelley 
Reported-by: Dan Carpenter 
---
 drivers/hv/hv.c | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
index 1fb9a6b..7703df2 100644
--- a/drivers/hv/hv.c
+++ b/drivers/hv/hv.c
@@ -187,6 +187,17 @@ static void hv_init_clockevent_device(struct 
clock_event_device *dev, int cpu)
 int hv_synic_alloc(void)
 {
int cpu;
+   struct hv_per_cpu_context *hv_cpu;
+
+   /*
+* First, zero all per-cpu memory areas so hv_synic_free() can
+* detect what memory has been allocated and cleanup properly
+* after any failures.
+*/
+   for_each_present_cpu(cpu) {
+   hv_cpu = per_cpu_ptr(hv_context.cpu_context, cpu);
+   memset(hv_cpu, 0, sizeof(*hv_cpu));
+   }
 
hv_context.hv_numa_map = kcalloc(nr_node_ids, sizeof(struct cpumask),
 GFP_KERNEL);
@@ -196,10 +207,8 @@ int hv_synic_alloc(void)
}
 
for_each_present_cpu(cpu) {
-   struct hv_per_cpu_context *hv_cpu
-   = per_cpu_ptr(hv_context.cpu_context, cpu);
+   hv_cpu = per_cpu_ptr(hv_context.cpu_context, cpu);
 
-   memset(hv_cpu, 0, sizeof(*hv_cpu));
tasklet_init(_cpu->msg_dpc,
 vmbus_on_msg_dpc, (unsigned long) hv_cpu);
 
-- 
1.8.3.1

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


Re: [PATCH v3] staging: erofs: disable compiling temporarile

2018-08-02 Thread Greg KH
On Thu, Aug 02, 2018 at 10:34:55PM +0800, Chao Yu wrote:
> From: Chao Yu 
> 
> As Stephen Rothwell reported:
> 
> "After merging the staging tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
> 
> drivers/staging/erofs/super.c: In function 'erofs_read_super':
> drivers/staging/erofs/super.c:343:17: error: 'MS_RDONLY' undeclared (first 
> use in this function); did you mean 'IS_RDONLY'?
>   sb->s_flags |= MS_RDONLY | MS_NOATIME;
>  ^
>  IS_RDONLY
> drivers/staging/erofs/super.c:343:17: note: each undeclared identifier is 
> reported only once for each function it appears in
> drivers/staging/erofs/super.c:343:29: error: 'MS_NOATIME' undeclared (first 
> use in this function); did you mean 'S_NOATIME'?
>   sb->s_flags |= MS_RDONLY | MS_NOATIME;
>  ^~
>  S_NOATIME
> drivers/staging/erofs/super.c: In function 'erofs_mount':
> drivers/staging/erofs/super.c:501:10: warning: passing argument 5 of 
> 'mount_bdev' makes integer from pointer without a cast [-Wint-conversion]
>, erofs_fill_super);
>   ^~~~
> In file included from include/linux/buffer_head.h:12:0,
>  from drivers/staging/erofs/super.c:14:
> include/linux/fs.h:2151:23: note: expected 'size_t {aka long unsigned int}' 
> but argument is of type 'int (*)(struct super_block *, void *, int)'
>  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
>^~
> drivers/staging/erofs/super.c:500:9: error: too few arguments to function 
> 'mount_bdev'
>   return mount_bdev(fs_type, flags, dev_name,
>  ^~
> In file included from include/linux/buffer_head.h:12:0,
>  from drivers/staging/erofs/super.c:14:
> include/linux/fs.h:2151:23: note: declared here
>  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
>^~
> drivers/staging/erofs/super.c: At top level:
> drivers/staging/erofs/super.c:518:20: error: initialization from incompatible 
> pointer type [-Werror=incompatible-pointer-types]
>   .mount  = erofs_mount,
> ^~~
> drivers/staging/erofs/super.c:518:20: note: (near initialization for 
> 'erofs_fs_type.mount')
> drivers/staging/erofs/super.c: In function 'erofs_remount':
> drivers/staging/erofs/super.c:630:12: error: 'MS_RDONLY' undeclared (first 
> use in this function); did you mean 'IS_RDONLY'?
>   *flags |= MS_RDONLY;
> ^
> IS_RDONLY
> drivers/staging/erofs/super.c: At top level:
> drivers/staging/erofs/super.c:640:16: error: initialization from incompatible 
> pointer type [-Werror=incompatible-pointer-types]
>   .remount_fs = erofs_remount,
> ^
> 
> Caused by various commits creating erofs in the staging tree interacting
> with various commits redoing the mount infrastructure in the vfs tree.
> 
> I have disabed CONFIG_EROFS_FS for now:"
> 
> The reason of compiling error is:
> 
> Since -next collects and merges developing patches including common vfs
> stuff from multi-trees, but those patches didn't cover erofs, such as:
> 
> ('vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
> https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=109b45090d7d3ce2797bb1ef7f70eead5bfe0ff3
> 
> ("vfs: Require specification of size of mount data for internal mounts")
> https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=0a191e4505a4f255e6513b49426213da69bf0e80
> 
> Above vfs related patches has not been merged in staging tree, if we
> submit those erofs patches to staging mailing list and after including
> them in staging-{test,nexts} tree, it can easily cause compiling error.
> 
> We worked out some patches to adjust those vfs change, but now we just
> submit them to -next tree temporarily to avoid compiling error.
> 
> For potentail conflict in between erofs and vfs changes in incoming
> merge window, Stephen suggested that we can disable CONFIG_EROFS_FS
> temporarily to pass merge window, and after that we can do restore by
> reenabling CONFIG_EROFS_FS and applying those fixing patches. Also
> Greg confirmed this solution.
> 
> So, let's disable compiling erofs for a while.
> 
> Suggested-by: Stephen Rothwell 
> Signed-off-by: Gao Xiang 
> Reviewed-by: Gao Xiang 
> Signed-off-by: Chao Yu 
> ---
> v3: remain "depends on BLOCK".
>  drivers/staging/erofs/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/erofs/Kconfig b/drivers/staging/erofs/Kconfig
> index 663b755bf2fb..b37d994aa687 100644
> --- a/drivers/staging/erofs/Kconfig
> +++ b/drivers/staging/erofs/Kconfig
> @@ -3,6 +3,7 @@
>  config EROFS_FS
>   tristate "EROFS filesystem support"
>   depends on BLOCK
> + depends on BROKEN
>   help
> EROFS(Enhanced Read-Only File System) is a lightweight
> 

[PATCH] staging: fsl-dpaa2/eth: Use named arguments in function definition

2018-08-02 Thread Ioana Radulescu
Checkpatch complains about unnamed arguments in a function
prototype, so fix it.

Signed-off-by: Ioana Radulescu 
---
 drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h 
b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
index 6b70c66..5064667 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpaa2-eth.h
@@ -277,10 +277,10 @@ struct dpaa2_eth_fq {
struct dpaa2_eth_channel *channel;
enum dpaa2_eth_fq_type type;
 
-   void (*consume)(struct dpaa2_eth_priv *,
-   struct dpaa2_eth_channel *,
-   const struct dpaa2_fd *,
-   struct napi_struct *,
+   void (*consume)(struct dpaa2_eth_priv *priv,
+   struct dpaa2_eth_channel *ch,
+   const struct dpaa2_fd *fd,
+   struct napi_struct *napi,
u16 queue_id);
struct dpaa2_eth_fq_stats stats;
 };
-- 
2.7.4

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


[PATCH 5/6] staging: rtl8188eu: use is_multicast_ether_addr

2018-08-02 Thread Michael Straube
Use is_multicast_ether_addr instead of custom IS_MCAST in
core/rtw_sta_mgt.c.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c 
b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 53e518148ae5..34c3e2af63c1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -414,7 +414,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, 
u8 *hwaddr)
if (!hwaddr)
return NULL;
 
-   if (IS_MCAST(hwaddr))
+   if (is_multicast_ether_addr(hwaddr))
addr = bc_addr;
else
addr = hwaddr;
-- 
2.18.0

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


[PATCH 3/6] staging: rtl8188eu: cleanup block comment - style

2018-08-02 Thread Michael Straube
Cleanup a block comment to conform with kernel coding style.
Also cleans 'line over 80 characters' checkpatch warnings.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
index 82fc5075e0a6..6925ec48dff1 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
@@ -43,9 +43,11 @@ static void rtl8188eu_cal_txdesc_chksum(struct tx_desc   
*ptxdesc)
ptxdesc->txdw7 |= cpu_to_le32(0x & checksum);
 }
 
-/*  Description: In normal chip, we should send some packet to Hw which will 
be used by Fw */
-/* in FW LPS mode. The function is to fill the Tx 
descriptor of this packets, then */
-/* Fw can tell Hw to send these packet derectly. */
+/*
+ * In normal chip, we should send some packet to Hw which will be used by Fw
+ * in FW LPS mode. The function is to fill the Tx descriptor of this packets,
+ * then Fw can tell Hw to send these packet derectly.
+ */
 void rtl8188e_fill_fake_txdesc(struct adapter *adapt, u8 *desc, u32 BufferLen, 
u8  ispspoll, u8  is_btqosnull)
 {
struct tx_desc *ptxdesc;
-- 
2.18.0

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


[PATCH 4/6] staging: rtl8188eu: remove whitespace - style

2018-08-02 Thread Michael Straube
Replace tabs with spaces and/or remove spaces where appropriate.

Signed-off-by: Michael Straube 
---
 .../staging/rtl8188eu/hal/rtl8188eu_xmit.c| 22 +--
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
index 6925ec48dff1..a11bee16d070 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
@@ -15,7 +15,7 @@
 
 s32 rtw_hal_init_xmit_priv(struct adapter *adapt)
 {
-   struct xmit_priv*pxmitpriv = >xmitpriv;
+   struct xmit_priv *pxmitpriv = >xmitpriv;
 
tasklet_init(>xmit_tasklet,
 (void(*)(unsigned long))rtl8188eu_xmit_tasklet,
@@ -30,8 +30,8 @@ static u8 urb_zero_packet_chk(struct adapter *adapt, int sz)
 
 static void rtl8188eu_cal_txdesc_chksum(struct tx_desc *ptxdesc)
 {
-   u16 *usptr = (u16 *)ptxdesc;
-   u32 count = 16; /*  (32 bytes / 2 bytes per XOR) => 16 times */
+   u16 *usptr = (u16 *)ptxdesc;
+   u32 count = 16; /* (32 bytes / 2 bytes per XOR) => 16 times */
u32 index;
u16 checksum = 0;
 
@@ -160,15 +160,15 @@ static void fill_txdesc_phy(struct pkt_attrib *pattrib, 
__le32 *pdw)
 
 static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz, u8 
bagg_pkt)
 {
-   int pull = 0;
-   uintqsel;
+   int pull = 0;
+   uint qsel;
u8 data_rate, pwr_status, offset;
-   struct adapter  *adapt = pxmitframe->padapter;
-   struct pkt_attrib   *pattrib = >attrib;
+   struct adapter *adapt = pxmitframe->padapter;
+   struct pkt_attrib *pattrib = >attrib;
struct odm_dm_struct *odmpriv = >HalData->odmpriv;
-   struct tx_desc  *ptxdesc = (struct tx_desc *)pmem;
-   struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct tx_desc *ptxdesc = (struct tx_desc *)pmem;
+   struct mlme_ext_priv *pmlmeext = >mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
 
if (adapt->registrypriv.mp_mode == 0) {
if ((!bagg_pkt) && (urb_zero_packet_chk(adapt, sz) == 0)) {
@@ -328,7 +328,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 
*pmem, s32 sz, u8 bag
return pull;
 }
 
-/* for non-agg data frame or  management frame */
+/* for non-agg data frame or management frame */
 static s32 rtw_dump_xframe(struct adapter *adapt, struct xmit_frame 
*pxmitframe)
 {
s32 ret = _SUCCESS;
-- 
2.18.0

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


[PATCH 6/6] staging: rtl8188eu: remove whitespace, add missing blank line

2018-08-02 Thread Michael Straube
Replace tabs with spaces and/or remove spaces where appropriate.
Add a missing blank line after declarations.

Also clears checkpatch warnings.
WARNING: Statements should start on a tabstop
WARNING: suspect code indent for conditional statements (8, 17)

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/core/rtw_sta_mgt.c | 37 ++--
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c 
b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
index 34c3e2af63c1..f12a12b19d3f 100644
--- a/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8188eu/core/rtw_sta_mgt.c
@@ -18,7 +18,7 @@ static void _rtw_init_stainfo(struct sta_info *psta)
 {
memset((u8 *)psta, 0, sizeof(struct sta_info));
 
-spin_lock_init(>lock);
+   spin_lock_init(>lock);
INIT_LIST_HEAD(>list);
INIT_LIST_HEAD(>hash_list);
_rtw_init_queue(>sleep_q);
@@ -55,7 +55,7 @@ static void _rtw_init_stainfo(struct sta_info *psta)
 #endif /*  CONFIG_88EU_AP_MODE */
 }
 
-u32_rtw_init_sta_priv(struct   sta_priv *pstapriv)
+u32 _rtw_init_sta_priv(struct sta_priv *pstapriv)
 {
struct sta_info *psta;
s32 i;
@@ -127,15 +127,15 @@ inline struct sta_info *rtw_get_stainfo_by_offset(struct 
sta_priv *stapriv, int
return (struct sta_info *)(stapriv->pstainfo_buf + offset * 
sizeof(struct sta_info));
 }
 
-u32_rtw_free_sta_priv(struct   sta_priv *pstapriv)
+u32 _rtw_free_sta_priv(struct sta_priv *pstapriv)
 {
struct list_head *phead, *plist;
struct sta_info *psta = NULL;
struct recv_reorder_ctrl *preorder_ctrl;
-   int index;
+   int index;
 
if (pstapriv) {
-   /*  delete all reordering_ctrl_timer*/
+   /* delete all reordering_ctrl_timer */
spin_lock_bh(>sta_hash_lock);
for (index = 0; index < NUM_STA; index++) {
phead = >sta_hash[index];
@@ -171,7 +171,7 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv 
*pstapriv, u8 *hwaddr)
struct __queue *pfree_sta_queue;
struct recv_reorder_ctrl *preorder_ctrl;
int i = 0;
-   u16  wRxSeqInitialValue = 0x;
+   u16 wRxSeqInitialValue = 0x;
 
pfree_sta_queue = >free_sta_queue;
 
@@ -243,14 +243,14 @@ struct sta_info *rtw_alloc_stainfo(struct sta_priv 
*pstapriv, u8 *hwaddr)
 }
 
 /*  using pstapriv->sta_hash_lock to protect */
-u32rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
+u32 rtw_free_stainfo(struct adapter *padapter, struct sta_info *psta)
 {
int i;
struct __queue *pfree_sta_queue;
struct recv_reorder_ctrl *preorder_ctrl;
-   struct  sta_xmit_priv   *pstaxmitpriv;
-   struct  xmit_priv   *pxmitpriv = >xmitpriv;
-   struct  sta_priv *pstapriv = >stapriv;
+   struct sta_xmit_priv *pstaxmitpriv;
+   struct xmit_priv *pxmitpriv = >xmitpriv;
+   struct sta_priv *pstapriv = >stapriv;
 
if (!psta)
goto exit;
@@ -376,9 +376,9 @@ u32 rtw_free_stainfo(struct adapter *padapter, struct 
sta_info *psta)
 void rtw_free_all_stainfo(struct adapter *padapter)
 {
struct list_head *plist, *phead;
-   s32 index;
+   s32 index;
struct sta_info *psta = NULL;
-   struct  sta_priv *pstapriv = >stapriv;
+   struct sta_priv *pstapriv = >stapriv;
struct sta_info *pbcmc_stainfo = rtw_get_bcmc_stainfo(padapter);
 
if (pstapriv->asoc_sta_count == 1)
@@ -407,7 +407,7 @@ struct sta_info *rtw_get_stainfo(struct sta_priv *pstapriv, 
u8 *hwaddr)
 {
struct list_head *plist, *phead;
struct sta_info *psta = NULL;
-   u32 index;
+   u32 index;
u8 *addr;
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
 
@@ -443,10 +443,10 @@ struct sta_info *rtw_get_stainfo(struct sta_priv 
*pstapriv, u8 *hwaddr)
 
 u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
 {
-   struct sta_info *psta;
+   struct sta_info *psta;
u32 res = _SUCCESS;
unsigned char bcast_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 
0xff};
-   struct  sta_priv *pstapriv = >stapriv;
+   struct sta_priv *pstapriv = >stapriv;
 
psta = rtw_alloc_stainfo(pstapriv, bcast_addr);
 
@@ -465,9 +465,10 @@ u32 rtw_init_bcmc_stainfo(struct adapter *padapter)
 
 struct sta_info *rtw_get_bcmc_stainfo(struct adapter *padapter)
 {
-   struct sta_priv *pstapriv = >stapriv;
+   struct sta_priv *pstapriv = >stapriv;
u8 bc_addr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-return rtw_get_stainfo(pstapriv, bc_addr);
+
+   return rtw_get_stainfo(pstapriv, bc_addr);
 }
 
 u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
@@ -502,7 +503,7 @@ u8 rtw_access_ctrl(struct adapter *padapter, u8 *mac_addr)
else if (pacl_list->mode == 2)/* deny unless in 

[PATCH 1/6] staging: rtl8188eu: use is_multicast_ether_addr

2018-08-02 Thread Michael Straube
Use is_multicast_ether_addr instead of custom IS_MCAST in
os_dep/recv_linux.c.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/os_dep/recv_linux.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/recv_linux.c 
b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
index deadf26ea2aa..6f74f49bf3ab 100644
--- a/drivers/staging/rtl8188eu/os_dep/recv_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/recv_linux.c
@@ -84,11 +84,11 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = >stapriv;
struct rx_pkt_attrib *pattrib = _frame->attrib;
-   int bmcast = IS_MCAST(pattrib->dst);
+   bool mcast = is_multicast_ether_addr(pattrib->dst);
 
if (memcmp(pattrib->dst, myid(>eeprompriv),
   ETH_ALEN)) {
-   if (bmcast) {
+   if (mcast) {
psta = rtw_get_bcmc_stainfo(padapter);
pskb2 = skb_clone(skb, GFP_ATOMIC);
} else {
@@ -104,7 +104,7 @@ int rtw_recv_indicatepkt(struct adapter *padapter,
 
rtw_xmit_entry(skb, pnetdev);
 
-   if (bmcast)
+   if (mcast)
skb = pskb2;
else
goto _recv_indicatepkt_end;
-- 
2.18.0

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


[PATCH 2/6] staging: rtl8188eu: use is_multicast_ether_addr

2018-08-02 Thread Michael Straube
Use is_multicast_ether_addr instead of custom IS_MCAST in
hal/rtl8188eu_xmit.c.

There is only one use, so remove the extra variable for the
result of IS_MCAST.

Signed-off-by: Michael Straube 
---
 drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c 
b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
index 14622eee56ca..82fc5075e0a6 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_xmit.c
@@ -167,7 +167,6 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 
*pmem, s32 sz, u8 bag
struct tx_desc  *ptxdesc = (struct tx_desc *)pmem;
struct mlme_ext_priv*pmlmeext = >mlmeextpriv;
struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
-   int bmcst = IS_MCAST(pattrib->ra);
 
if (adapt->registrypriv.mp_mode == 0) {
if ((!bagg_pkt) && (urb_zero_packet_chk(adapt, sz) == 0)) {
@@ -186,7 +185,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 
*pmem, s32 sz, u8 bag
 
ptxdesc->txdw0 |= cpu_to_le32(((offset) << OFFSET_SHT) & 0x00ff);/* 
32 bytes for TX Desc */
 
-   if (bmcst)
+   if (is_multicast_ether_addr(pattrib->ra))
ptxdesc->txdw0 |= cpu_to_le32(BMC);
 
if (adapt->registrypriv.mp_mode == 0) {
-- 
2.18.0

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


Re: [PATCH v6 07/13] media: dt-bindings: add bindings for i.MX7 media driver

2018-08-02 Thread Rui Miguel Silva

Hi Sakari,
Thanks for the review.

I will take this in account when preparing the v7, all your 
comments

bellow look reasonable to me.

---
Cheers,
Rui

On Thu 02 Aug 2018 at 14:00, Sakari Ailus wrote:

Hi Rui,

On Tue, May 22, 2018 at 03:52:39PM +0100, Rui Miguel Silva 
wrote:

Add bindings documentation for i.MX7 media drivers.
The imx7 MIPI CSI2 and imx7 CMOS Sensor Interface.

Signed-off-by: Rui Miguel Silva 
---
 .../devicetree/bindings/media/imx7-csi.txt| 44 ++
 .../bindings/media/imx7-mipi-csi2.txt | 82 
 +++

 2 files changed, 126 insertions(+)
 create mode 100644 
 Documentation/devicetree/bindings/media/imx7-csi.txt
 create mode 100644 
 Documentation/devicetree/bindings/media/imx7-mipi-csi2.txt


diff --git 
a/Documentation/devicetree/bindings/media/imx7-csi.txt 
b/Documentation/devicetree/bindings/media/imx7-csi.txt

new file mode 100644
index ..aab4f5d72390
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/imx7-csi.txt
@@ -0,0 +1,44 @@
+Freescale i.MX7 CMOS Sensor Interface
+=
+
+csi node
+
+
+This is device node for the CMOS Sensor Interface (CSI) which 
enables the chip

+to connect directly to external CMOS image sensors.
+
+Required properties:
+
+- compatible: "fsl,imx7-csi";
+- reg   : base address and length of the register set 
for the device;

+- interrupts: should contain CSI interrupt;
+- clocks: list of clock specifiers, see
+ 
Documentation/devicetree/bindings/clock/clock-bindings.txt for 
details;
+- clock-names   : must contain "axi", "mclk" and "dcic" 
entries, matching

+ entries in the clock property;
+
+The device node should contain one 'port' child node with one 
child 'endpoint'


"should" or "shall"?

+node, according to the bindings defined in 
Documentation/devicetree/bindings/
+media/video-interfaces.txt. In the following example a remote 
endpoint is a


I wouldn't split the path as it breaks copy-paste; up to you.


+video multiplexer.
+
+example:
+
+csi: csi@3071 {
+#address-cells = <1>;
+#size-cells = <0>;
+
+compatible = "fsl,imx7-csi";
+reg = <0x3071 0x1>;
+interrupts = IRQ_TYPE_LEVEL_HIGH>;

+clocks = < IMX7D_CLK_DUMMY>,
+< 
IMX7D_CSI_MCLK_ROOT_CLK>,
+< 
IMX7D_CLK_DUMMY>;

+clock-names = "axi", "mclk", "dcic";
+
+port {
+csi_from_csi_mux: endpoint {
+remote-endpoint = 
<_mux_to_csi>;

+};
+};
+};
diff --git 
a/Documentation/devicetree/bindings/media/imx7-mipi-csi2.txt 
b/Documentation/devicetree/bindings/media/imx7-mipi-csi2.txt

new file mode 100644
index ..7c5f20863724
--- /dev/null
+++ 
b/Documentation/devicetree/bindings/media/imx7-mipi-csi2.txt

@@ -0,0 +1,82 @@
+Freescale i.MX7 Mipi CSI2
+=
+
+mipi_csi2 node
+--
+
+This is the device node for the MIPI CSI-2 receiver core in 
i.MX7 SoC. It is

+compatible with previous version of Samsung D-phy.
+
+Required properties:
+
+- compatible: "fsl,imx7-mipi-csi2";
+- reg   : base address and length of the register set 
for the device;

+- interrupts: should contain MIPI CSIS interrupt;
+- clocks: list of clock specifiers, see
+ 
Documentation/devicetree/bindings/clock/clock-bindings.txt for 
details;
+- clock-names   : must contain "pclk", "wrap" and "phy" 
entries, matching

+  entries in the clock property;
+- power-domains : a phandle to the power domain, see
+ 
Documentation/devicetree/bindings/power/power_domain.txt for 
details.

+- reset-names   : should include following entry "mrst";
+- resets: a list of phandle, should contain reset 
entry of

+  reset-names;
+- phy-supply: from the generic phy bindings, a phandle to 
a regulator that

+ provides power to MIPI CSIS core;
+
+Optional properties:
+
+- clock-frequency : The IP's main (system bus) clock frequency 
in Hz, default
+		value when this property is not specified is 
166 MHz;
+- fsl,csis-hs-settle : differential receiver (HS-RX) settle 
time;

+
+port node
+-
+
+- reg		  : (required) can take the values 0 or 1, 
where 0 is the
+ related sink port and port 1 should be 
the source one;


Should and is -> shall?

I think you should also elaborate whether or not the port (as 
well as the

endpoint) nodes themselves are mandatory.


+
+endpoint node
+-
+
+- data-lanes: (required) an array specifying active 
physical MIPI-CSI2
+		data input lanes and their mapping to logical 
lanes; the
+	

Re: [PATCH v6 00/13] media: staging/imx7: add i.MX7 media driver

2018-08-02 Thread Rui Miguel Silva

Hi Hans,
On Thu 02 Aug 2018 at 13:37, Hans Verkuil wrote:

Hi Rui,

On 05/22/18 16:52, Rui Miguel Silva wrote:

Hi,
This series introduces the Media driver to work with the i.MX7 
SoC. it uses the
already existing imx media core drivers but since the i.MX7, 
contrary to
i.MX5/6, do not have an IPU and because of that some changes in 
the imx media

core are made along this series to make it support that case.

This patches adds CSI and MIPI-CSI2 drivers for i.MX7, along 
with several
configurations changes for this to work as a capture subsystem. 
Some bugs are

also fixed along the line. And necessary documentation.

For a more detailed view of the capture paths, pads links in 
the i.MX7 please

take a look at the documentation in PATCH 14.

The system used to test and develop this was the Warp7 board 
with an OV2680
sensor, which output format is 10-bit bayer. So, only MIPI 
interface was

tested, a scenario with an parallel input would nice to have.

*Important note*, this code depends on Steve Longerbeam series 
[0]:

[PATCH v4 00/13] media: imx: Switch to subdev notifiers
which the merging status is not clear to me, but the changes in 
there make

senses to this series

Bellow goes an example of the output of the pads and links and 
the output of

v4l2-compliance testing.

The v4l-utils version used is:
v4l2-compliance SHA   : 
47d43b130dc6e9e0edc900759fb37649208371e4 from Apr 4th.


The Media Driver fail some tests but this failures are coming 
from code out of
scope of this series (video-mux, imx-capture), and some from 
the sensor OV2680
but that I think not related with the sensor driver but with 
the testing and

core.

The csi and mipi-csi entities pass all compliance tests.

Cheers,
Rui

[0]: 
https://www.mail-archive.com/linux-media@vger.kernel.org/msg131186.html


This patch series was delayed quite a bit since the patch series 
above

it depends on is still not merged.

But the v6 version of that series will be merged once the 4.20 
cycle opens:

https://www.mail-archive.com/linux-media@vger.kernel.org/msg133391.html


Good news.



Sakari has a branch with that series on top of the latest 
media_tree master:

https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-fwnode

Can you rebase this imx7 series on top of that? And test it 
again with the
*latest* v4l2-compliance? (I've added new checks recently, so 
you need to

update this utility)

Please post the output of the v4l2-compliance test (after fixing 
any issues
it raises of course), either as a reply to this post or in the 
cover letter

of a v7 version of this series if you had to make changes.


Sure, I will rebase on top of Sakari tree and will update the 
compliance

tests and run them again.



This should expedite merging this series for 4.20.

Thanks!

Hans


Ok, thanks for this. I will try to do it soon.

---
Cheers,
Rui


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


Re: [PATCH 2/2] staging:r8188eu: Use lib80211 to encrypt (CCMP) tx frames

2018-08-02 Thread Michael Straube

On 07/16/18 15:30, Michael Straube wrote:

On 07/14/18 19:54, Ivan Safonov wrote:

Put data to skb, decrypt with lib80211_crypt_ccmp, and place back to tx buffer.

Signed-off-by: Ivan Safonov 
---
  drivers/staging/rtl8188eu/core/rtw_security.c | 778 +++---
  1 file changed, 72 insertions(+), 706 deletions(-)



Hi Ivan,

with this applied I get the following in dmesg:

[    3.901334] [drm] Initialized amdgpu 3.26.0 20150101 for :07:00.0 on 
minor 0
[    4.108904] IPv6: ADDRCONF(NETDEV_UP): enp6s0: link is not ready
[    4.185502] r8169 :06:00.0 enp6s0: link down
[    4.185564] IPv6: ADDRCONF(NETDEV_UP): enp6s0: link is not ready
[    4.193647] IPv6: ADDRCONF(NETDEV_UP): wlp1s0f0u9: link is not ready
[   17.741809] MAC Address = 7c:8b:ca:08:80:7e
[   17.828850] IPv6: ADDRCONF(NETDEV_UP): wlp1s0f0u9: link is not ready
[   17.969593] R8188EU: indicate disassoc
[   18.081923] IPv6: ADDRCONF(NETDEV_UP): wlp1s0f0u9: link is not ready
[   18.123036] IPv6: ADDRCONF(NETDEV_UP): wlp1s0f0u9: link is not ready
[   23.034084] R8188EU: assoc success
[   23.085043] IPv6: ADDRCONF(NETDEV_CHANGE): wlp1s0f0u9: link becomes ready
[   23.093587] BUG: scheduling while atomic: NetworkManager/495/0x0202
[   23.093590] Modules linked in: amdkfd amd_iommu_v2 amdgpu nls_iso8859_1 
nls_cp437 vfat fat r8188eu(C) lib80211 snd_hda_codec_realtek cfg80211 
snd_hda_codec_generic edac_mce_amd chash snd_hda_codec_hdmi gpu_sched kvm_amd 
i2c_algo_bit ttm ccp snd_hda_intel rng_core drm_kms_helper kvm snd_hda_codec 
input_leds led_class joydev mousedev drm rfkill irqbypass snd_hda_core 
crct10dif_pclmul agpgart crc32_pclmul snd_hwdep ghash_clmulni_intel syscopyarea 
sysfillrect sysimgblt pcbc wmi_bmof snd_pcm aesni_intel snd_timer aes_x86_64 
crypto_simd cryptd k10temp fb_sys_fops snd r8169 sp5100_tco pcspkr glue_helper 
soundcore mii i2c_piix4 rtc_cmos pinctrl_amd evdev gpio_amdpt wmi mac_hid 
acpi_cpufreq crypto_user ip_tables x_tables ext4 crc32c_generic crc16 mbcache 
jbd2 fscrypto sd_mod hid_generic usbhid hid ahci libahci
[   23.093655]  xhci_pci xhci_hcd libata crc32c_intel usbcore scsi_mod 
usb_common
[   23.093661] Preemption disabled at:
[   23.093667] [] __dev_queue_xmit+0x74/0x910
[   23.093672] CPU: 7 PID: 495 Comm: NetworkManager Tainted: G C    
4.18.0-rc5-staging+ #1
[   23.093673] Hardware name: Gigabyte Technology Co., Ltd. 
A320M-S2H/A320M-S2H-CF, BIOS F23d 04/17/2018
[   23.093675] Call Trace:
[   23.093683]  dump_stack+0x5c/0x80
[   23.093686]  ? __dev_queue_xmit+0x74/0x910
[   23.093691]  __schedule_bug.cold.14+0x82/0x9b
[   23.093696]  __schedule+0x705/0x8b0
[   23.093700]  ? enqueue_task_fair+0xc3/0x730
[   23.093704]  schedule+0x32/0x90
[   23.093707]  schedule_timeout+0x311/0x4a0
[   23.093710]  ? _raw_spin_unlock_irqrestore+0x20/0x40
[   23.093713]  ? try_to_wake_up+0x23a/0x490
[   23.093716]  wait_for_common+0x15f/0x190
[   23.093719]  ? wake_up_q+0x70/0x70
[   23.093736]  ? rtw_aes_encrypt+0x26f/0x290 [r8188eu]
[   23.093739]  wait_for_completion_killable+0x19/0x30
[   23.093743]  call_usermodehelper_exec+0x115/0x160
[   23.093747]  __request_module+0x1ac/0x3e2
[   23.093764]  rtw_aes_encrypt+0x26f/0x290 [r8188eu]
[   23.093778]  ? rtw_get_stainfo+0xe6/0x130 [r8188eu]
[   23.093793]  rtw_xmitframe_coalesce+0x950/0xb00 [r8188eu]
[   23.093799]  ? _raw_spin_lock_irqsave+0x25/0x50
[   23.093812]  rtw_hal_xmit+0x83/0x130 [r8188eu]
[   23.093826]  rtw_xmit+0x258/0x5d0 [r8188eu]
[   23.093840]  rtw_xmit_entry+0xe8/0x2e7 [r8188eu]
[   23.093845]  dev_hard_start_xmit+0xa5/0x240
[   23.093849]  sch_direct_xmit+0x150/0x340
[   23.093852]  __dev_queue_xmit+0x2f6/0x910
[   23.093856]  packet_sendmsg+0x945/0x1592
[   23.093860]  ? attach_to_pi_state+0x18/0x110
[   23.093862]  ? preempt_count_sub+0x60/0x90
[   23.093866]  ? ep_item_poll.isra.1+0x40/0xc0
[   23.093871]  sock_sendmsg+0x33/0x40
[   23.093874]  __sys_sendto+0xee/0x160
[   23.093879]  ? memzero_explicit+0xa/0x10
[   23.093883]  ? urandom_read+0x120/0x270
[   23.093887]  __x64_sys_sendto+0x24/0x30
[   23.093890]  do_syscall_64+0x5b/0x170
[   23.093893]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   23.093896] RIP: 0033:0x7fac0b700c12
[   23.093897] Code: 48 83 ec 18 44 89 4c 24 08 e8 9a f5 ff ff 44 8b 4c 24 08 4d 89 
f8 45 89 f2 89 c5 4c 89 ea 4c 89 e6 89 df b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff 
ff 77 3a 89 ef 48 89 44 24 08 e8 ca f5 ff ff 48 8b
[   23.093935] RSP: 002b:7fffc46321b0 EFLAGS: 0293 ORIG_RAX: 
002c
[   23.093938] RAX: ffda RBX: 0011 RCX: 7fac0b700c12
[   23.093939] RDX: 0148 RSI: 55f8a5417c70 RDI: 0011
[   23.093940] RBP:  R08: 55f8a54154c0 R09: 0014
[   23.093942] R10:  R11: 0293 R12: 55f8a5417c70
[   23.093943] R13: 0148 R14:  R15: 55f8a54154c0
[   23.096167] lib80211_crypt: registered algorithm 'CCMP'
[   23.096544] [ cut 

RE: [PATCH char-misc 1/1] Drivers: hv: vmbus: Cleanup synic memory free path

2018-08-02 Thread KY Srinivasan



> -Original Message-
> From: Dan Carpenter 
> Sent: Wednesday, August 1, 2018 11:42 PM
> To: Michael Kelley (EOSG) 
> Cc: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org;
> de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com;
> vkuzn...@redhat.com; jasow...@redhat.com;
> marcelo.ce...@canonical.com; Stephen Hemminger
> ; KY Srinivasan 
> Subject: Re: [PATCH char-misc 1/1] Drivers: hv: vmbus: Cleanup synic
> memory free path
> 
> On Wed, Aug 01, 2018 at 03:45:13PM -0700, mhkelle...@gmail.com wrote:
> > From: Michael Kelley 
> >
> > clk_evt memory is not being freed when the synic is shutdown
> > or when there is an allocation error.  Add the appropriate
> > kfree() call, along with a comment to clarify how the memory
> > gets freed after an allocation error.  Make the free path
> > consistent by removing checks for NULL since kfree() and
> > free_page() already do the check.
> >
> > Signed-off-by: Michael Kelley 
> > Reported-by: Dan Carpenter 
> > ---
> >  drivers/hv/hv.c | 14 --
> >  1 file changed, 8 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> > index 8d4fe0e..1fb9a6b 100644
> > --- a/drivers/hv/hv.c
> > +++ b/drivers/hv/hv.c
> > @@ -240,6 +240,10 @@ int hv_synic_alloc(void)
> >
> > return 0;
> >  err:
> > +   /*
> > +* Any memory allocations that succeeded will be freed when
> > +* the caller cleans up by calling hv_synic_free()
> > +*/
> > return -ENOMEM;
> >  }
> >
> > @@ -252,12 +256,10 @@ void hv_synic_free(void)
> > for_each_present_cpu(cpu) {
> > struct hv_per_cpu_context *hv_cpu
> > = per_cpu_ptr(hv_context.cpu_context, cpu);
> >
> > -   if (hv_cpu->synic_event_page)
> > -   free_page((unsigned long)hv_cpu-
> >synic_event_page);
> > -   if (hv_cpu->synic_message_page)
> > -   free_page((unsigned long)hv_cpu-
> >synic_message_page);
> > -   if (hv_cpu->post_msg_page)
> > -   free_page((unsigned long)hv_cpu-
> >post_msg_page);
> > +   kfree(hv_cpu->clk_evt);
> > +   free_page((unsigned long)hv_cpu->synic_event_page);
> > +   free_page((unsigned long)hv_cpu->synic_message_page);
> > +   free_page((unsigned long)hv_cpu->post_msg_page);
> 
> This looks buggy.
> 
> We can pass NULLs to free_page() so that's fine.  So the error handling
> assumes
> that hv_cpu->clk_evt is either NULL or allocated.  Here is how it is 
> allocated:
> 
>189  int hv_synic_alloc(void)
>190  {
>191  int cpu;
>192
>193  hv_context.hv_numa_map = kcalloc(nr_node_ids, sizeof(struct
> cpumask),
>194   GFP_KERNEL);
>195  if (hv_context.hv_numa_map == NULL) {
>196  pr_err("Unable to allocate NUMA map\n");
>197  goto err;
>198  }
>199
>200  for_each_present_cpu(cpu) {
> ^^^
> We loop over each CPU.
> 
>201  struct hv_per_cpu_context *hv_cpu
>202  = per_cpu_ptr(hv_context.cpu_context, cpu);
>203
>204  memset(hv_cpu, 0, sizeof(*hv_cpu));
> ^^
> We set this cpu memory to NULL.
> 
>205  tasklet_init(_cpu->msg_dpc,
>206   vmbus_on_msg_dpc, (unsigned long) 
> hv_cpu);
>207
>208  hv_cpu->clk_evt = kzalloc(sizeof(struct 
> clock_event_device),
>209GFP_KERNEL);
>210  if (hv_cpu->clk_evt == NULL) {
> ^^^
> Let's assume this fails on the first iteration through the loop.  We
> haven't memset the next cpu to NULL or allocated it.  But we loop over
> all the cpus in the error handling.  Since we didn't set everything to NULL in
> hv_synic_free() then it seems like this could be a double free.  It's 
> possible I
> am misreading the code, but either it's buggy or the memset() can be
> removed.
> 
> This is a very typical bug for this style of error handling where we free
> things which were never allocated.

Thanks Dan! We will fix this issue soon.

K. Y
> 
>211  pr_err("Unable to allocate clock event 
> device\n");
>212  goto err;
>213  }
> 
> regards,
> dan carpenter
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging: erofs: disable compiling temporarile

2018-08-02 Thread Chao Yu
From: Chao Yu 

As Stephen Rothwell reported:

"After merging the staging tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/staging/erofs/super.c: In function 'erofs_read_super':
drivers/staging/erofs/super.c:343:17: error: 'MS_RDONLY' undeclared (first use 
in this function); did you mean 'IS_RDONLY'?
  sb->s_flags |= MS_RDONLY | MS_NOATIME;
 ^
 IS_RDONLY
drivers/staging/erofs/super.c:343:17: note: each undeclared identifier is 
reported only once for each function it appears in
drivers/staging/erofs/super.c:343:29: error: 'MS_NOATIME' undeclared (first use 
in this function); did you mean 'S_NOATIME'?
  sb->s_flags |= MS_RDONLY | MS_NOATIME;
 ^~
 S_NOATIME
drivers/staging/erofs/super.c: In function 'erofs_mount':
drivers/staging/erofs/super.c:501:10: warning: passing argument 5 of 
'mount_bdev' makes integer from pointer without a cast [-Wint-conversion]
   , erofs_fill_super);
  ^~~~
In file included from include/linux/buffer_head.h:12:0,
 from drivers/staging/erofs/super.c:14:
include/linux/fs.h:2151:23: note: expected 'size_t {aka long unsigned int}' but 
argument is of type 'int (*)(struct super_block *, void *, int)'
 extern struct dentry *mount_bdev(struct file_system_type *fs_type,
   ^~
drivers/staging/erofs/super.c:500:9: error: too few arguments to function 
'mount_bdev'
  return mount_bdev(fs_type, flags, dev_name,
 ^~
In file included from include/linux/buffer_head.h:12:0,
 from drivers/staging/erofs/super.c:14:
include/linux/fs.h:2151:23: note: declared here
 extern struct dentry *mount_bdev(struct file_system_type *fs_type,
   ^~
drivers/staging/erofs/super.c: At top level:
drivers/staging/erofs/super.c:518:20: error: initialization from incompatible 
pointer type [-Werror=incompatible-pointer-types]
  .mount  = erofs_mount,
^~~
drivers/staging/erofs/super.c:518:20: note: (near initialization for 
'erofs_fs_type.mount')
drivers/staging/erofs/super.c: In function 'erofs_remount':
drivers/staging/erofs/super.c:630:12: error: 'MS_RDONLY' undeclared (first use 
in this function); did you mean 'IS_RDONLY'?
  *flags |= MS_RDONLY;
^
IS_RDONLY
drivers/staging/erofs/super.c: At top level:
drivers/staging/erofs/super.c:640:16: error: initialization from incompatible 
pointer type [-Werror=incompatible-pointer-types]
  .remount_fs = erofs_remount,
^

Caused by various commits creating erofs in the staging tree interacting
with various commits redoing the mount infrastructure in the vfs tree.

I have disabed CONFIG_EROFS_FS for now:"

The reason of compiling error is:

Since -next collects and merges developing patches including common vfs
stuff from multi-trees, but those patches didn't cover erofs, such as:

('vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=109b45090d7d3ce2797bb1ef7f70eead5bfe0ff3

("vfs: Require specification of size of mount data for internal mounts")
https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=0a191e4505a4f255e6513b49426213da69bf0e80

Above vfs related patches has not been merged in staging tree, if we
submit those erofs patches to staging mailing list and after including
them in staging-{test,nexts} tree, it can easily cause compiling error.

We worked out some patches to adjust those vfs change, but now we just
submit them to -next tree temporarily to avoid compiling error.

For potentail conflict in between erofs and vfs changes in incoming
merge window, Stephen suggested that we can disable CONFIG_EROFS_FS
temporarily to pass merge window, and after that we can do restore by
reenabling CONFIG_EROFS_FS and applying those fixing patches. Also
Greg confirmed this solution.

So, let's disable compiling erofs for a while.

Suggested-by: Stephen Rothwell 
Signed-off-by: Gao Xiang 
Reviewed-by: Gao Xiang 
Signed-off-by: Chao Yu 
---
v3: remain "depends on BLOCK".
 drivers/staging/erofs/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/erofs/Kconfig b/drivers/staging/erofs/Kconfig
index 663b755bf2fb..b37d994aa687 100644
--- a/drivers/staging/erofs/Kconfig
+++ b/drivers/staging/erofs/Kconfig
@@ -3,6 +3,7 @@
 config EROFS_FS
tristate "EROFS filesystem support"
depends on BLOCK
+   depends on BROKEN
help
  EROFS(Enhanced Read-Only File System) is a lightweight
  read-only file system with modern designs (eg. page-sized
-- 
2.18.0

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


Re: [PATCH v2] staging: erofs: disable compiling temporarile

2018-08-02 Thread Chao Yu
Hi Xiang,

On 2018/8/2 18:11, Gao Xiang wrote:
> Hi Chao,
> 
> On 2018/8/2 17:39, Chao Yu wrote:
>> As Stephen Rothwell reported:
>>
>> "After merging the staging tree, today's linux-next build (x86_64
>> allmodconfig) failed like this:
>>
>> drivers/staging/erofs/super.c: In function 'erofs_read_super':
>> drivers/staging/erofs/super.c:343:17: error: 'MS_RDONLY' undeclared (first 
>> use in this function); did you mean 'IS_RDONLY'?
>>   sb->s_flags |= MS_RDONLY | MS_NOATIME;
>>  ^
>>  IS_RDONLY
>> drivers/staging/erofs/super.c:343:17: note: each undeclared identifier is 
>> reported only once for each function it appears in
>> drivers/staging/erofs/super.c:343:29: error: 'MS_NOATIME' undeclared (first 
>> use in this function); did you mean 'S_NOATIME'?
>>   sb->s_flags |= MS_RDONLY | MS_NOATIME;
>>  ^~
>>  S_NOATIME
>> drivers/staging/erofs/super.c: In function 'erofs_mount':
>> drivers/staging/erofs/super.c:501:10: warning: passing argument 5 of 
>> 'mount_bdev' makes integer from pointer without a cast [-Wint-conversion]
>>, erofs_fill_super);
>>   ^~~~
>> In file included from include/linux/buffer_head.h:12:0,
>>  from drivers/staging/erofs/super.c:14:
>> include/linux/fs.h:2151:23: note: expected 'size_t {aka long unsigned int}' 
>> but argument is of type 'int (*)(struct super_block *, void *, int)'
>>  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
>>^~
>> drivers/staging/erofs/super.c:500:9: error: too few arguments to function 
>> 'mount_bdev'
>>   return mount_bdev(fs_type, flags, dev_name,
>>  ^~
>> In file included from include/linux/buffer_head.h:12:0,
>>  from drivers/staging/erofs/super.c:14:
>> include/linux/fs.h:2151:23: note: declared here
>>  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
>>^~
>> drivers/staging/erofs/super.c: At top level:
>> drivers/staging/erofs/super.c:518:20: error: initialization from 
>> incompatible pointer type [-Werror=incompatible-pointer-types]
>>   .mount  = erofs_mount,
>> ^~~
>> drivers/staging/erofs/super.c:518:20: note: (near initialization for 
>> 'erofs_fs_type.mount')
>> drivers/staging/erofs/super.c: In function 'erofs_remount':
>> drivers/staging/erofs/super.c:630:12: error: 'MS_RDONLY' undeclared (first 
>> use in this function); did you mean 'IS_RDONLY'?
>>   *flags |= MS_RDONLY;
>> ^
>> IS_RDONLY
>> drivers/staging/erofs/super.c: At top level:
>> drivers/staging/erofs/super.c:640:16: error: initialization from 
>> incompatible pointer type [-Werror=incompatible-pointer-types]
>>   .remount_fs = erofs_remount,
>> ^
>>
>> Caused by various commits creating erofs in the staging tree interacting
>> with various commits redoing the mount infrastructure in the vfs tree.
>>
>> I have disabed CONFIG_EROFS_FS for now:"
>>
>> The reason of compiling error is:
>>
>> Since -next collects and merges developing patches including common vfs
>> stuff from multi-trees, but those patches didn't cover erofs, such as:
>>
>> ('vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
>> https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=109b45090d7d3ce2797bb1ef7f70eead5bfe0ff3
>>
>> ("vfs: Require specification of size of mount data for internal mounts")
>> https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=0a191e4505a4f255e6513b49426213da69bf0e80
>>
>> Above vfs related patches has not been merged in staging tree, if we
>> submit those erofs patches to staging mailing list and after including
>> them in staging-{test,nexts} tree, it can easily cause compiling error.
>>
>> We worked out some patches to adjust those vfs change, but now we just
>> submit them to -next tree temporarily to avoid compiling error.
>>
>> For potentail conflict in between erofs and vfs changes in incoming
>> merge window, Stephen suggested that we can disable CONFIG_EROFS_FS
>> temporarily to pass merge window, and after that we can do restore by
>> reenabling CONFIG_EROFS_FS and applying those fixing patches. Also
>> Greg confirmed this solution.
>>
>> So, let's disable compiling erofs for a while.
>>
>> Suggested-by: Stephen Rothwell 
>> Signed-off-by: Gao Xiang 
>> Reviewed-by: Gao Xiang 
>> Signed-off-by: Chao Yu 
>> ---
>>  drivers/staging/erofs/Kconfig | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/erofs/Kconfig b/drivers/staging/erofs/Kconfig
>> index 663b755bf2fb..96f614934df1 100644
>> --- a/drivers/staging/erofs/Kconfig
>> +++ b/drivers/staging/erofs/Kconfig
>> @@ -2,7 +2,7 @@
>>  
>>  config EROFS_FS
>>  tristate "EROFS filesystem support"
>> -depends on BLOCK
>> +depends on 

Re: [PATCH v6 07/13] media: dt-bindings: add bindings for i.MX7 media driver

2018-08-02 Thread Sakari Ailus
Hi Rui,

On Tue, May 22, 2018 at 03:52:39PM +0100, Rui Miguel Silva wrote:
> Add bindings documentation for i.MX7 media drivers.
> The imx7 MIPI CSI2 and imx7 CMOS Sensor Interface.
> 
> Signed-off-by: Rui Miguel Silva 
> ---
>  .../devicetree/bindings/media/imx7-csi.txt| 44 ++
>  .../bindings/media/imx7-mipi-csi2.txt | 82 +++
>  2 files changed, 126 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/imx7-csi.txt
>  create mode 100644 Documentation/devicetree/bindings/media/imx7-mipi-csi2.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/imx7-csi.txt 
> b/Documentation/devicetree/bindings/media/imx7-csi.txt
> new file mode 100644
> index ..aab4f5d72390
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/imx7-csi.txt
> @@ -0,0 +1,44 @@
> +Freescale i.MX7 CMOS Sensor Interface
> +=
> +
> +csi node
> +
> +
> +This is device node for the CMOS Sensor Interface (CSI) which enables the 
> chip
> +to connect directly to external CMOS image sensors.
> +
> +Required properties:
> +
> +- compatible: "fsl,imx7-csi";
> +- reg   : base address and length of the register set for the device;
> +- interrupts: should contain CSI interrupt;
> +- clocks: list of clock specifiers, see
> +Documentation/devicetree/bindings/clock/clock-bindings.txt for 
> details;
> +- clock-names   : must contain "axi", "mclk" and "dcic" entries, matching
> + entries in the clock property;
> +
> +The device node should contain one 'port' child node with one child 
> 'endpoint'

"should" or "shall"?

> +node, according to the bindings defined in Documentation/devicetree/bindings/
> +media/video-interfaces.txt. In the following example a remote endpoint is a

I wouldn't split the path as it breaks copy-paste; up to you.

> +video multiplexer.
> +
> +example:
> +
> +csi: csi@3071 {
> +#address-cells = <1>;
> +#size-cells = <0>;
> +
> +compatible = "fsl,imx7-csi";
> +reg = <0x3071 0x1>;
> +interrupts = ;
> +clocks = < IMX7D_CLK_DUMMY>,
> +< IMX7D_CSI_MCLK_ROOT_CLK>,
> +< IMX7D_CLK_DUMMY>;
> +clock-names = "axi", "mclk", "dcic";
> +
> +port {
> +csi_from_csi_mux: endpoint {
> +remote-endpoint = <_mux_to_csi>;
> +};
> +};
> +};
> diff --git a/Documentation/devicetree/bindings/media/imx7-mipi-csi2.txt 
> b/Documentation/devicetree/bindings/media/imx7-mipi-csi2.txt
> new file mode 100644
> index ..7c5f20863724
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/imx7-mipi-csi2.txt
> @@ -0,0 +1,82 @@
> +Freescale i.MX7 Mipi CSI2
> +=
> +
> +mipi_csi2 node
> +--
> +
> +This is the device node for the MIPI CSI-2 receiver core in i.MX7 SoC. It is
> +compatible with previous version of Samsung D-phy.
> +
> +Required properties:
> +
> +- compatible: "fsl,imx7-mipi-csi2";
> +- reg   : base address and length of the register set for the device;
> +- interrupts: should contain MIPI CSIS interrupt;
> +- clocks: list of clock specifiers, see
> +Documentation/devicetree/bindings/clock/clock-bindings.txt for 
> details;
> +- clock-names   : must contain "pclk", "wrap" and "phy" entries, matching
> +  entries in the clock property;
> +- power-domains : a phandle to the power domain, see
> +  Documentation/devicetree/bindings/power/power_domain.txt for 
> details.
> +- reset-names   : should include following entry "mrst";
> +- resets: a list of phandle, should contain reset entry of
> +  reset-names;
> +- phy-supply: from the generic phy bindings, a phandle to a regulator 
> that
> +   provides power to MIPI CSIS core;
> +
> +Optional properties:
> +
> +- clock-frequency : The IP's main (system bus) clock frequency in Hz, default
> + value when this property is not specified is 166 MHz;
> +- fsl,csis-hs-settle : differential receiver (HS-RX) settle time;
> +
> +port node
> +-
> +
> +- reg  : (required) can take the values 0 or 1, where 0 is 
> the
> + related sink port and port 1 should be the source one;

Should and is -> shall?

I think you should also elaborate whether or not the port (as well as the
endpoint) nodes themselves are mandatory.

> +
> +endpoint node
> +-
> +
> +- data-lanes: (required) an array specifying active physical MIPI-CSI2
> + data input lanes and their mapping to logical lanes; 

Re: [PATCH v6 00/13] media: staging/imx7: add i.MX7 media driver

2018-08-02 Thread Hans Verkuil
Hi Rui,

On 05/22/18 16:52, Rui Miguel Silva wrote:
> Hi,
> This series introduces the Media driver to work with the i.MX7 SoC. it uses 
> the
> already existing imx media core drivers but since the i.MX7, contrary to
> i.MX5/6, do not have an IPU and because of that some changes in the imx media
> core are made along this series to make it support that case.
> 
> This patches adds CSI and MIPI-CSI2 drivers for i.MX7, along with several
> configurations changes for this to work as a capture subsystem. Some bugs are
> also fixed along the line. And necessary documentation.
> 
> For a more detailed view of the capture paths, pads links in the i.MX7 please
> take a look at the documentation in PATCH 14.
> 
> The system used to test and develop this was the Warp7 board with an OV2680
> sensor, which output format is 10-bit bayer. So, only MIPI interface was
> tested, a scenario with an parallel input would nice to have.
> 
> *Important note*, this code depends on Steve Longerbeam series [0]:
> [PATCH v4 00/13] media: imx: Switch to subdev notifiers
> which the merging status is not clear to me, but the changes in there make
> senses to this series
> 
> Bellow goes an example of the output of the pads and links and the output of
> v4l2-compliance testing.
> 
> The v4l-utils version used is:
> v4l2-compliance SHA   : 47d43b130dc6e9e0edc900759fb37649208371e4 from Apr 4th.
> 
> The Media Driver fail some tests but this failures are coming from code out of
> scope of this series (video-mux, imx-capture), and some from the sensor OV2680
> but that I think not related with the sensor driver but with the testing and
> core.
> 
> The csi and mipi-csi entities pass all compliance tests.
> 
> Cheers,
> Rui
> 
> [0]: https://www.mail-archive.com/linux-media@vger.kernel.org/msg131186.html

This patch series was delayed quite a bit since the patch series above
it depends on is still not merged.

But the v6 version of that series will be merged once the 4.20 cycle opens:
https://www.mail-archive.com/linux-media@vger.kernel.org/msg133391.html

Sakari has a branch with that series on top of the latest media_tree master:
https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-fwnode

Can you rebase this imx7 series on top of that? And test it again with the
*latest* v4l2-compliance? (I've added new checks recently, so you need to
update this utility)

Please post the output of the v4l2-compliance test (after fixing any issues
it raises of course), either as a reply to this post or in the cover letter
of a v7 version of this series if you had to make changes.

This should expedite merging this series for 4.20.

Thanks!

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


[staging:staging-testing 704/736] drivers/staging//wilc1000/wilc_sdio.c:566:15: warning: passing argument 1 of '__swab32s' makes pointer from integer without a cast

2018-08-02 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-testing
head:   156c3df8d4db4e693c062978186f44079413d74d
commit: 02211edc9a1f71942a67d545614f8c7382230de7 [704/736] staging: wilc1000: 
fix endianness warnings reported by sparse
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 02211edc9a1f71942a67d545614f8c7382230de7
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=xtensa 

All warnings (new ones prefixed by >>):

   In file included from include/linux/byteorder/big_endian.h:5,
from arch/xtensa/include/uapi/asm/byteorder.h:8,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from include/linux/mmc/sdio_func.h:15,
from drivers/staging//wilc1000/wilc_sdio.c:8:
   drivers/staging//wilc1000/wilc_sdio.c: In function 'sdio_read_reg':
>> drivers/staging//wilc1000/wilc_sdio.c:566:15: warning: passing argument 1 of 
>> '__swab32s' makes pointer from integer without a cast [-Wint-conversion]
 le32_to_cpus(*data);
   include/uapi/linux/byteorder/big_endian.h:95:38: note: in definition of 
macro '__le32_to_cpus'
#define __le32_to_cpus(x) __swab32s((x))
 ^
   drivers/staging//wilc1000/wilc_sdio.c:566:2: note: in expansion of macro 
'le32_to_cpus'
 le32_to_cpus(*data);
 ^~~~
   In file included from include/linux/swab.h:5,
from include/uapi/linux/byteorder/big_endian.h:13,
from include/linux/byteorder/big_endian.h:5,
from arch/xtensa/include/uapi/asm/byteorder.h:8,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from include/linux/mmc/sdio_func.h:15,
from drivers/staging//wilc1000/wilc_sdio.c:8:
   include/uapi/linux/swab.h:242:46: note: expected '__u32 *' {aka 'unsigned 
int *'} but argument is of type 'u32' {aka 'unsigned int'}
static __always_inline void __swab32s(__u32 *p)
  ~~~^
--
   In file included from include/linux/byteorder/big_endian.h:5,
from arch/xtensa/include/uapi/asm/byteorder.h:8,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from include/linux/spi/spi.h:18,
from drivers/staging//wilc1000/wilc_spi.c:8:
   drivers/staging//wilc1000/wilc_spi.c: In function 'spi_internal_read':
>> drivers/staging//wilc1000/wilc_spi.c:702:15: warning: passing argument 1 of 
>> '__swab32s' makes pointer from integer without a cast [-Wint-conversion]
 le32_to_cpus(*data);
   include/uapi/linux/byteorder/big_endian.h:95:38: note: in definition of 
macro '__le32_to_cpus'
#define __le32_to_cpus(x) __swab32s((x))
 ^
   drivers/staging//wilc1000/wilc_spi.c:702:2: note: in expansion of macro 
'le32_to_cpus'
 le32_to_cpus(*data);
 ^~~~
   In file included from include/linux/swab.h:5,
from include/uapi/linux/byteorder/big_endian.h:13,
from include/linux/byteorder/big_endian.h:5,
from arch/xtensa/include/uapi/asm/byteorder.h:8,
from arch/xtensa/include/asm/bitops.h:23,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from include/linux/spi/spi.h:18,
from drivers/staging//wilc1000/wilc_spi.c:8:
   include/uapi/linux/swab.h:242:46: note: expected '__u32 *' {aka 'unsigned 
int *'} but argument is of type 'u32' {aka 'unsigned int'}
static __always_inline void __swab32s(__u32 *p)
  ~~~^
   In file included from include/linux/byteorder/big_endian.h:5,
from 

[PATCH] staging: wilc1000: fix compilation warning for ARCH PowerPC

2018-08-02 Thread Ajay Singh
Fix below warning reported for PowerPC arch compilation

include/uapi/linux/byteorder/big_endian.h:95:37: warning: passing
argument 1 of '__swab32s' makes pointer from integer without a cast
[-Wint-conversion]

Fixes: 02211edc9a1f ("staging: wilc1000: fix endianness warnings
reported by sparse")

Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/wilc_sdio.c | 2 +-
 drivers/staging/wilc1000/wilc_spi.c  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 8bda550..1908afa1 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -563,7 +563,7 @@ static int sdio_read_reg(struct wilc *wilc, u32 addr, u32 
*data)
}
}
 
-   le32_to_cpus(*data);
+   le32_to_cpus(data);
 
return 1;
 
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 064892d..a85f87b 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -699,7 +699,7 @@ static int spi_internal_read(struct wilc *wilc, u32 adr, 
u32 *data)
return 0;
}
 
-   le32_to_cpus(*data);
+   le32_to_cpus(data);
 
return 1;
 }
@@ -778,7 +778,7 @@ static int wilc_spi_read_reg(struct wilc *wilc, u32 addr, 
u32 *data)
return 0;
}
 
-   le32_to_cpus(*data);
+   le32_to_cpus(data);
 
return 1;
 }
-- 
2.7.4

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


Re: [PATCH v2] staging: erofs: disable compiling temporarile

2018-08-02 Thread Gao Xiang
Hi Chao,

On 2018/8/2 17:39, Chao Yu wrote:
> As Stephen Rothwell reported:
>
> "After merging the staging tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> drivers/staging/erofs/super.c: In function 'erofs_read_super':
> drivers/staging/erofs/super.c:343:17: error: 'MS_RDONLY' undeclared (first 
> use in this function); did you mean 'IS_RDONLY'?
>   sb->s_flags |= MS_RDONLY | MS_NOATIME;
>  ^
>  IS_RDONLY
> drivers/staging/erofs/super.c:343:17: note: each undeclared identifier is 
> reported only once for each function it appears in
> drivers/staging/erofs/super.c:343:29: error: 'MS_NOATIME' undeclared (first 
> use in this function); did you mean 'S_NOATIME'?
>   sb->s_flags |= MS_RDONLY | MS_NOATIME;
>  ^~
>  S_NOATIME
> drivers/staging/erofs/super.c: In function 'erofs_mount':
> drivers/staging/erofs/super.c:501:10: warning: passing argument 5 of 
> 'mount_bdev' makes integer from pointer without a cast [-Wint-conversion]
>, erofs_fill_super);
>   ^~~~
> In file included from include/linux/buffer_head.h:12:0,
>  from drivers/staging/erofs/super.c:14:
> include/linux/fs.h:2151:23: note: expected 'size_t {aka long unsigned int}' 
> but argument is of type 'int (*)(struct super_block *, void *, int)'
>  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
>^~
> drivers/staging/erofs/super.c:500:9: error: too few arguments to function 
> 'mount_bdev'
>   return mount_bdev(fs_type, flags, dev_name,
>  ^~
> In file included from include/linux/buffer_head.h:12:0,
>  from drivers/staging/erofs/super.c:14:
> include/linux/fs.h:2151:23: note: declared here
>  extern struct dentry *mount_bdev(struct file_system_type *fs_type,
>^~
> drivers/staging/erofs/super.c: At top level:
> drivers/staging/erofs/super.c:518:20: error: initialization from incompatible 
> pointer type [-Werror=incompatible-pointer-types]
>   .mount  = erofs_mount,
> ^~~
> drivers/staging/erofs/super.c:518:20: note: (near initialization for 
> 'erofs_fs_type.mount')
> drivers/staging/erofs/super.c: In function 'erofs_remount':
> drivers/staging/erofs/super.c:630:12: error: 'MS_RDONLY' undeclared (first 
> use in this function); did you mean 'IS_RDONLY'?
>   *flags |= MS_RDONLY;
> ^
> IS_RDONLY
> drivers/staging/erofs/super.c: At top level:
> drivers/staging/erofs/super.c:640:16: error: initialization from incompatible 
> pointer type [-Werror=incompatible-pointer-types]
>   .remount_fs = erofs_remount,
> ^
>
> Caused by various commits creating erofs in the staging tree interacting
> with various commits redoing the mount infrastructure in the vfs tree.
>
> I have disabed CONFIG_EROFS_FS for now:"
>
> The reason of compiling error is:
>
> Since -next collects and merges developing patches including common vfs
> stuff from multi-trees, but those patches didn't cover erofs, such as:
>
> ('vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
> https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=109b45090d7d3ce2797bb1ef7f70eead5bfe0ff3
>
> ("vfs: Require specification of size of mount data for internal mounts")
> https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=0a191e4505a4f255e6513b49426213da69bf0e80
>
> Above vfs related patches has not been merged in staging tree, if we
> submit those erofs patches to staging mailing list and after including
> them in staging-{test,nexts} tree, it can easily cause compiling error.
>
> We worked out some patches to adjust those vfs change, but now we just
> submit them to -next tree temporarily to avoid compiling error.
>
> For potentail conflict in between erofs and vfs changes in incoming
> merge window, Stephen suggested that we can disable CONFIG_EROFS_FS
> temporarily to pass merge window, and after that we can do restore by
> reenabling CONFIG_EROFS_FS and applying those fixing patches. Also
> Greg confirmed this solution.
>
> So, let's disable compiling erofs for a while.
>
> Suggested-by: Stephen Rothwell 
> Signed-off-by: Gao Xiang 
> Reviewed-by: Gao Xiang 
> Signed-off-by: Chao Yu 
> ---
>  drivers/staging/erofs/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/erofs/Kconfig b/drivers/staging/erofs/Kconfig
> index 663b755bf2fb..96f614934df1 100644
> --- a/drivers/staging/erofs/Kconfig
> +++ b/drivers/staging/erofs/Kconfig
> @@ -2,7 +2,7 @@
>  
>  config EROFS_FS
>   tristate "EROFS filesystem support"
> - depends on BLOCK
> + depends on BROKEN

How about remaining "depends on BLOCK" but just adding "depends on BROKEN"?

Thanks
Gao Xiang
>   help
> EROFS(Enhanced Read-Only File 

[PATCH v2] staging: erofs: disable compiling temporarile

2018-08-02 Thread Chao Yu
As Stephen Rothwell reported:

"After merging the staging tree, today's linux-next build (x86_64
allmodconfig) failed like this:

drivers/staging/erofs/super.c: In function 'erofs_read_super':
drivers/staging/erofs/super.c:343:17: error: 'MS_RDONLY' undeclared (first use 
in this function); did you mean 'IS_RDONLY'?
  sb->s_flags |= MS_RDONLY | MS_NOATIME;
 ^
 IS_RDONLY
drivers/staging/erofs/super.c:343:17: note: each undeclared identifier is 
reported only once for each function it appears in
drivers/staging/erofs/super.c:343:29: error: 'MS_NOATIME' undeclared (first use 
in this function); did you mean 'S_NOATIME'?
  sb->s_flags |= MS_RDONLY | MS_NOATIME;
 ^~
 S_NOATIME
drivers/staging/erofs/super.c: In function 'erofs_mount':
drivers/staging/erofs/super.c:501:10: warning: passing argument 5 of 
'mount_bdev' makes integer from pointer without a cast [-Wint-conversion]
   , erofs_fill_super);
  ^~~~
In file included from include/linux/buffer_head.h:12:0,
 from drivers/staging/erofs/super.c:14:
include/linux/fs.h:2151:23: note: expected 'size_t {aka long unsigned int}' but 
argument is of type 'int (*)(struct super_block *, void *, int)'
 extern struct dentry *mount_bdev(struct file_system_type *fs_type,
   ^~
drivers/staging/erofs/super.c:500:9: error: too few arguments to function 
'mount_bdev'
  return mount_bdev(fs_type, flags, dev_name,
 ^~
In file included from include/linux/buffer_head.h:12:0,
 from drivers/staging/erofs/super.c:14:
include/linux/fs.h:2151:23: note: declared here
 extern struct dentry *mount_bdev(struct file_system_type *fs_type,
   ^~
drivers/staging/erofs/super.c: At top level:
drivers/staging/erofs/super.c:518:20: error: initialization from incompatible 
pointer type [-Werror=incompatible-pointer-types]
  .mount  = erofs_mount,
^~~
drivers/staging/erofs/super.c:518:20: note: (near initialization for 
'erofs_fs_type.mount')
drivers/staging/erofs/super.c: In function 'erofs_remount':
drivers/staging/erofs/super.c:630:12: error: 'MS_RDONLY' undeclared (first use 
in this function); did you mean 'IS_RDONLY'?
  *flags |= MS_RDONLY;
^
IS_RDONLY
drivers/staging/erofs/super.c: At top level:
drivers/staging/erofs/super.c:640:16: error: initialization from incompatible 
pointer type [-Werror=incompatible-pointer-types]
  .remount_fs = erofs_remount,
^

Caused by various commits creating erofs in the staging tree interacting
with various commits redoing the mount infrastructure in the vfs tree.

I have disabed CONFIG_EROFS_FS for now:"

The reason of compiling error is:

Since -next collects and merges developing patches including common vfs
stuff from multi-trees, but those patches didn't cover erofs, such as:

('vfs: Suppress MS_* flag defs within the kernel unless explicitly enabled")
https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=109b45090d7d3ce2797bb1ef7f70eead5bfe0ff3

("vfs: Require specification of size of mount data for internal mounts")
https://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git/commit/?h=for-next=0a191e4505a4f255e6513b49426213da69bf0e80

Above vfs related patches has not been merged in staging tree, if we
submit those erofs patches to staging mailing list and after including
them in staging-{test,nexts} tree, it can easily cause compiling error.

We worked out some patches to adjust those vfs change, but now we just
submit them to -next tree temporarily to avoid compiling error.

For potentail conflict in between erofs and vfs changes in incoming
merge window, Stephen suggested that we can disable CONFIG_EROFS_FS
temporarily to pass merge window, and after that we can do restore by
reenabling CONFIG_EROFS_FS and applying those fixing patches. Also
Greg confirmed this solution.

So, let's disable compiling erofs for a while.

Suggested-by: Stephen Rothwell 
Signed-off-by: Gao Xiang 
Reviewed-by: Gao Xiang 
Signed-off-by: Chao Yu 
---
 drivers/staging/erofs/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/erofs/Kconfig b/drivers/staging/erofs/Kconfig
index 663b755bf2fb..96f614934df1 100644
--- a/drivers/staging/erofs/Kconfig
+++ b/drivers/staging/erofs/Kconfig
@@ -2,7 +2,7 @@
 
 config EROFS_FS
tristate "EROFS filesystem support"
-   depends on BLOCK
+   depends on BROKEN
help
  EROFS(Enhanced Read-Only File System) is a lightweight
  read-only file system with modern designs (eg. page-sized
-- 
2.18.0.rc1

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


[staging:staging-testing 704/735] drivers/staging//wilc1000/wilc_sdio.c:566:2: note: in expansion of macro 'le32_to_cpus'

2018-08-02 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git 
staging-testing
head:   025556d55d6edf3b3be1267a481be0890b96cc65
commit: 02211edc9a1f71942a67d545614f8c7382230de7 [704/735] staging: wilc1000: 
fix endianness warnings reported by sparse
config: powerpc-allyesconfig (attached as .config)
compiler: powerpc64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 02211edc9a1f71942a67d545614f8c7382230de7
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=powerpc 

All warnings (new ones prefixed by >>):

   In file included from include/linux/byteorder/big_endian.h:5:0,
from arch/powerpc/include/uapi/asm/byteorder.h:14,
from include/asm-generic/bitops/le.h:6,
from arch/powerpc/include/asm/bitops.h:246,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from include/linux/mmc/sdio_func.h:15,
from drivers/staging//wilc1000/wilc_sdio.c:8:
   drivers/staging//wilc1000/wilc_sdio.c: In function 'sdio_read_reg':
>> include/uapi/linux/byteorder/big_endian.h:95:37: warning: passing argument 1 
>> of '__swab32s' makes pointer from integer without a cast [-Wint-conversion]
#define __le32_to_cpus(x) __swab32s((x))
^
>> include/linux/byteorder/generic.h:113:22: note: in expansion of macro 
>> '__le32_to_cpus'
#define le32_to_cpus __le32_to_cpus
 ^~
>> drivers/staging//wilc1000/wilc_sdio.c:566:2: note: in expansion of macro 
>> 'le32_to_cpus'
 le32_to_cpus(*data);
 ^~~~
   In file included from include/linux/swab.h:5:0,
from include/uapi/linux/byteorder/big_endian.h:13,
from include/linux/byteorder/big_endian.h:5,
from arch/powerpc/include/uapi/asm/byteorder.h:14,
from include/asm-generic/bitops/le.h:6,
from arch/powerpc/include/asm/bitops.h:246,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from include/linux/mmc/sdio_func.h:15,
from drivers/staging//wilc1000/wilc_sdio.c:8:
   include/uapi/linux/swab.h:242:29: note: expected '__u32 * {aka unsigned int 
*}' but argument is of type 'u32 {aka unsigned int}'
static __always_inline void __swab32s(__u32 *p)
^
--
   In file included from include/linux/byteorder/big_endian.h:5:0,
from arch/powerpc/include/uapi/asm/byteorder.h:14,
from include/asm-generic/bitops/le.h:6,
from arch/powerpc/include/asm/bitops.h:246,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from include/linux/spi/spi.h:18,
from drivers/staging//wilc1000/wilc_spi.c:8:
   drivers/staging//wilc1000/wilc_spi.c: In function 'spi_internal_read':
>> include/uapi/linux/byteorder/big_endian.h:95:37: warning: passing argument 1 
>> of '__swab32s' makes pointer from integer without a cast [-Wint-conversion]
#define __le32_to_cpus(x) __swab32s((x))
^
>> include/linux/byteorder/generic.h:113:22: note: in expansion of macro 
>> '__le32_to_cpus'
#define le32_to_cpus __le32_to_cpus
 ^~
>> drivers/staging//wilc1000/wilc_spi.c:702:2: note: in expansion of macro 
>> 'le32_to_cpus'
 le32_to_cpus(*data);
 ^~~~
   In file included from include/linux/swab.h:5:0,
from include/uapi/linux/byteorder/big_endian.h:13,
from include/linux/byteorder/big_endian.h:5,
from arch/powerpc/include/uapi/asm/byteorder.h:14,
from include/asm-generic/bitops/le.h:6,
from arch/powerpc/include/asm/bitops.h:246,
from include/linux/bitops.h:38,
from include/linux/kernel.h:11,
from include/linux/list.h:9,
from include/linux/kobject.h:19,
from include/linux/device.h:16,
from include/linux/spi/spi.h:18,
from 

Re: [PATCH 8/8] Revert "staging: gasket: core: hold reference to pci_dev while used"

2018-08-02 Thread Greg Kroah-Hartman
On Thu, Aug 02, 2018 at 01:42:45AM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> There's no need to take an additional reference on the pci_dev structure
> for the pointer copy saved in gasket data structures.
> 
> This reverts commit 8dd8a48b9a7dae5493494a8603adddfdf1914716.

Hint, when dealing with sha1 numbers in the kernel, we like the
following format to make it a bit easier to understand:
8dd8a48b9a7d ("staging: gasket: core: hold reference to pci_dev while 
used")
which can be generated by doing:
git show -s --abbrev-commit --abbrev=12 --pretty=format:"%h (\"%s\")%n"

Can you fix this up and resend?

thanks,

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


Re: [PATCH 5/8] staging: gasket: core: add subsystem and device info to error logs

2018-08-02 Thread Greg Kroah-Hartman
On Thu, Aug 02, 2018 at 01:42:42AM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> Identify gasket as the subsystem printing various error messages.
> Add the driver name to appropriate messages to indicate which driver
> has a problem.
> 
> Signed-off-by: Todd Poynor 
> ---
>  drivers/staging/gasket/gasket_core.c | 27 +++
>  1 file changed, 15 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/gasket/gasket_core.c 
> b/drivers/staging/gasket/gasket_core.c
> index 36c077fffc41c..19331feb9b09f 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -160,7 +160,7 @@ static int gasket_find_dev_slot(struct 
> gasket_internal_desc *internal_desc,
>   for (i = 0; i < GASKET_DEV_MAX; i++) {
>   if (internal_desc->devs[i] &&
>   strcmp(internal_desc->devs[i]->kobj_name, kobj_name) == 0) {
> - pr_err("Duplicate device %s\n", kobj_name);
> + pr_err("gasket: Duplicate device %s\n", kobj_name);

same here with the prefix.

thanks,

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


Re: [PATCH 4/8] staging: gasket: core: device register debug log cleanups

2018-08-02 Thread Greg Kroah-Hartman
On Thu, Aug 02, 2018 at 01:42:41AM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> At device/driver registration time, convert a not-very-informative
> info message to a more informative dbeug message, drop some not overly
> helpful debug messages.
> 
> Signed-off-by: Todd Poynor 
> ---
>  drivers/staging/gasket/gasket_core.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/gasket/gasket_core.c 
> b/drivers/staging/gasket/gasket_core.c
> index 2160c2de78e77..36c077fffc41c 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -1736,7 +1736,8 @@ int gasket_register_device(const struct 
> gasket_driver_desc *driver_desc)
>   int desc_idx = -1;
>   struct gasket_internal_desc *internal;
>  
> - pr_info("Initializing Gasket framework device\n");
> + pr_debug("gasket: Loading %s driver version %s\n", driver_desc->name,

Again, pr_fmt is your friend :)

thanks,

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


Re: [PATCH 3/8] staging: gasket: core: move driver loaded log after error cases

2018-08-02 Thread Greg Kroah-Hartman
On Thu, Aug 02, 2018 at 01:42:40AM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> Gasket could claim to have loaded a driver and then print an error
> indicating it actually did not.  Move the driver registration message
> after the last error check.  Replace the existing "loaded successfully"
> message with this instead.
> 
> Signed-off-by: Todd Poynor 
> ---
>  drivers/staging/gasket/gasket_core.c | 9 -
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/staging/gasket/gasket_core.c 
> b/drivers/staging/gasket/gasket_core.c
> index e550c9060dcd2..2160c2de78e77 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -1759,10 +1759,6 @@ int gasket_register_device(const struct 
> gasket_driver_desc *driver_desc)
>   }
>   mutex_unlock(_mutex);
>  
> - pr_info("gasket: Loaded %s driver version %s, framework version %s\n",
> - driver_desc->name, driver_desc->driver_version,
> - GASKET_FRAMEWORK_VERSION);
> -
>   if (desc_idx == -1) {
>   pr_err("Too many Gasket drivers loaded: %d\n",
>  GASKET_FRAMEWORK_DESC_MAX);
> @@ -1810,7 +1806,10 @@ int gasket_register_device(const struct 
> gasket_driver_desc *driver_desc)
>   goto fail2;
>   }
>  
> - pr_info("Driver registered successfully.\n");

Same here, just drop this line.

thanks,

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


Re: [PATCH 2/8] staging: gasket: core: print driver version code at registration time

2018-08-02 Thread Greg Kroah-Hartman
On Thu, Aug 02, 2018 at 01:42:39AM -0700, Todd Poynor wrote:
> From: Todd Poynor 
> 
> Print the driver version code in the kernel log at gasket driver
> registration time for informational purposes.  Add "gasket:" prefix to
> make clear it is the gasket framework logging this information.
> 
> Signed-off-by: Todd Poynor 
> ---
>  drivers/staging/gasket/gasket_core.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/gasket/gasket_core.c 
> b/drivers/staging/gasket/gasket_core.c
> index f76f4a0ecbac6..e550c9060dcd2 100644
> --- a/drivers/staging/gasket/gasket_core.c
> +++ b/drivers/staging/gasket/gasket_core.c
> @@ -1759,8 +1759,9 @@ int gasket_register_device(const struct 
> gasket_driver_desc *driver_desc)
>   }
>   mutex_unlock(_mutex);
>  
> - pr_info("Loaded %s driver, framework version %s\n",
> - driver_desc->name, GASKET_FRAMEWORK_VERSION);
> + pr_info("gasket: Loaded %s driver version %s, framework version %s\n",
> + driver_desc->name, driver_desc->driver_version,
> + GASKET_FRAMEWORK_VERSION);

This is what pr_fmt is for, please just set that properly and all will
be fine.

But really, just delete this line, drivers, if all is going well, should
not emit any noise to the kernel log.  Especially for something like
doing a 'modprobe', which is really what is happening here.  Just drop
the noisy messages please.

Also, GASKET_FRAMEWORK_VERSION means nothing now, it needs to be dropped :)

thanks,

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


[PATCH 5/8] staging: gasket: core: add subsystem and device info to error logs

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

Identify gasket as the subsystem printing various error messages.
Add the driver name to appropriate messages to indicate which driver
has a problem.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 27 +++
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 36c077fffc41c..19331feb9b09f 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -160,7 +160,7 @@ static int gasket_find_dev_slot(struct gasket_internal_desc 
*internal_desc,
for (i = 0; i < GASKET_DEV_MAX; i++) {
if (internal_desc->devs[i] &&
strcmp(internal_desc->devs[i]->kobj_name, kobj_name) == 0) {
-   pr_err("Duplicate device %s\n", kobj_name);
+   pr_err("gasket: Duplicate device %s\n", kobj_name);
mutex_unlock(_desc->mutex);
return -EBUSY;
}
@@ -173,7 +173,8 @@ static int gasket_find_dev_slot(struct gasket_internal_desc 
*internal_desc,
}
 
if (i == GASKET_DEV_MAX) {
-   pr_err("Too many registered devices; max %d\n", GASKET_DEV_MAX);
+   pr_err("gasket: Too many registered devices, max %d\n",
+  GASKET_DEV_MAX);
mutex_unlock(_desc->mutex);
return -EBUSY;
}
@@ -208,7 +209,7 @@ static int gasket_alloc_dev(struct gasket_internal_desc 
*internal_desc,
 
gasket_dev = *pdev = kzalloc(sizeof(*gasket_dev), GFP_KERNEL);
if (!gasket_dev) {
-   pr_err("no memory for device\n");
+   pr_err("gasket: no memory for device %s\n",  kobj_name);
return -ENOMEM;
}
internal_desc->devs[dev_idx] = gasket_dev;
@@ -1464,7 +1465,7 @@ static int gasket_pci_probe(struct pci_dev *pci_dev,
internal_desc = lookup_internal_desc(pci_dev);
mutex_unlock(_mutex);
if (!internal_desc) {
-   pr_err("PCI probe called for unknown driver type\n");
+   pr_err("gasket: PCI probe called for unknown driver type\n");
return -ENODEV;
}
 
@@ -1476,7 +1477,7 @@ static int gasket_pci_probe(struct pci_dev *pci_dev,
return ret;
gasket_dev->pci_dev = pci_dev_get(pci_dev);
if (IS_ERR_OR_NULL(gasket_dev->dev_info.device)) {
-   pr_err("Cannot create %s device %s [ret = %ld]\n",
+   pr_err("gasket: Cannot create %s device %s [ret = %ld]\n",
   driver_desc->name, gasket_dev->dev_info.name,
   PTR_ERR(gasket_dev->dev_info.device));
ret = -ENODEV;
@@ -1523,7 +1524,7 @@ static int gasket_pci_probe(struct pci_dev *pci_dev,
 
ret = gasket_enable_dev(internal_desc, gasket_dev);
if (ret) {
-   pr_err("cannot setup %s device\n", driver_desc->name);
+   pr_err("gasket: cannot setup %s device\n", driver_desc->name);
gasket_disable_dev(gasket_dev);
goto fail5;
}
@@ -1743,7 +1744,7 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
 
for (i = 0; i < GASKET_FRAMEWORK_DESC_MAX; i++) {
if (g_descs[i].driver_desc == driver_desc) {
-   pr_err("%s driver already loaded/registered\n",
+   pr_err("gasket: %s driver already loaded/registered\n",
   driver_desc->name);
mutex_unlock(_mutex);
return -EBUSY;
@@ -1761,7 +1762,7 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
mutex_unlock(_mutex);
 
if (desc_idx == -1) {
-   pr_err("Too many Gasket drivers loaded: %d\n",
+   pr_err("gasket: too many drivers loaded, max %d\n",
   GASKET_FRAMEWORK_DESC_MAX);
return -EBUSY;
}
@@ -1778,7 +1779,7 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
class_create(driver_desc->module, driver_desc->name);
 
if (IS_ERR(internal->class)) {
-   pr_err("Cannot register %s class [ret=%ld]\n",
+   pr_err("gasket: Cannot register %s class [ret=%ld]\n",
   driver_desc->name, PTR_ERR(internal->class));
ret = PTR_ERR(internal->class);
goto unregister_gasket_driver;
@@ -1791,7 +1792,8 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
ret = __pci_register_driver(>pci, driver_desc->module,
driver_desc->name);
if (ret) {
-   pr_err("cannot register pci driver [ret=%d]\n", ret);
+   pr_err("gasket: cannot register %s pci driver [ret=%d]\n",
+  

[PATCH 8/8] Revert "staging: gasket: core: hold reference to pci_dev while used"

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

There's no need to take an additional reference on the pci_dev structure
for the pointer copy saved in gasket data structures.

This reverts commit 8dd8a48b9a7dae5493494a8603adddfdf1914716.

Reported-by: Dmitry Torokhov 
Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 4e30b154b..8c5574305f13b 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -253,7 +253,6 @@ static void gasket_free_dev(struct gasket_dev *gasket_dev)
internal_desc->devs[gasket_dev->dev_idx] = NULL;
mutex_unlock(_desc->mutex);
put_device(gasket_dev->dev);
-   pci_dev_put(gasket_dev->pci_dev);
kfree(gasket_dev);
 }
 
@@ -1475,7 +1474,7 @@ static int gasket_pci_probe(struct pci_dev *pci_dev,
ret = gasket_alloc_dev(internal_desc, parent, _dev, kobj_name);
if (ret)
return ret;
-   gasket_dev->pci_dev = pci_dev_get(pci_dev);
+   gasket_dev->pci_dev = pci_dev;
if (IS_ERR_OR_NULL(gasket_dev->dev_info.device)) {
pr_err("gasket: Cannot create %s device %s [ret = %ld]\n",
   driver_desc->name, gasket_dev->dev_info.name,
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 6/8] staging: gasket: remove "reset type" param from framework

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

The "type of reset" parameter to the gasket device reset APIs isn't
required by the only gasket device submitted upstream, apex.

The framework documents the param as private to the device driver and a
pass-through at the gasket layer, but the gasket core calls the device
driver with a hardcoded reset type of zero, which is not documented as
having a predefined meaning.

In light of all this, remove the reset type parameter from the
framework.  Remove the reset ioctl reset type parameter, and bump the
framework version number to reflect the interface change.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket.h   |  4 ++--
 drivers/staging/gasket/gasket_constants.h |  2 +-
 drivers/staging/gasket/gasket_core.c  | 11 +--
 drivers/staging/gasket/gasket_core.h  | 13 +++--
 drivers/staging/gasket/gasket_ioctl.c |  3 +--
 5 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/gasket/gasket.h b/drivers/staging/gasket/gasket.h
index 9f709f0c5a2bb..a0f065c517a52 100644
--- a/drivers/staging/gasket/gasket.h
+++ b/drivers/staging/gasket/gasket.h
@@ -52,8 +52,8 @@ struct gasket_coherent_alloc_config_ioctl {
 /* Base number for all Gasket-common IOCTLs */
 #define GASKET_IOCTL_BASE 0xDC
 
-/* Reset the device using the specified reset type. */
-#define GASKET_IOCTL_RESET _IOW(GASKET_IOCTL_BASE, 0, unsigned long)
+/* Reset the device. */
+#define GASKET_IOCTL_RESET _IO(GASKET_IOCTL_BASE, 0)
 
 /* Associate the specified [event]fd with the specified interrupt. */
 #define GASKET_IOCTL_SET_EVENTFD   
\
diff --git a/drivers/staging/gasket/gasket_constants.h 
b/drivers/staging/gasket/gasket_constants.h
index 82ed3f21e8aed..50d87c7b178c2 100644
--- a/drivers/staging/gasket/gasket_constants.h
+++ b/drivers/staging/gasket/gasket_constants.h
@@ -3,7 +3,7 @@
 #ifndef __GASKET_CONSTANTS_H__
 #define __GASKET_CONSTANTS_H__
 
-#define GASKET_FRAMEWORK_VERSION "1.1.1"
+#define GASKET_FRAMEWORK_VERSION "1.1.2"
 
 /*
  * The maximum number of simultaneous device types supported by the framework.
diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 19331feb9b09f..4e30b154b 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1295,7 +1295,7 @@ static int gasket_release(struct inode *inode, struct 
file *file)
ownership->owner = 0;
 
/* Forces chip reset before we unmap the page tables. */
-   driver_desc->device_reset_cb(gasket_dev, 0);
+   driver_desc->device_reset_cb(gasket_dev);
 
for (i = 0; i < driver_desc->num_page_tables; ++i) {

gasket_page_table_unmap_all(gasket_dev->page_table[i]);
@@ -1623,18 +1623,18 @@ const char *gasket_num_name_lookup(uint num,
 }
 EXPORT_SYMBOL(gasket_num_name_lookup);
 
-int gasket_reset(struct gasket_dev *gasket_dev, uint reset_type)
+int gasket_reset(struct gasket_dev *gasket_dev)
 {
int ret;
 
mutex_lock(_dev->mutex);
-   ret = gasket_reset_nolock(gasket_dev, reset_type);
+   ret = gasket_reset_nolock(gasket_dev);
mutex_unlock(_dev->mutex);
return ret;
 }
 EXPORT_SYMBOL(gasket_reset);
 
-int gasket_reset_nolock(struct gasket_dev *gasket_dev, uint reset_type)
+int gasket_reset_nolock(struct gasket_dev *gasket_dev)
 {
int ret;
int i;
@@ -1644,8 +1644,7 @@ int gasket_reset_nolock(struct gasket_dev *gasket_dev, 
uint reset_type)
if (!driver_desc->device_reset_cb)
return 0;
 
-   /* Perform a device reset of the requested type. */
-   ret = driver_desc->device_reset_cb(gasket_dev, reset_type);
+   ret = driver_desc->device_reset_cb(gasket_dev);
if (ret) {
dev_dbg(gasket_dev->dev, "Device reset cb returned %d.\n",
ret);
diff --git a/drivers/staging/gasket/gasket_core.h 
b/drivers/staging/gasket/gasket_core.h
index 713bf42de41a4..67f5960943a8a 100644
--- a/drivers/staging/gasket/gasket_core.h
+++ b/drivers/staging/gasket/gasket_core.h
@@ -580,17 +580,12 @@ struct gasket_driver_desc {
/*
 * device_reset_cb: Reset the hardware in question.
 * @dev: Pointer to the gasket_dev structure for this device.
-* @type: Integer representing reset type. (All
-* Gasket resets have an integer representing their type
-* defined in (device)_ioctl.h; the specific resets are
-* device-dependent, but are handled in the device-specific
-* callback anyways.)
 *
 * Called by reset ioctls. This function should not
 * lock the gasket_dev mutex. It should return 0 on success
 * and an error on failure.
 */
-   int (*device_reset_cb)(struct gasket_dev *dev, uint reset_type);
+   int (*device_reset_cb)(struct gasket_dev 

[PATCH 2/8] staging: gasket: core: print driver version code at registration time

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

Print the driver version code in the kernel log at gasket driver
registration time for informational purposes.  Add "gasket:" prefix to
make clear it is the gasket framework logging this information.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index f76f4a0ecbac6..e550c9060dcd2 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1759,8 +1759,9 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
}
mutex_unlock(_mutex);
 
-   pr_info("Loaded %s driver, framework version %s\n",
-   driver_desc->name, GASKET_FRAMEWORK_VERSION);
+   pr_info("gasket: Loaded %s driver version %s, framework version %s\n",
+   driver_desc->name, driver_desc->driver_version,
+   GASKET_FRAMEWORK_VERSION);
 
if (desc_idx == -1) {
pr_err("Too many Gasket drivers loaded: %d\n",
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 3/8] staging: gasket: core: move driver loaded log after error cases

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

Gasket could claim to have loaded a driver and then print an error
indicating it actually did not.  Move the driver registration message
after the last error check.  Replace the existing "loaded successfully"
message with this instead.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index e550c9060dcd2..2160c2de78e77 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1759,10 +1759,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
}
mutex_unlock(_mutex);
 
-   pr_info("gasket: Loaded %s driver version %s, framework version %s\n",
-   driver_desc->name, driver_desc->driver_version,
-   GASKET_FRAMEWORK_VERSION);
-
if (desc_idx == -1) {
pr_err("Too many Gasket drivers loaded: %d\n",
   GASKET_FRAMEWORK_DESC_MAX);
@@ -1810,7 +1806,10 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
goto fail2;
}
 
-   pr_info("Driver registered successfully.\n");
+   pr_info("gasket: Loaded %s driver version %s, framework version %s\n",
+   driver_desc->name, driver_desc->driver_version,
+   GASKET_FRAMEWORK_VERSION);
+
return 0;
 
 fail2:
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 4/8] staging: gasket: core: device register debug log cleanups

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

At device/driver registration time, convert a not-very-informative
info message to a more informative dbeug message, drop some not overly
helpful debug messages.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/gasket_core.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gasket/gasket_core.c 
b/drivers/staging/gasket/gasket_core.c
index 2160c2de78e77..36c077fffc41c 100644
--- a/drivers/staging/gasket/gasket_core.c
+++ b/drivers/staging/gasket/gasket_core.c
@@ -1736,7 +1736,8 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
int desc_idx = -1;
struct gasket_internal_desc *internal;
 
-   pr_info("Initializing Gasket framework device\n");
+   pr_debug("gasket: Loading %s driver version %s\n", driver_desc->name,
+driver_desc->driver_version);
/* Check for duplicates and find a free slot. */
mutex_lock(_mutex);
 
@@ -1765,8 +1766,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
return -EBUSY;
}
 
-   /* Internal structure setup. */
-   pr_debug("Performing initial internal structure setup.\n");
internal = _descs[desc_idx];
mutex_init(>mutex);
memset(internal->devs, 0, sizeof(struct gasket_dev *) * GASKET_DEV_MAX);
@@ -1789,7 +1788,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
 * Not using pci_register_driver() (without underscores), as it
 * depends on KBUILD_MODNAME, and this is a shared file.
 */
-   pr_debug("Registering PCI driver.\n");
ret = __pci_register_driver(>pci, driver_desc->module,
driver_desc->name);
if (ret) {
@@ -1797,7 +1795,6 @@ int gasket_register_device(const struct 
gasket_driver_desc *driver_desc)
goto fail1;
}
 
-   pr_debug("Registering char driver.\n");
ret = register_chrdev_region(MKDEV(driver_desc->major,
   driver_desc->minor), GASKET_DEV_MAX,
 driver_desc->name);
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 7/8] staging: gasket: apex: drop reset type param

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

Apex doesn't implement different types of resets based on the reset type
param passed through the gasket layer or from userspace via the
gasket_reset ioctl.  The reset type is dropped from the gasket framework
in a previous patch due to a lack of present need and non-conforming use
of this parameter by the framework.  Drop the parameter from the apex
driver as well.

Signed-off-by: Todd Poynor 
---
 drivers/staging/gasket/apex_driver.c | 20 
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/gasket/apex_driver.c 
b/drivers/staging/gasket/apex_driver.c
index 7fd0dd609d037..42cef68eb4c19 100644
--- a/drivers/staging/gasket/apex_driver.c
+++ b/drivers/staging/gasket/apex_driver.c
@@ -56,10 +56,6 @@
 
 #define APEX_EXTENDED_SHIFT 63 /* Extended address bit position. */
 
-enum apex_reset_types {
-   APEX_CHIP_REINIT_RESET = 3,
-};
-
 /* Check reset 120 times */
 #define APEX_RESET_RETRY 120
 /* Wait 100 ms between checks. Total 12 sec wait maximum. */
@@ -258,7 +254,7 @@ static int apex_get_status(struct gasket_dev *gasket_dev)
 }
 
 /* Enter GCB reset state. */
-static int apex_enter_reset(struct gasket_dev *gasket_dev, uint type)
+static int apex_enter_reset(struct gasket_dev *gasket_dev)
 {
if (bypass_top_level)
return 0;
@@ -313,7 +309,7 @@ static int apex_enter_reset(struct gasket_dev *gasket_dev, 
uint type)
 }
 
 /* Quit GCB reset state. */
-static int apex_quit_reset(struct gasket_dev *gasket_dev, uint type)
+static int apex_quit_reset(struct gasket_dev *gasket_dev)
 {
u32 val0, val1;
 
@@ -413,7 +409,7 @@ static int apex_device_cleanup(struct gasket_dev 
*gasket_dev)
__func__, gasket_dev, hib_error, scalar_error);
 
if (allow_power_save)
-   ret = apex_enter_reset(gasket_dev, APEX_CHIP_REINIT_RESET);
+   ret = apex_enter_reset(gasket_dev);
 
return ret;
 }
@@ -429,7 +425,7 @@ static bool is_gcb_in_reset(struct gasket_dev *gasket_dev)
 }
 
 /* Reset the hardware, then quit reset.  Called on device open. */
-static int apex_reset(struct gasket_dev *gasket_dev, uint type)
+static int apex_reset(struct gasket_dev *gasket_dev)
 {
int ret;
 
@@ -442,11 +438,11 @@ static int apex_reset(struct gasket_dev *gasket_dev, uint 
type)
 */
dev_dbg(gasket_dev->dev, "%s: toggle reset\n", __func__);
 
-   ret = apex_enter_reset(gasket_dev, type);
+   ret = apex_enter_reset(gasket_dev);
if (ret)
return ret;
}
-   ret = apex_quit_reset(gasket_dev, type);
+   ret = apex_quit_reset(gasket_dev);
 
return ret;
 }
@@ -456,7 +452,7 @@ static int apex_add_dev_cb(struct gasket_dev *gasket_dev)
ulong page_table_ready, msix_table_ready;
int retries = 0;
 
-   apex_reset(gasket_dev, 0);
+   apex_reset(gasket_dev);
 
while (retries < APEX_RESET_RETRY) {
page_table_ready =
@@ -611,7 +607,7 @@ static int apex_sysfs_setup_cb(struct gasket_dev 
*gasket_dev)
 /* On device open, perform a core reinit reset. */
 static int apex_device_open_cb(struct gasket_dev *gasket_dev)
 {
-   return gasket_reset_nolock(gasket_dev, APEX_CHIP_REINIT_RESET);
+   return gasket_reset_nolock(gasket_dev);
 }
 
 static const struct pci_device_id apex_pci_ids[] = {
-- 
2.18.0.597.ga71716f1ad-goog

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


[PATCH 0/8] staging: gasket: cleanups du jour

2018-08-02 Thread Todd Poynor
From: Todd Poynor 

More cleanups for the gasket+apex drivers.

Todd Poynor (8):
  staging: gasket: apex: enable power save mode by default
  staging: gasket: core: print driver version code at registration time
  staging: gasket: core: move driver loaded log after error cases
  staging: gasket: core: device register debug log cleanups
  staging: gasket: core: add subsystem and device info to error logs
  staging: gasket: remove "reset type" param from framework
  staging: gasket: apex: drop reset type param
  Revert "staging: gasket: core: hold reference to pci_dev while used"

 drivers/staging/gasket/apex_driver.c  | 22 -
 drivers/staging/gasket/gasket.h   |  4 +-
 drivers/staging/gasket/gasket_constants.h |  2 +-
 drivers/staging/gasket/gasket_core.c  | 56 +++
 drivers/staging/gasket/gasket_core.h  | 13 ++
 drivers/staging/gasket/gasket_ioctl.c |  3 +-
 6 files changed, 43 insertions(+), 57 deletions(-)

-- 
2.18.0.597.ga71716f1ad-goog

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


Re: [PATCH v2] staging: mt29f_spinand: fix memory leak while programming pages

2018-08-02 Thread Greg KH
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Thu, Aug 02, 2018 at 04:31:40PM +0800, Jheng-Jhong Wu wrote:
> Dear greg k-h,
> 
> Before device is removed and freed memory automatically, programming
> pages may run many many times.

What do you mean by "programming pages"?

> Assume we erase and rewrite a large part of the flash, then
> spinand_program_page() might exhaust memory if memory is not large
> enough.

I do not understand what you mean here.

> We may not remove and re-add the device between each programming page, right?

I have no idea how your hardware works :)

> In fact, OOM indeed occurred when I tested programming multi-pages by
> mtd_debug tool.
> Erased first, then programmed pages.

Please provide more information like this in the patch when you resend
it, spelling out exactly why you are making this change.  It is not that
the current code is "leaking" anything, it is that you want the
functionality to be different from what it currently is.

thanks,

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


Re: [PATCH 2/2] android: binder: Rate-limit debug and userspace triggered err msgs

2018-08-02 Thread Greg Kroah-Hartman
On Thu, Jul 26, 2018 at 05:17:18PM -0700, Sherry Yang wrote:
> Use rate-limited debug messages where userspace can trigger
> excessive log spams.
> 
> Acked-by: Arve Hjønnevåg 
> Signed-off-by: Sherry Yang 
> ---
>  drivers/android/binder.c   |  5 +++--
>  drivers/android/binder_alloc.c | 41 +-
>  2 files changed, 29 insertions(+), 17 deletions(-)

This patch does not apply to my tree at all.  Can you please rebase it
and resend?

thanks,

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


Re: [PATCH v2] staging: mt29f_spinand: fix memory leak while programming pages

2018-08-02 Thread Jheng-Jhong Wu
Dear greg k-h,

Before device is removed and freed memory automatically, programming
pages may run many many times.
Assume we erase and rewrite a large part of the flash, then
spinand_program_page() might exhaust memory if memory is not large
enough.
We may not remove and re-add the device between each programming page, right?
In fact, OOM indeed occurred when I tested programming multi-pages by
mtd_debug tool.
Erased first, then programmed pages.

Best Regards,
─
Jheng-Jhong Wu (Victor Wu)
E-mail: goodwater...@gmail.com
─
Greg Kroah-Hartman  於 2018年8月2日 週四 下午4:03寫道:
>
> On Thu, Aug 02, 2018 at 03:51:30PM +0800, Jheng-Jhong Wu wrote:
> > In spinand_program_page(), it uses devm_kzalloc() to allocate memory to
> > wbuf dynamically if internal ECC is on, but it doesn't free memory
> > allocated to wbuf at the end of this function. Before the spinand device
> > is removed and frees memory automatically, programming pages may run many
> > times. This leads to a memory leak issue when internal ECC is on.
>
> How is this a memory leak?  The memory will be freed when the struct
> device is removed from the system.  How did you test that there was a
> leak?
>
> > Changelog:
> >
> > v2:
> > - use kzalloc()/kfree() to replace devm_kzalloc()/devm_kfree()
> > - add some descriptions to commit message
>
> this changelog goes below the --- line.
>
> thanks,
>
> greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 8/8] staging: wilc1000: added parentheses in macro to avoid checkpatch issue

2018-08-02 Thread Ajay Singh
Hi Greg,

On Thu, 2 Aug 2018 09:34:54 +0200
Greg KH  wrote:

> On Sun, Jul 29, 2018 at 11:36:57AM +0530, Ajay Singh wrote:
> > Cleanup patch to fix below checkpatch reported issue:
> > -#define ISWILC1000(id) ((id & 0xf000)
> > == 0x10 ? 1 : 0) +#define ISWILC1000(id)(((id)
> > & 0xf000) == 0x10 ? 1 : 0)
> 
> Even better, make this an inline function that returns a boolean to
> avoid any potental problems.
> 

Sure, I will make these changes and submit new patch.

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


Re: [PATCH 3/8] staging: wilc1000: remove unnecessary copyright information in file

2018-08-02 Thread Ajay Singh
Hi Greg,

On Thu, 2 Aug 2018 09:33:17 +0200
Greg KH  wrote:

> On Sun, Jul 29, 2018 at 11:36:52AM +0530, Ajay Singh wrote:
> > Cleanup patch to remove the unnecessary copyright information in
> > the file, as it already has SPDX License Identifier.
> > 
> > diff --git a/drivers/staging/wilc1000/wilc_debugfs.c
> > b/drivers/staging/wilc1000/wilc_debugfs.c index ac26e94..d86f457
> > 100644 --- a/drivers/staging/wilc1000/wilc_debugfs.c
> > +++ b/drivers/staging/wilc1000/wilc_debugfs.c
> > @@ -1,14 +1,4 @@
> >  // SPDX-License-Identifier: GPL-2.0
> > -/*
> > - * NewportMedia WiFi chipset driver test tools - wilc-debug
> > - * Copyright (c) 2012 NewportMedia Inc.
> > - * Author: SSW   
> 
> No, you can not just drop copyright lines for no reason at all.  Did
> your lawyers approve this patch?
> 

Actually, I had planned to keep Microchip Copyright header for these
files later, as currently these files has the previous
company copyright information. 
I am not sure what will be right practice to either keep all
previous companies copyright or only the latest copyright information.

Its better to drop this for now and after consulting internally I will
submit the new patch.


> SPDX identifes the _license_ of the file, not the copyrights, so it is
> ok to drop these lines:
> 
> > - *
> > - * 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.  
> 
> As that is what it is replacing.  But not the copyrights.
> 
> Go show your lawyer this patch:
> 
> > --- a/drivers/staging/wilc1000/wilc_sdio.c
> > +++ b/drivers/staging/wilc1000/wilc_sdio.c
> > @@ -1,9 +1,4 @@
> >  // SPDX-License-Identifier: GPL-2.0
> > -/*
> > - * Copyright (c) Atmel Corporation.  All rights reserved.  
> 
> And see what they do :)
> 
> (yes, explicit copyright notices are really not needed and do not do
> "much", but it is still the norm that they are present and our
> industry does still rely on them...)
> 
> thanks,
> 
> greg k-h

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


Re: [PATCH v2] staging: mt29f_spinand: fix memory leak while programming pages

2018-08-02 Thread Greg Kroah-Hartman
On Thu, Aug 02, 2018 at 03:51:30PM +0800, Jheng-Jhong Wu wrote:
> In spinand_program_page(), it uses devm_kzalloc() to allocate memory to
> wbuf dynamically if internal ECC is on, but it doesn't free memory
> allocated to wbuf at the end of this function. Before the spinand device
> is removed and frees memory automatically, programming pages may run many
> times. This leads to a memory leak issue when internal ECC is on.

How is this a memory leak?  The memory will be freed when the struct
device is removed from the system.  How did you test that there was a
leak?

> Changelog:
> 
> v2:
> - use kzalloc()/kfree() to replace devm_kzalloc()/devm_kfree()
> - add some descriptions to commit message

this changelog goes below the --- line.

thanks,

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


[PATCH v2] staging: mt29f_spinand: fix memory leak while programming pages

2018-08-02 Thread Jheng-Jhong Wu
In spinand_program_page(), it uses devm_kzalloc() to allocate memory to
wbuf dynamically if internal ECC is on, but it doesn't free memory
allocated to wbuf at the end of this function. Before the spinand device
is removed and frees memory automatically, programming pages may run many
times. This leads to a memory leak issue when internal ECC is on.

Changelog:

v2:
- use kzalloc()/kfree() to replace devm_kzalloc()/devm_kfree()
- add some descriptions to commit message

Signed-off-by: Jheng-Jhong Wu 
---
 drivers/staging/mt29f_spinand/mt29f_spinand.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c 
b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index e389009..d740c76 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -492,7 +492,7 @@ static int spinand_program_page(struct spi_device *spi_nand,
 #ifdef CONFIG_MTD_SPINAND_ONDIEECC
unsigned int i, j;
 
-   wbuf = devm_kzalloc(_nand->dev, CACHE_BUF, GFP_KERNEL);
+   wbuf = kzalloc(CACHE_BUF, GFP_KERNEL);
if (!wbuf)
return -ENOMEM;
 
@@ -553,6 +553,8 @@ static int spinand_program_page(struct spi_device *spi_nand,
}
enable_hw_ecc = 0;
}
+
+   kfree(wbuf);
 #endif
 
return 0;
-- 
2.7.4

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


Re: [PATCH 8/8] staging: wilc1000: added parentheses in macro to avoid checkpatch issue

2018-08-02 Thread Greg KH
On Sun, Jul 29, 2018 at 11:36:57AM +0530, Ajay Singh wrote:
> Cleanup patch to fix below checkpatch reported issue:
> 
> Macro argument 'id' may be better as '(id)' to avoid precedence issues
> 
> Also updated the TODO file to remove the below item
>  'rework comments and function headers(also coding style)'
> 
> Signed-off-by: Ajay Singh 
> ---
>  drivers/staging/wilc1000/TODO| 1 -
>  drivers/staging/wilc1000/wilc_wlan.h | 2 +-
>  2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/TODO b/drivers/staging/wilc1000/TODO
> index 6fd3a4c..862e9ea 100644
> --- a/drivers/staging/wilc1000/TODO
> +++ b/drivers/staging/wilc1000/TODO
> @@ -1,4 +1,3 @@
>  TODO:
> -- rework comments and function headers(also coding style)
>  - support soft-ap and p2p mode
>  - support resume/suspend function
> diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
> b/drivers/staging/wilc1000/wilc_wlan.h
> index 696cf1f..cd1ff85 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.h
> +++ b/drivers/staging/wilc1000/wilc_wlan.h
> @@ -4,7 +4,7 @@
>  
>  #include 
>  
> -#define ISWILC1000(id)   ((id & 0xf000) == 0x10 
> ? 1 : 0)
> +#define ISWILC1000(id)   (((id) & 0xf000) == 0x10 ? 1 : 
> 0)

Even better, make this an inline function that returns a boolean to
avoid any potental problems.

thanks,

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


Re: [PATCH 7/8] staging: wilc1000: replace udelay with usleep_range

2018-08-02 Thread Greg KH
On Sun, Jul 29, 2018 at 11:36:56AM +0530, Ajay Singh wrote:
> Cleanup patch to avoid the below checkpatch reported issue.
> 
> "usleep_range is preferred over udelay; see
> Documentation/timers/timers-howto.txt".
> 
> Signed-off-by: Ajay Singh 
> ---
>  drivers/staging/wilc1000/wilc_wlan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
> b/drivers/staging/wilc1000/wilc_wlan.c
> index 6bac3f7..655952a 100644
> --- a/drivers/staging/wilc1000/wilc_wlan.c
> +++ b/drivers/staging/wilc1000/wilc_wlan.c
> @@ -425,7 +425,7 @@ void chip_wakeup(struct wilc *wilc)
>   } while (wilc_get_chipid(wilc, true) == 0);
>   } else if ((wilc->io_type & 0x1) == HIF_SDIO) {
>   wilc->hif_func->hif_write_reg(wilc, 0xfa, 1);
> - udelay(200);
> + usleep_range(200, 201);

Hah, that's funny.

No, do it right, don't try to game checkpatch here.

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


Re: [PATCH 3/8] staging: wilc1000: remove unnecessary copyright information in file

2018-08-02 Thread Greg KH
On Sun, Jul 29, 2018 at 11:36:52AM +0530, Ajay Singh wrote:
> Cleanup patch to remove the unnecessary copyright information in
> the file, as it already has SPDX License Identifier.
> 
> Signed-off-by: Ajay Singh 
> ---
>  drivers/staging/wilc1000/wilc_debugfs.c  | 10 --
>  drivers/staging/wilc1000/wilc_sdio.c |  5 -
>  drivers/staging/wilc1000/wilc_spi.c  |  5 -
>  drivers/staging/wilc1000/wilc_wlan_cfg.c |  8 
>  drivers/staging/wilc1000/wilc_wlan_cfg.h |  8 
>  5 files changed, 36 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_debugfs.c 
> b/drivers/staging/wilc1000/wilc_debugfs.c
> index ac26e94..d86f457 100644
> --- a/drivers/staging/wilc1000/wilc_debugfs.c
> +++ b/drivers/staging/wilc1000/wilc_debugfs.c
> @@ -1,14 +1,4 @@
>  // SPDX-License-Identifier: GPL-2.0
> -/*
> - * NewportMedia WiFi chipset driver test tools - wilc-debug
> - * Copyright (c) 2012 NewportMedia Inc.
> - * Author: SSW 

No, you can not just drop copyright lines for no reason at all.  Did
your lawyers approve this patch?

SPDX identifes the _license_ of the file, not the copyrights, so it is
ok to drop these lines:

> - *
> - * 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.

As that is what it is replacing.  But not the copyrights.

Go show your lawyer this patch:

> --- a/drivers/staging/wilc1000/wilc_sdio.c
> +++ b/drivers/staging/wilc1000/wilc_sdio.c
> @@ -1,9 +1,4 @@
>  // SPDX-License-Identifier: GPL-2.0
> -/*
> - * Copyright (c) Atmel Corporation.  All rights reserved.

And see what they do :)

(yes, explicit copyright notices are really not needed and do not do
"much", but it is still the norm that they are present and our industry
does still rely on them...)

thanks,

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


Re: [PATCH char-misc 1/1] Drivers: hv: vmbus: Cleanup synic memory free path

2018-08-02 Thread Dan Carpenter
On Wed, Aug 01, 2018 at 03:45:13PM -0700, mhkelle...@gmail.com wrote:
> From: Michael Kelley 
> 
> clk_evt memory is not being freed when the synic is shutdown
> or when there is an allocation error.  Add the appropriate
> kfree() call, along with a comment to clarify how the memory
> gets freed after an allocation error.  Make the free path
> consistent by removing checks for NULL since kfree() and
> free_page() already do the check.
> 
> Signed-off-by: Michael Kelley 
> Reported-by: Dan Carpenter 
> ---
>  drivers/hv/hv.c | 14 --
>  1 file changed, 8 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 8d4fe0e..1fb9a6b 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -240,6 +240,10 @@ int hv_synic_alloc(void)
>  
>   return 0;
>  err:
> + /*
> +  * Any memory allocations that succeeded will be freed when
> +  * the caller cleans up by calling hv_synic_free()
> +  */
>   return -ENOMEM;
>  }
>  
> @@ -252,12 +256,10 @@ void hv_synic_free(void)
> for_each_present_cpu(cpu) {
>   struct hv_per_cpu_context *hv_cpu
>   = per_cpu_ptr(hv_context.cpu_context, cpu);
>  
> - if (hv_cpu->synic_event_page)
> - free_page((unsigned long)hv_cpu->synic_event_page);
> - if (hv_cpu->synic_message_page)
> - free_page((unsigned long)hv_cpu->synic_message_page);
> - if (hv_cpu->post_msg_page)
> - free_page((unsigned long)hv_cpu->post_msg_page);
> + kfree(hv_cpu->clk_evt);
> + free_page((unsigned long)hv_cpu->synic_event_page);
> + free_page((unsigned long)hv_cpu->synic_message_page);
> + free_page((unsigned long)hv_cpu->post_msg_page);

This looks buggy.

We can pass NULLs to free_page() so that's fine.  So the error handling assumes
that hv_cpu->clk_evt is either NULL or allocated.  Here is how it is allocated:

   189  int hv_synic_alloc(void)
   190  {
   191  int cpu;
   192  
   193  hv_context.hv_numa_map = kcalloc(nr_node_ids, sizeof(struct 
cpumask),
   194   GFP_KERNEL);
   195  if (hv_context.hv_numa_map == NULL) {
   196  pr_err("Unable to allocate NUMA map\n");
   197  goto err;
   198  }
   199  
   200  for_each_present_cpu(cpu) {
^^^
We loop over each CPU.

   201  struct hv_per_cpu_context *hv_cpu
   202  = per_cpu_ptr(hv_context.cpu_context, cpu);
   203  
   204  memset(hv_cpu, 0, sizeof(*hv_cpu));
^^
We set this cpu memory to NULL.

   205  tasklet_init(_cpu->msg_dpc,
   206   vmbus_on_msg_dpc, (unsigned long) hv_cpu);
   207  
   208  hv_cpu->clk_evt = kzalloc(sizeof(struct 
clock_event_device),
   209GFP_KERNEL);
   210  if (hv_cpu->clk_evt == NULL) {
^^^
Let's assume this fails on the first iteration through the loop.  We
haven't memset the next cpu to NULL or allocated it.  But we loop over
all the cpus in the error handling.  Since we didn't set everything to NULL in
hv_synic_free() then it seems like this could be a double free.  It's possible I
am misreading the code, but either it's buggy or the memset() can be removed.

This is a very typical bug for this style of error handling where we free
things which were never allocated.

   211  pr_err("Unable to allocate clock event 
device\n");
   212  goto err;
   213  }

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


[PATCH v9 15/15] staging: mt7621-dts: add pcie controller port registers

2018-08-02 Thread Sergio Paracuellos
The pcie node of the device tree only contains registers
for the host-bridge and pcie port 0. Add the pcie port 1
and pcie port 2 also.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-dts/mt7621.dtsi | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi 
b/drivers/staging/mt7621-dts/mt7621.dtsi
index 4610403..2e837e6 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/drivers/staging/mt7621-dts/mt7621.dtsi
@@ -394,8 +394,10 @@
 
pcie: pcie@1e14 {
compatible = "mediatek,mt7621-pci";
-   reg = <0x1e14 0x100
-   0x1e142000 0x100>;
+   reg = <0x1e14 0x100 /* host-pci bridge registers */
+   0x1e142000 0x100/* pcie port 0 RC control registers 
*/
+   0x1e143000 0x100/* pcie port 1 RC control registers 
*/
+   0x1e144000 0x100>;  /* pcie port 2 RC control registers 
*/
 
#address-cells = <3>;
#size-cells = <2>;
-- 
2.7.4

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


[PATCH v9 14/15] staging: mt7621-pci: remove remaining pci_legacy dependant code

2018-08-02 Thread Sergio Paracuellos
pcibios_* remaining code is not neccessary at all. We can use
map_irq set to of_irq_parse_and_map_pci driver 'probe' function.
Remove this code.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 33 +
 1 file changed, 1 insertion(+), 32 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 491dda7..e224d30 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -203,32 +203,6 @@ write_config(struct mt7621_pcie *pcie, unsigned int dev, 
u32 reg, u32 val)
pcie_write(pcie, val, RALINK_PCI_CONFIG_DATA);
 }
 
-int
-pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-{
-   struct mt7621_pcie *pcie = dev->bus->sysdata;
-   u16 cmd;
-   u32 val;
-   int irq;
-
-   if (dev->bus->number == 0) {
-   write_config(pcie, slot, PCI_BASE_ADDRESS_0, MEMORY_BASE);
-   val = read_config(pcie, slot, PCI_BASE_ADDRESS_0);
-   printk("BAR0 at slot %d = %x\n", slot, val);
-   }
-
-   pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, 0x14);  //configure 
cache line size 0x14
-   pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xFF);  //configure 
latency timer 0x10
-   pci_read_config_word(dev, PCI_COMMAND, );
-   cmd = cmd | PCI_COMMAND_MASTER | PCI_COMMAND_IO | PCI_COMMAND_MEMORY;
-   pci_write_config_word(dev, PCI_COMMAND, cmd);
-
-   irq = of_irq_parse_and_map_pci(dev, slot, pin);
-
-   pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
-   return irq;
-}
-
 void
 set_pcie_phy(struct mt7621_pcie *pcie, u32 offset,
 int start_b, int bits, int val)
@@ -438,7 +412,7 @@ static int mt7621_pcie_register_host(struct pci_host_bridge 
*host,
host->busnr = 0;
host->dev.parent = pcie->dev;
host->ops = _pci_ops;
-   host->map_irq = pcibios_map_irq;
+   host->map_irq = of_irq_parse_and_map_pci;
host->swizzle_irq = pci_common_swizzle;
host->sysdata = pcie;
 
@@ -695,11 +669,6 @@ pcie(2/1/0) link statuspcie2_num   pcie1_num   
pcie0_num
return 0;
 }
 
-int pcibios_plat_dev_init(struct pci_dev *dev)
-{
-   return 0;
-}
-
 static const struct of_device_id mt7621_pci_ids[] = {
{ .compatible = "mediatek,mt7621-pci" },
{},
-- 
2.7.4

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


[PATCH v9 11/15] staging: mt7621-pci: remove RALINK_PCI_BASE from remaining definitions

2018-08-02 Thread Sergio Paracuellos
RALINK_PCI_BASE has no sense and this driver has base address readed
and mapped from device tree. Remove remaining uses of it and
change code to use pcie_read and pcie_write functions in places
where this was being used.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 131 
 1 file changed, 67 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 696d967..288f83a 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -76,7 +76,6 @@
 
 #define RALINK_PCI_PCICFG_ADDR 0x
 #define RALINK_PCI_PCIMSK_ADDR 0x000C
-#define RALINK_PCI_BASE0xBE14
 
 #define RT6855_PCIE0_OFFSET0x2000
 #define RT6855_PCIE1_OFFSET0x3000
@@ -89,8 +88,8 @@
 #define RALINK_PCI_SUBID   0x0038
 #define RALINK_PCI_STATUS  0x0050
 
-#define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000)
-#define RALINK_PCIEPHY_P2_CTL_OFFSET   (RALINK_PCI_BASE + 0xA000)
+#define RALINK_PCIEPHY_P0P1_CTL_OFFSET 0x9000
+#define RALINK_PCIEPHY_P2_CTL_OFFSET   0xA000
 
 #define RALINK_PCI_MM_MAP_BASE 0x6000
 #define RALINK_PCI_IO_MAP_BASE 0x1e16
@@ -231,105 +230,109 @@ pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 
pin)
 }
 
 void
-set_pcie_phy(u32 *addr, int start_b, int bits, int val)
+set_pcie_phy(struct mt7621_pcie *pcie, u32 offset,
+int start_b, int bits, int val)
 {
-   *(unsigned int *)(addr) &= ~(((1<> 6) & 0x7;
/* Set PCIe Port0 & Port1 PHY to disable SSC */
/* Debug Xtal Type */
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x400),  8, 1, 
0x01); // rg_pe1_frc_h_xtal_type
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x400),  9, 2, 
0x00); // rg_pe1_h_xtal_type
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000),  4, 1, 
0x01); // rg_pe1_frc_phy_en//Force Port 0 enable control
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100),  4, 1, 
0x01); // rg_pe1_frc_phy_en//Force Port 1 enable control
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000),  5, 1, 
0x00); // rg_pe1_phy_en//Port 0 disable
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100),  5, 1, 
0x00); // rg_pe1_phy_en//Port 1 disable
+   set_pcie_phy(pcie, (RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x400),  8, 1, 
0x01);  // rg_pe1_frc_h_xtal_type
+   set_pcie_phy(pcie, (RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x400),  9, 2, 
0x00);  // rg_pe1_h_xtal_type
+   set_pcie_phy(pcie, (RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000),  4, 1, 
0x01);  // rg_pe1_frc_phy_en//Force Port 0 enable control
+   set_pcie_phy(pcie, (RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100),  4, 1, 
0x01);  // rg_pe1_frc_phy_en//Force Port 1 enable control
+   set_pcie_phy(pcie, (RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x000),  5, 1, 
0x00);  // rg_pe1_phy_en//Port 0 disable
+   set_pcie_phy(pcie, (RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x100),  5, 1, 
0x00);  // rg_pe1_phy_en//Port 1 disable
if (reg <= 5 && reg >= 3) { // 40MHz Xtal
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490),  
6, 2, 0x01); // RG_PE1_H_PLL_PREDIV  //Pre-divider ratio (for host mode)
+   set_pcie_phy(pcie, (RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490),  
6, 2, 0x01);  // RG_PE1_H_PLL_PREDIV  //Pre-divider ratio (for host mode)
printk("* Xtal 40MHz *\n");
} else {// 25MHz | 20MHz Xtal
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490),  
6, 2, 0x00); // RG_PE1_H_PLL_PREDIV  //Pre-divider ratio (for host mode)
+   set_pcie_phy(pcie, (RALINK_PCIEPHY_P0P1_CTL_OFFSET + 0x490),  
6, 2, 0x00);  // RG_PE1_H_PLL_PREDIV  //Pre-divider ratio (for host mode)
if (reg >= 6) {
printk("* Xtal 25MHz *\n");
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4bc),  4, 2, 0x01); // RG_PE1_H_PLL_FBKSEL  //Feedback clock select
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x49c),  0, 31, 0x1800);  // RG_PE1_H_LCDDS_PCW_NCPO  //DDS NCPO 
PCW (for host mode)
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a4),  0, 16, 0x18d);   // RG_PE1_H_LCDDS_SSC_PRD   //DDS SSC dither 
period control
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a8),  0, 12, 0x4a);// RG_PE1_H_LCDDS_SSC_DELTA //DDS SSC dither 
amplitude control
-   set_pcie_phy((u32 *)(RALINK_PCIEPHY_P0P1_CTL_OFFSET + 
0x4a8), 16, 12, 0x4a);// RG_PE1_H_LCDDS_SSC_DELTA1//DDS SSC dither 
amplitude control for initial
+  

[PATCH v9 13/15] staging: mt7621-pci: rename RALINK_PCI_CONFIG_DATA_VIRTUAL_REG definition

2018-08-02 Thread Sergio Paracuellos
RALINK_PCI_CONFIG_DATA_VIRTUAL_REG is a very long name. Make it a bit
shorter renaming it to RALINK_PCI_CONFIG_DATA.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index d6f4085..491dda7 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -67,7 +67,7 @@
 #define RALINK_PCIE2_CLK_ENBIT(26)
 
 #define RALINK_PCI_CONFIG_ADDR 0x20
-#define RALINK_PCI_CONFIG_DATA_VIRTUAL_REG 0x24
+#define RALINK_PCI_CONFIG_DATA 0x24
 #define RALINK_PCI_MEMBASE 0x28
 #define RALINK_PCI_IOBASE  0x2C
 #define RALINK_PCIE0_RST   BIT(24)
@@ -176,7 +176,7 @@ static void __iomem *mt7621_pcie_map_bus(struct pci_bus 
*bus,
 
writel(address, pcie->base + RALINK_PCI_CONFIG_ADDR);
 
-   return pcie->base + RALINK_PCI_CONFIG_DATA_VIRTUAL_REG + (where & 3);
+   return pcie->base + RALINK_PCI_CONFIG_DATA + (where & 3);
 }
 
 struct pci_ops mt7621_pci_ops = {
@@ -191,7 +191,7 @@ read_config(struct mt7621_pcie *pcie, unsigned int dev, u32 
reg)
u32 address = mt7621_pci_get_cfgaddr(0, dev, 0, reg);
 
pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR);
-   return pcie_read(pcie, RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
+   return pcie_read(pcie, RALINK_PCI_CONFIG_DATA);
 }
 
 static void
@@ -200,7 +200,7 @@ write_config(struct mt7621_pcie *pcie, unsigned int dev, 
u32 reg, u32 val)
u32 address = mt7621_pci_get_cfgaddr(0, dev, 0, reg);
 
pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR);
-   pcie_write(pcie, val, RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
+   pcie_write(pcie, val, RALINK_PCI_CONFIG_DATA);
 }
 
 int
-- 
2.7.4

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


[PATCH v9 12/15] staging: mt7621-pci: use BIT macro in preprocessor definitions

2018-08-02 Thread Sergio Paracuellos
Some preprocessor definitions are using a custom implementation of
BIT macro. Just use linux kernel BIT macro instead.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 288f83a..d6f4085 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -62,17 +62,17 @@
  * devices.
  */
 
-#define RALINK_PCIE0_CLK_EN(1<<24)
-#define RALINK_PCIE1_CLK_EN(1<<25)
-#define RALINK_PCIE2_CLK_EN(1<<26)
+#define RALINK_PCIE0_CLK_ENBIT(24)
+#define RALINK_PCIE1_CLK_ENBIT(25)
+#define RALINK_PCIE2_CLK_ENBIT(26)
 
 #define RALINK_PCI_CONFIG_ADDR 0x20
 #define RALINK_PCI_CONFIG_DATA_VIRTUAL_REG 0x24
 #define RALINK_PCI_MEMBASE 0x28
 #define RALINK_PCI_IOBASE  0x2C
-#define RALINK_PCIE0_RST   (1<<24)
-#define RALINK_PCIE1_RST   (1<<25)
-#define RALINK_PCIE2_RST   (1<<26)
+#define RALINK_PCIE0_RST   BIT(24)
+#define RALINK_PCIE1_RST   BIT(25)
+#define RALINK_PCIE2_RST   BIT(26)
 
 #define RALINK_PCI_PCICFG_ADDR 0x
 #define RALINK_PCI_PCIMSK_ADDR 0x000C
@@ -115,11 +115,11 @@
 #define RALINK_PCIE_CLK_GEN0x7c
 #define RALINK_PCIE_CLK_GEN1   0x80
 //RALINK_RSTCTRL bit
-#define RALINK_PCIE_RST(1<<23)
-#define RALINK_PCI_RST (1<<24)
+#define RALINK_PCIE_RSTBIT(23)
+#define RALINK_PCI_RST BIT(24)
 //RALINK_CLKCFG1 bit
-#define RALINK_PCI_CLK_EN  (1<<19)
-#define RALINK_PCIE_CLK_EN (1<<21)
+#define RALINK_PCI_CLK_EN  BIT(19)
+#define RALINK_PCIE_CLK_EN BIT(21)
 
 #define MEMORY_BASE 0x0
 static int pcie_link_status = 0;
-- 
2.7.4

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


[PATCH v9 05/15] staging: mt7621-pci: simplify read_config function

2018-08-02 Thread Sergio Paracuellos
read_config function is always called with bus and func
being 0. Avoid those params and just use 0 inside the
function. Return readed value instead pass a reference
parameter.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 32 +++-
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index d5b939d..c724165 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -228,15 +228,13 @@ struct pci_ops mt7621_pci_ops = {
.write  = pci_generic_config_write,
 };
 
-static void
-read_config(struct mt7621_pcie *pcie,
-   unsigned long bus, unsigned long dev,
-   unsigned long func, unsigned long reg, unsigned long *val)
+static u32
+read_config(struct mt7621_pcie *pcie, unsigned int dev, u32 reg)
 {
-   u32 address = mt7621_pci_get_cfgaddr(bus, dev, func, reg);
+   u32 address = mt7621_pci_get_cfgaddr(0, dev, 0, reg);
 
pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR);
-   *val = pcie_read(pcie, RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
+   return pcie_read(pcie, RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
 }
 
 static void
@@ -260,7 +258,7 @@ pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 
if (dev->bus->number == 0) {
write_config(pcie, 0, slot, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE);
-   read_config(pcie, 0, slot, 0, PCI_BASE_ADDRESS_0, (unsigned 
long *));
+   val = read_config(pcie, slot, PCI_BASE_ADDRESS_0);
printk("BAR0 at slot %d = %x\n", slot, val);
}
 
@@ -494,7 +492,7 @@ static int mt7621_pci_probe(struct platform_device *pdev)
struct mt7621_pcie *pcie;
struct pci_host_bridge *bridge;
int err;
-   unsigned long val = 0;
+   u32 val = 0;
LIST_HEAD(res);
 
if (!dev->of_node)
@@ -546,13 +544,13 @@ static int mt7621_pci_probe(struct platform_device *pdev)
bypass_pipe_rst();
set_phy_for_ssc();
 
-   read_config(pcie, 0, 0, 0, 0x70c, );
+   val = read_config(pcie, 0, 0x70c);
printk("Port 0 N_FTS = %x\n", (unsigned int)val);
 
-   read_config(pcie, 0, 1, 0, 0x70c, );
+   val = read_config(pcie, 1, 0x70c);
printk("Port 1 N_FTS = %x\n", (unsigned int)val);
 
-   read_config(pcie, 0, 2, 0, 0x70c, );
+   val = read_config(pcie, 2, 0x70c);
printk("Port 2 N_FTS = %x\n", (unsigned int)val);
 
rt_sysc_m32(0, RALINK_PCIE_RST, RALINK_RSTCTRL);
@@ -673,25 +671,25 @@ pcie(2/1/0) link status   pcie2_num   pcie1_num   
pcie0_num
 
switch (pcie_link_status) {
case 7:
-   read_config(pcie, 0, 2, 0, 0x4, );
+   val = read_config(pcie, 2, 0x4);
write_config(pcie, 0, 2, 0, 0x4, val|0x4);
-   read_config(pcie, 0, 2, 0, 0x70c, );
+   val = read_config(pcie, 2, 0x70c);
val &= ~(0xff)<<8;
val |= 0x50<<8;
write_config(pcie, 0, 2, 0, 0x70c, val);
case 3:
case 5:
case 6:
-   read_config(pcie, 0, 1, 0, 0x4, );
+   val = read_config(pcie, 1, 0x4);
write_config(pcie, 0, 1, 0, 0x4, val|0x4);
-   read_config(pcie, 0, 1, 0, 0x70c, );
+   val = read_config(pcie, 1, 0x70c);
val &= ~(0xff)<<8;
val |= 0x50<<8;
write_config(pcie, 0, 1, 0, 0x70c, val);
default:
-   read_config(pcie, 0, 0, 0, 0x4, );
+   val = read_config(pcie, 0, 0x4);
write_config(pcie, 0, 0, 0, 0x4, val|0x4); //bus master enable
-   read_config(pcie, 0, 0, 0, 0x70c, );
+   val = read_config(pcie, 0, 0x70c);
val &= ~(0xff)<<8;
val |= 0x50<<8;
write_config(pcie, 0, 0, 0, 0x70c, val);
-- 
2.7.4

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


[PATCH v9 08/15] staging: mt7621-pci: avoid register duplication per controller using pcie_[read|write]

2018-08-02 Thread Sergio Paracuellos
Use pcie_[read|write] fucntions to read and write controller registers.
Define those only by offset and pass controller offset + register offset
relative to base address to functions.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 70 -
 1 file changed, 34 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 65c573c..2533dfc 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -74,8 +74,8 @@
 
 #define RALINK_PCI_CONFIG_ADDR 0x20
 #define RALINK_PCI_CONFIG_DATA_VIRTUAL_REG 0x24
-#define RALINK_PCI_MEMBASE *(volatile u32 *)(RALINK_PCI_BASE + 
0x0028)
-#define RALINK_PCI_IOBASE  *(volatile u32 *)(RALINK_PCI_BASE + 
0x002C)
+#define RALINK_PCI_MEMBASE 0x28
+#define RALINK_PCI_IOBASE  0x2C
 #define RALINK_PCIE0_RST   (1<<24)
 #define RALINK_PCIE1_RST   (1<<25)
 #define RALINK_PCIE2_RST   (1<<26)
@@ -88,26 +88,12 @@
 #define RT6855_PCIE1_OFFSET0x3000
 #define RT6855_PCIE2_OFFSET0x4000
 
-#define RALINK_PCI0_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0010)
-#define RALINK_PCI0_IMBASEBAR0_ADDR*(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0018)
-#define RALINK_PCI0_ID *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0030)
-#define RALINK_PCI0_CLASS  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0034)
-#define RALINK_PCI0_SUBID  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0038)
-#define RALINK_PCI0_STATUS *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0050)
-
-#define RALINK_PCI1_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0010)
-#define RALINK_PCI1_IMBASEBAR0_ADDR*(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0018)
-#define RALINK_PCI1_ID *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0030)
-#define RALINK_PCI1_CLASS  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0034)
-#define RALINK_PCI1_SUBID  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0038)
-#define RALINK_PCI1_STATUS *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0050)
-
-#define RALINK_PCI2_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0010)
-#define RALINK_PCI2_IMBASEBAR0_ADDR*(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0018)
-#define RALINK_PCI2_ID *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0030)
-#define RALINK_PCI2_CLASS  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0034)
-#define RALINK_PCI2_SUBID  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0038)
-#define RALINK_PCI2_STATUS *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0050)
+#define RALINK_PCI_BAR0SETUP_ADDR  0x0010
+#define RALINK_PCI_IMBASEBAR0_ADDR 0x0018
+#define RALINK_PCI_ID  0x0030
+#define RALINK_PCI_CLASS   0x0034
+#define RALINK_PCI_SUBID   0x0038
+#define RALINK_PCI_STATUS  0x0050
 
 #define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000)
 #define RALINK_PCIEPHY_P2_CTL_OFFSET   (RALINK_PCI_BASE + 0xA000)
@@ -543,7 +529,7 @@ static int mt7621_pci_probe(struct platform_device *pdev)
*(unsigned int *)(0xbe000620) |= 0x1<<19 | 0x1<<8 | 0x1<<7; 
// set DATA
mdelay(1000);
 
-   if ((RALINK_PCI0_STATUS & 0x1) == 0) {
+   if ((pcie_read(pcie, RT6855_PCIE0_OFFSET + RALINK_PCI_STATUS) & 0x1) == 
0) {
printk("PCIE0 no card, disable it(RST)\n");
ASSERT_SYSRST_PCIE(RALINK_PCIE0_RST);
rt_sysc_m32(RALINK_PCIE0_CLK_EN, 0, RALINK_CLKCFG1);
@@ -553,7 +539,7 @@ static int mt7621_pci_probe(struct platform_device *pdev)
RALINK_PCI_PCIMSK_ADDR |= (1<<20); // enable pcie1 interrupt
}
 
-   if ((RALINK_PCI1_STATUS & 0x1) == 0) {
+   if ((pcie_read(pcie, RT6855_PCIE1_OFFSET + RALINK_PCI_STATUS) & 0x1) == 
0) {
printk("PCIE1 no card, disable it(RST)\n");
ASSERT_SYSRST_PCIE(RALINK_PCIE1_RST);
rt_sysc_m32(RALINK_PCIE1_CLK_EN, 0, RALINK_CLKCFG1);
@@ -563,7 +549,7 @@ static int mt7621_pci_probe(struct platform_device *pdev)
RALINK_PCI_PCIMSK_ADDR |= (1<<21); // enable pcie1 interrupt
}
 
-   if ((RALINK_PCI2_STATUS & 0x1) == 0) {
+   if ((pcie_read(pcie, RT6855_PCIE2_OFFSET + RALINK_PCI_STATUS) & 0x1) == 
0) {
printk("PCIE2 no card, disable it(RST)\n");
ASSERT_SYSRST_PCIE(RALINK_PCIE2_RST);

[PATCH v9 06/15] staging: mt7621-pci: simplify write_config function

2018-08-02 Thread Sergio Paracuellos
write_config function is always called with bus and func
being 0. Avoid those params and just use 0 inside the
function. Review parameter types changing for more proper
ones.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 20 +---
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index c724165..aa95457 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -238,11 +238,9 @@ read_config(struct mt7621_pcie *pcie, unsigned int dev, 
u32 reg)
 }
 
 static void
-write_config(struct mt7621_pcie *pcie,
-unsigned long bus, unsigned long dev,
-unsigned long func, unsigned long reg, unsigned long val)
+write_config(struct mt7621_pcie *pcie, unsigned int dev, u32 reg, u32 val)
 {
-   u32 address = mt7621_pci_get_cfgaddr(bus, dev, func, reg);
+   u32 address = mt7621_pci_get_cfgaddr(0, dev, 0, reg);
 
pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR);
pcie_write(pcie, val, RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
@@ -257,7 +255,7 @@ pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
int irq;
 
if (dev->bus->number == 0) {
-   write_config(pcie, 0, slot, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE);
+   write_config(pcie, slot, PCI_BASE_ADDRESS_0, MEMORY_BASE);
val = read_config(pcie, slot, PCI_BASE_ADDRESS_0);
printk("BAR0 at slot %d = %x\n", slot, val);
}
@@ -672,27 +670,27 @@ pcie(2/1/0) link status   pcie2_num   pcie1_num   
pcie0_num
switch (pcie_link_status) {
case 7:
val = read_config(pcie, 2, 0x4);
-   write_config(pcie, 0, 2, 0, 0x4, val|0x4);
+   write_config(pcie, 2, 0x4, val|0x4);
val = read_config(pcie, 2, 0x70c);
val &= ~(0xff)<<8;
val |= 0x50<<8;
-   write_config(pcie, 0, 2, 0, 0x70c, val);
+   write_config(pcie, 2, 0x70c, val);
case 3:
case 5:
case 6:
val = read_config(pcie, 1, 0x4);
-   write_config(pcie, 0, 1, 0, 0x4, val|0x4);
+   write_config(pcie, 1, 0x4, val|0x4);
val = read_config(pcie, 1, 0x70c);
val &= ~(0xff)<<8;
val |= 0x50<<8;
-   write_config(pcie, 0, 1, 0, 0x70c, val);
+   write_config(pcie, 1, 0x70c, val);
default:
val = read_config(pcie, 0, 0x4);
-   write_config(pcie, 0, 0, 0, 0x4, val|0x4); //bus master enable
+   write_config(pcie, 0, 0x4, val|0x4); //bus master enable
val = read_config(pcie, 0, 0x70c);
val &= ~(0xff)<<8;
val |= 0x50<<8;
-   write_config(pcie, 0, 0, 0, 0x70c, val);
+   write_config(pcie, 0, 0x70c, val);
}
 
err = mt7621_pci_parse_request_of_pci_ranges(pcie, );
-- 
2.7.4

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


[PATCH v9 03/15] staging: mt7621-pci: add pcie_write and pcie_read helpers

2018-08-02 Thread Sergio Paracuellos
Introdice this functions to make easier to write/read to/from
an offset relative to base address

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index a82fd01..c170cd5 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -193,6 +193,16 @@ struct mt7621_pcie {
struct list_head ports;
 };
 
+static inline u32 pcie_read(struct mt7621_pcie *pcie, u32 reg)
+{
+   return readl(pcie->base + reg);
+}
+
+static inline void pcie_write(struct mt7621_pcie *pcie, u32 val, u32 reg)
+{
+   writel(val, pcie->base + reg);
+}
+
 static inline u32 mt7621_pci_get_cfgaddr(unsigned int bus, unsigned int slot,
 unsigned int func, unsigned int where)
 {
-- 
2.7.4

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


[PATCH v9 10/15] staging: mt7621-pci: use pcie_[read|write] in RALINK_PCI_PCICFG_ADDR and RALINK_PCI_PCIMSK_ADDR

2018-08-02 Thread Sergio Paracuellos
RALINK_PCI_PCICFG_ADDR and RALINK_PCI_PCIMSK_ADDR are defined to be directly
referenced for read and write. Use pcie_read and pcie_write instead changing
its definition to a simple relative offset to pcie base address.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 54 +
 1 file changed, 34 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 4dcb881..696d967 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -74,8 +74,8 @@
 #define RALINK_PCIE1_RST   (1<<25)
 #define RALINK_PCIE2_RST   (1<<26)
 
-#define RALINK_PCI_PCICFG_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 
0x)
-#define RALINK_PCI_PCIMSK_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 
0x000C)
+#define RALINK_PCI_PCICFG_ADDR 0x
+#define RALINK_PCI_PCIMSK_ADDR 0x000C
 #define RALINK_PCI_BASE0xBE14
 
 #define RT6855_PCIE0_OFFSET0x2000
@@ -530,7 +530,9 @@ static int mt7621_pci_probe(struct platform_device *pdev)
pcie_link_status &= ~(1<<0);
} else {
pcie_link_status |= 1<<0;
-   RALINK_PCI_PCIMSK_ADDR |= (1<<20); // enable pcie1 interrupt
+   val = pcie_read(pcie, RALINK_PCI_PCIMSK_ADDR);
+   val |= (1<<20); // enable pcie1 interrupt
+   pcie_write(pcie, val, RALINK_PCI_PCIMSK_ADDR);
}
 
if ((pcie_read(pcie, RT6855_PCIE1_OFFSET + RALINK_PCI_STATUS) & 0x1) == 
0) {
@@ -540,7 +542,9 @@ static int mt7621_pci_probe(struct platform_device *pdev)
pcie_link_status &= ~(1<<1);
} else {
pcie_link_status |= 1<<1;
-   RALINK_PCI_PCIMSK_ADDR |= (1<<21); // enable pcie1 interrupt
+   val = pcie_read(pcie, RALINK_PCI_PCIMSK_ADDR);
+   val |= (1<<21); // enable pcie1 interrupt
+   pcie_write(pcie, val, RALINK_PCI_PCIMSK_ADDR);
}
 
if ((pcie_read(pcie, RT6855_PCIE2_OFFSET + RALINK_PCI_STATUS) & 0x1) == 
0) {
@@ -550,7 +554,9 @@ static int mt7621_pci_probe(struct platform_device *pdev)
pcie_link_status &= ~(1<<2);
} else {
pcie_link_status |= 1<<2;
-   RALINK_PCI_PCIMSK_ADDR |= (1<<22); // enable pcie2 interrupt
+   val = pcie_read(pcie, RALINK_PCI_PCIMSK_ADDR);
+   val |= (1<<22); // enable pcie2 interrupt
+   pcie_write(pcie, val, RALINK_PCI_PCIMSK_ADDR);
}
 
if (pcie_link_status == 0)
@@ -569,27 +575,35 @@ pcie(2/1/0) link status   pcie2_num   pcie1_num   
pcie0_num
 */
switch (pcie_link_status) {
case 2:
-   RALINK_PCI_PCICFG_ADDR &= ~0x00ff;
-   RALINK_PCI_PCICFG_ADDR |= 0x1 << 16;//port0
-   RALINK_PCI_PCICFG_ADDR |= 0x0 << 20;//port1
+   val = pcie_read(pcie, RALINK_PCI_PCICFG_ADDR);
+   val &= ~0x00ff;
+   val |= 0x1 << 16;   // port 0
+   val |= 0x0 << 20;   // port 1
+   pcie_write(pcie, val, RALINK_PCI_PCICFG_ADDR);
break;
case 4:
-   RALINK_PCI_PCICFG_ADDR &= ~0x0fff;
-   RALINK_PCI_PCICFG_ADDR |= 0x1 << 16;//port0
-   RALINK_PCI_PCICFG_ADDR |= 0x2 << 20;//port1
-   RALINK_PCI_PCICFG_ADDR |= 0x0 << 24;//port2
+   val = pcie_read(pcie, RALINK_PCI_PCICFG_ADDR);
+   val &= ~0x0fff;
+   val |= 0x1 << 16;   //port0
+   val |= 0x2 << 20;   //port1
+   val |= 0x0 << 24;   //port2
+   pcie_write(pcie, val, RALINK_PCI_PCICFG_ADDR);
break;
case 5:
-   RALINK_PCI_PCICFG_ADDR &= ~0x0fff;
-   RALINK_PCI_PCICFG_ADDR |= 0x0 << 16;//port0
-   RALINK_PCI_PCICFG_ADDR |= 0x2 << 20;//port1
-   RALINK_PCI_PCICFG_ADDR |= 0x1 << 24;//port2
+   val = pcie_read(pcie, RALINK_PCI_PCICFG_ADDR);
+   val &= ~0x0fff;
+   val |= 0x0 << 16;   //port0
+   val |= 0x2 << 20;   //port1
+   val |= 0x1 << 24;   //port2
+   pcie_write(pcie, val, RALINK_PCI_PCICFG_ADDR);
break;
case 6:
-   RALINK_PCI_PCICFG_ADDR &= ~0x0fff;
-   RALINK_PCI_PCICFG_ADDR |= 0x2 << 16;//port0
-   RALINK_PCI_PCICFG_ADDR |= 0x0 << 20;//port1
-   RALINK_PCI_PCICFG_ADDR |= 0x1 << 24;//port2
+   val = pcie_read(pcie, RALINK_PCI_PCICFG_ADDR);
+   val &= ~0x0fff;
+   val |= 0x2 << 16;   //port0
+   val |= 0x0 << 20;   //port1
+   val |= 0x1 << 24;   //port2
+   pcie_write(pcie, val, 

[PATCH v9 02/15] staging: mt7621-pci: remove dead code derived to not use custom reads and writes

2018-08-02 Thread Sergio Paracuellos
Driver is using now pci subsystem generics reads and writes and requesting
bus resources without using legacy code functions. Because of this there is
a lot of dead code that can be removed.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 128 
 1 file changed, 128 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index fb2618a..a82fd01 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -123,15 +123,6 @@
*(volatile u32 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le32(data)
 #define MV_READ(ofs, data) \
*(data) = le32_to_cpu(*(volatile u32 *)(RALINK_PCI_BASE+(ofs)))
-#define MV_WRITE_16(ofs, data) \
-   *(volatile u16 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le16(data)
-#define MV_READ_16(ofs, data)  \
-   *(data) = le16_to_cpu(*(volatile u16 *)(RALINK_PCI_BASE+(ofs)))
-
-#define MV_WRITE_8(ofs, data)  \
-   *(volatile u8 *)(RALINK_PCI_BASE+(ofs)) = data
-#define MV_READ_8(ofs, data)   \
-   *(data) = *(volatile u8 *)(RALINK_PCI_BASE+(ofs))
 
 #define RALINK_PCI_MM_MAP_BASE 0x6000
 #define RALINK_PCI_IO_MAP_BASE 0x1e16
@@ -176,13 +167,6 @@
 #define MEMORY_BASE 0x0
 static int pcie_link_status = 0;
 
-#define PCI_ACCESS_READ_1  0
-#define PCI_ACCESS_READ_2  1
-#define PCI_ACCESS_READ_4  2
-#define PCI_ACCESS_WRITE_1 3
-#define PCI_ACCESS_WRITE_2 4
-#define PCI_ACCESS_WRITE_4 5
-
 /**
  * struct mt7621_pcie_port - PCIe port information
  * @base: IO mapped register base
@@ -216,118 +200,6 @@ static inline u32 mt7621_pci_get_cfgaddr(unsigned int 
bus, unsigned int slot,
(func << 8) | (where & 0xfc) | 0x8000;
 }
 
-static int config_access(unsigned char access_type, struct pci_bus *bus,
-   unsigned int devfn, unsigned int where, u32 *data)
-{
-   unsigned int slot = PCI_SLOT(devfn);
-   u8 func = PCI_FUNC(devfn);
-   u32 address_reg, data_reg;
-   unsigned int address;
-
-   address_reg = RALINK_PCI_CONFIG_ADDR;
-   data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG;
-
-   address = mt7621_pci_get_cfgaddr(bus->number, slot, func, where);
-
-   MV_WRITE(address_reg, address);
-
-   switch (access_type) {
-   case PCI_ACCESS_WRITE_1:
-   MV_WRITE_8(data_reg+(where&0x3), *data);
-   break;
-   case PCI_ACCESS_WRITE_2:
-   MV_WRITE_16(data_reg+(where&0x3), *data);
-   break;
-   case PCI_ACCESS_WRITE_4:
-   MV_WRITE(data_reg, *data);
-   break;
-   case PCI_ACCESS_READ_1:
-   MV_READ_8(data_reg+(where&0x3), data);
-   break;
-   case PCI_ACCESS_READ_2:
-   MV_READ_16(data_reg+(where&0x3), data);
-   break;
-   case PCI_ACCESS_READ_4:
-   MV_READ(data_reg, data);
-   break;
-   default:
-   printk("no specify access type\n");
-   break;
-   }
-   return 0;
-}
-
-static int
-read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 *val)
-{
-   return config_access(PCI_ACCESS_READ_1, bus, devfn, (unsigned 
int)where, (u32 *)val);
-}
-
-static int
-read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 *val)
-{
-   return config_access(PCI_ACCESS_READ_2, bus, devfn, (unsigned 
int)where, (u32 *)val);
-}
-
-static int
-read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 *val)
-{
-   return config_access(PCI_ACCESS_READ_4, bus, devfn, (unsigned 
int)where, (u32 *)val);
-}
-
-static int
-write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 val)
-{
-   if (config_access(PCI_ACCESS_WRITE_1, bus, devfn, (unsigned int)where, 
(u32 *)))
-   return -1;
-
-   return PCIBIOS_SUCCESSFUL;
-}
-
-static int
-write_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 val)
-{
-   if (config_access(PCI_ACCESS_WRITE_2, bus, devfn, where, (u32 *)))
-   return -1;
-
-   return PCIBIOS_SUCCESSFUL;
-}
-
-static int
-write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val)
-{
-   if (config_access(PCI_ACCESS_WRITE_4, bus, devfn, where, ))
-   return -1;
-
-   return PCIBIOS_SUCCESSFUL;
-}
-
-static int
-pci_config_read(struct pci_bus *bus, unsigned int devfn, int where, int size, 
u32 *val)
-{
-   switch (size) {
-   case 1:
-   return read_config_byte(bus, devfn, where, (u8 *) val);
-   case 2:
-   return read_config_word(bus, devfn, where, (u16 *) val);
-   default:
-   return read_config_dword(bus, devfn, where, val);
-   }
-}
-
-static int
-pci_config_write(struct pci_bus *bus, unsigned int devfn, int where, int size, 
u32 val)
-{
-   switch (size) {
-   case 1:
-   return 

[PATCH v9 04/15] staging: mt7621-pci: use pcie_[read|write] in [write|read]_config

2018-08-02 Thread Sergio Paracuellos
Instead of custom macros use pcie_read and pcie_write functions.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 67 -
 1 file changed, 32 insertions(+), 35 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index c170cd5..d5b939d 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -229,41 +229,38 @@ struct pci_ops mt7621_pci_ops = {
 };
 
 static void
-read_config(unsigned long bus, unsigned long dev, unsigned long func, unsigned 
long reg, unsigned long *val)
+read_config(struct mt7621_pcie *pcie,
+   unsigned long bus, unsigned long dev,
+   unsigned long func, unsigned long reg, unsigned long *val)
 {
-   u32 address_reg, data_reg, address;
-
-   address_reg = RALINK_PCI_CONFIG_ADDR;
-   data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG;
-   address = mt7621_pci_get_cfgaddr(bus, dev, func, reg);
-   MV_WRITE(address_reg, address);
-   MV_READ(data_reg, val);
-   return;
+   u32 address = mt7621_pci_get_cfgaddr(bus, dev, func, reg);
+
+   pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR);
+   *val = pcie_read(pcie, RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
 }
 
 static void
-write_config(unsigned long bus, unsigned long dev, unsigned long func, 
unsigned long reg, unsigned long val)
+write_config(struct mt7621_pcie *pcie,
+unsigned long bus, unsigned long dev,
+unsigned long func, unsigned long reg, unsigned long val)
 {
-   u32 address_reg, data_reg, address;
-
-   address_reg = RALINK_PCI_CONFIG_ADDR;
-   data_reg = RALINK_PCI_CONFIG_DATA_VIRTUAL_REG;
-   address = mt7621_pci_get_cfgaddr(bus, dev, func, reg);
-   MV_WRITE(address_reg, address);
-   MV_WRITE(data_reg, val);
-   return;
+   u32 address = mt7621_pci_get_cfgaddr(bus, dev, func, reg);
+
+   pcie_write(pcie, address, RALINK_PCI_CONFIG_ADDR);
+   pcie_write(pcie, val, RALINK_PCI_CONFIG_DATA_VIRTUAL_REG);
 }
 
 int
 pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
 {
+   struct mt7621_pcie *pcie = dev->bus->sysdata;
u16 cmd;
u32 val;
int irq;
 
if (dev->bus->number == 0) {
-   write_config(0, slot, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE);
-   read_config(0, slot, 0, PCI_BASE_ADDRESS_0, (unsigned long 
*));
+   write_config(pcie, 0, slot, 0, PCI_BASE_ADDRESS_0, MEMORY_BASE);
+   read_config(pcie, 0, slot, 0, PCI_BASE_ADDRESS_0, (unsigned 
long *));
printk("BAR0 at slot %d = %x\n", slot, val);
}
 
@@ -549,13 +546,13 @@ static int mt7621_pci_probe(struct platform_device *pdev)
bypass_pipe_rst();
set_phy_for_ssc();
 
-   read_config(0, 0, 0, 0x70c, );
+   read_config(pcie, 0, 0, 0, 0x70c, );
printk("Port 0 N_FTS = %x\n", (unsigned int)val);
 
-   read_config(0, 1, 0, 0x70c, );
+   read_config(pcie, 0, 1, 0, 0x70c, );
printk("Port 1 N_FTS = %x\n", (unsigned int)val);
 
-   read_config(0, 2, 0, 0x70c, );
+   read_config(pcie, 0, 2, 0, 0x70c, );
printk("Port 2 N_FTS = %x\n", (unsigned int)val);
 
rt_sysc_m32(0, RALINK_PCIE_RST, RALINK_RSTCTRL);
@@ -676,28 +673,28 @@ pcie(2/1/0) link status   pcie2_num   pcie1_num   
pcie0_num
 
switch (pcie_link_status) {
case 7:
-   read_config(0, 2, 0, 0x4, );
-   write_config(0, 2, 0, 0x4, val|0x4);
-   read_config(0, 2, 0, 0x70c, );
+   read_config(pcie, 0, 2, 0, 0x4, );
+   write_config(pcie, 0, 2, 0, 0x4, val|0x4);
+   read_config(pcie, 0, 2, 0, 0x70c, );
val &= ~(0xff)<<8;
val |= 0x50<<8;
-   write_config(0, 2, 0, 0x70c, val);
+   write_config(pcie, 0, 2, 0, 0x70c, val);
case 3:
case 5:
case 6:
-   read_config(0, 1, 0, 0x4, );
-   write_config(0, 1, 0, 0x4, val|0x4);
-   read_config(0, 1, 0, 0x70c, );
+   read_config(pcie, 0, 1, 0, 0x4, );
+   write_config(pcie, 0, 1, 0, 0x4, val|0x4);
+   read_config(pcie, 0, 1, 0, 0x70c, );
val &= ~(0xff)<<8;
val |= 0x50<<8;
-   write_config(0, 1, 0, 0x70c, val);
+   write_config(pcie, 0, 1, 0, 0x70c, val);
default:
-   read_config(0, 0, 0, 0x4, );
-   write_config(0, 0, 0, 0x4, val|0x4); //bus master enable
-   read_config(0, 0, 0, 0x70c, );
+   read_config(pcie, 0, 0, 0, 0x4, );
+   write_config(pcie, 0, 0, 0, 0x4, val|0x4); //bus master enable
+   read_config(pcie, 0, 0, 0, 0x70c, );
val &= ~(0xff)<<8;
val |= 0x50<<8;
-   write_config(0, 0, 0, 0x70c, val);
+   

[PATCH v9 09/15] staging: mt7621-pci: review includes putting them in alphabethic order

2018-08-02 Thread Sergio Paracuellos
There are some includes that are being used that are not really
needed to correct driver compilation. Remove them and reorder the
rest alphabetically.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 22 --
 1 file changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 2533dfc..4dcb881 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -40,26 +40,20 @@
  **
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
 #include 
+#include 
 #include 
-#include 
-#include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
-
-#include 
+#include 
 #include 
+#include 
 
 #include "../../pci/pci.h"
 
-- 
2.7.4

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


[PATCH v9 01/15] staging: mt7621-pci: use generic kernel pci subsystem read and write

2018-08-02 Thread Sergio Paracuellos
map_bus callback is called before every .read/.write operation.
Implement it and change custom read write operations for the
pci subsystem generics. Make the probe function to don't use
legacy stuff and request bus resources directly. Get pci register
base and ranges from device tree.
The driver is not using PCI_LEGACY code anymore and shall use the
PCI_DRIVERS_GENERIC option to correct compile it. Add also new
Kconfig file for this controller setting there its correct dependencies.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/Kconfig |   2 +
 drivers/staging/mt7621-pci/Kconfig  |   7 ++
 drivers/staging/mt7621-pci/pci-mt7621.c | 195 +---
 3 files changed, 187 insertions(+), 17 deletions(-)
 create mode 100644 drivers/staging/mt7621-pci/Kconfig

diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
index 2bce647..732b631 100644
--- a/drivers/staging/Kconfig
+++ b/drivers/staging/Kconfig
@@ -110,6 +110,8 @@ source "drivers/staging/vboxvideo/Kconfig"
 
 source "drivers/staging/pi433/Kconfig"
 
+source "drivers/staging/mt7621-pci/Kconfig"
+
 source "drivers/staging/mt7621-pinctrl/Kconfig"
 
 source "drivers/staging/mt7621-spi/Kconfig"
diff --git a/drivers/staging/mt7621-pci/Kconfig 
b/drivers/staging/mt7621-pci/Kconfig
new file mode 100644
index 000..d335338
--- /dev/null
+++ b/drivers/staging/mt7621-pci/Kconfig
@@ -0,0 +1,7 @@
+config PCI_MT7621
+   tristate "MediaTek MT7621 PCI Controller"
+   depends on RALINK
+   select PCI_DRIVERS_GENERIC
+   help
+ This selects a driver for the MediaTek MT7621 PCI Controller.
+
diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index 650e49b..fb2618a 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -53,11 +53,16 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 #include 
 
 #include 
 #include 
 
+#include "../../pci/pci.h"
+
 /*
  * These functions and structures provide the BIOS scan and mapping of the PCI
  * devices.
@@ -178,6 +183,32 @@ static int pcie_link_status = 0;
 #define PCI_ACCESS_WRITE_2 4
 #define PCI_ACCESS_WRITE_4 5
 
+/**
+ * struct mt7621_pcie_port - PCIe port information
+ * @base: IO mapped register base
+ * @list: port list
+ * @pcie: pointer to PCIe host info
+ * @reset: pointer to port reset control
+ */
+struct mt7621_pcie_port {
+   void __iomem *base;
+   struct list_head list;
+   struct mt7621_pcie *pcie;
+   struct reset_control *reset;
+};
+
+/**
+ * struct mt7621_pcie - PCIe host information
+ * @base: IO Mapped Register Base
+ * @dev: Pointer to PCIe device
+ * @ports: pointer to PCIe port information
+ */
+struct mt7621_pcie {
+   void __iomem *base;
+   struct device *dev;
+   struct list_head ports;
+};
+
 static inline u32 mt7621_pci_get_cfgaddr(unsigned int bus, unsigned int slot,
 unsigned int func, unsigned int where)
 {
@@ -297,17 +328,22 @@ pci_config_write(struct pci_bus *bus, unsigned int devfn, 
int where, int size, u
}
 }
 
-struct pci_ops mt7621_pci_ops = {
-   .read   = pci_config_read,
-   .write  = pci_config_write,
-};
+static void __iomem *mt7621_pcie_map_bus(struct pci_bus *bus,
+unsigned int devfn, int where)
+{
+   struct mt7621_pcie *pcie = bus->sysdata;
+   u32 address = mt7621_pci_get_cfgaddr(bus->number, PCI_SLOT(devfn),
+PCI_FUNC(devfn), where);
+
+   writel(address, pcie->base + RALINK_PCI_CONFIG_ADDR);
+
+   return pcie->base + RALINK_PCI_CONFIG_DATA_VIRTUAL_REG + (where & 3);
+}
 
-static struct resource mt7621_res_pci_mem1;
-static struct resource mt7621_res_pci_io1;
-static struct pci_controller mt7621_controller = {
-   .pci_ops= _pci_ops,
-   .mem_resource   = _res_pci_mem1,
-   .io_resource= _res_pci_io1,
+struct pci_ops mt7621_pci_ops = {
+   .map_bus= mt7621_pcie_map_bus,
+   .read   = pci_generic_config_read,
+   .write  = pci_generic_config_write,
 };
 
 static void
@@ -463,9 +499,10 @@ set_phy_for_ssc(void)
set_pcie_phy((u32 *)(RALINK_PCIEPHY_P2_CTL_OFFSET + 0x000),  4, 1, 
0x00);   // rg_pe1_frc_phy_en//Force Port 0 disable control
 }
 
-void setup_cm_memory_region(struct resource *mem_resource)
+static void setup_cm_memory_region(struct resource *mem_resource)
 {
resource_size_t mask;
+
if (mips_cps_numiocu(0)) {
/* FIXME: hardware doesn't accept mask values with 1s after
 * 0s (e.g. 0xffef), so it would be great to warn if that's
@@ -480,14 +517,130 @@ void setup_cm_memory_region(struct resource 
*mem_resource)
}
 }
 
+static int mt7621_pci_parse_request_of_pci_ranges(struct mt7621_pcie *pcie,
+ struct 

[PATCH v9 00/15] staging: mt7621-pci: avoid custom pci config read and writes

2018-08-02 Thread Sergio Paracuellos
This patch series include an attempt to avoid the use of custom
read and writes in driver code and use PCI subsystem common ones.

In order to do this 'map_bus' callback is implemented and also
data structures for driver are included. The regs base address
ranges and data is being readed from device tree and the driver
gets clean a lot of code.

This patchet also removes all legacy PCI code using now PCI_DRIVERS_GENERIC
kernel api.

Changes in v9:
- PATCH 1: Use 'res' as resources list and void store resources in
  the pcie data struct.
- PATCH 1: Rewrite 'mt7621_pci_parse_request_of_pci_ranges' to use
  'devm_of_pci_get_host_bridge_resources' and use 'remap' directly
  with the returned 'iobase' address instead of 'devm_pci_remap_iospace' 
  which get into a WARN_ONCE statement because 'PCI_IOBASE' is not
  defined for mips.
- Other patches rebased and adapted to this changes.

Changes in v8:
- PATCH 1: don't check 'of_pci_range_to_resource' return value which is not
  being checked for the legacy code.
- PATCH 1: call 'mt7621_pci_parse_request_of_pci_ranges' 'and 
setup_cm_memory_region'
  after the port initialization code.
- PATCH 1: make use of 'pci_host_probe' to avoid code duplication in 
function
  'mt7621_pcie_register_host'.
- PATCH 1: set resource limits with no limit for the end in 
'ioport_resource' and
  'iomem_resource'. It seems mips needs this to work properly.
- Other patches rebased and adapted to this changes.

Changes in v7:
- PATCH 1: Store resources in mt7621_pci data structure.
- PATCH 1: Change completely function mt7621_pci_parse_request_of_pci_ranges
  to parse resources from ranges manually instead of use the function
  devm_of_pci_get_host_bridge_resources. This is closer to the mips pci 
legacy
  code.
- PATCH 1: Create 'mt7621_pcie_request_resources' function to request 
resources
  parsed from ranges property in the DT. Use pci_add_resource_offset and 
set them
  manually like the mips pci-legacy code do.
- PATCH 1: don't delete function setup_cm_memory_region and call it with 
memory
  resource.
- Other patches rebased and adapted to this changes.

Changes in v6:
- Reorder patches to be each patch correct in itself.
- PATCH 1 adds also Kconfig to do the step from legacy to generic code
- PATCH 1 remaps io space using devm_pci_remap_iospace for io resource in
  a new function called 'mt7621_pci_parse_request_of_pci_ranges'.
- Other patches rebased and adapted with this changes.

Changes in v5:
- Include driver Kconfig file to add compilation depends of 
PCI_DRIVERS_GENERIC.
  The new added configuration option is CONFIG_PCI_MT7621.
- Add list_splice_init(, >windows); in PATCH 1 to set windows
  from resources obtanined from devm_request_pci_bus_resources.
- Move devm_of_pci_get_host_bridge_resources and 
devm_request_pci_bus_resources
  after the ports initialization legacy code.
- Add pcie ports 1 and 2 RC registers to device tree. There was only being 
included
  port RC register for port 0.
- Review includes and order them alphabetically.

Changes in v4:
- Rebased onto staging-next.

Changes in v3:
- Include new patches to delete all RALINK_BASE definition
  dependant code and be able to avoid use of pci_legacy code.
- use devm_of_pci_get_host_bridge_resources,
  devm_request_pci_bus_resources and pci_scan_root_bus_bridge
  and pci_bus_add_devices

Changes in v2:
- squash PATCH 1 and PATCH 2 of previous series in only PATCH 1
- Change name for host structure.
- Create a new port structure (platform has 3 pcie controllers)
- Replace the use of pci_generic_config_[read|write]32 in favour
  of pci_generic_config_[read|write] and change map_bus implemen-
  tation for hopefully the right one.

Best regards,
Sergio Paracuellos

Sergio Paracuellos (15):
  staging: mt7621-pci: use generic kernel pci subsystem read and write
  staging: mt7621-pci: remove dead code derived to not use custom reads
and writes
  staging: mt7621-pci: add pcie_write and pcie_read helpers
  staging: mt7621-pci: use pcie_[read|write] in [write|read]_config
  staging: mt7621-pci: simplify read_config function
  staging: mt7621-pci: simplify write_config function
  staging: mt7621-pci: remove unused macros
  staging: mt7621-pci: avoid register duplication per controller using
pcie_[read|write]
  staging: mt7621-pci: review includes putting them in alphabethic order
  staging: mt7621-pci: use pcie_[read|write] in RALINK_PCI_PCICFG_ADDR
and RALINK_PCI_PCIMSK_ADDR
  staging: mt7621-pci: remove RALINK_PCI_BASE from remaining definitions
  staging: mt7621-pci: use BIT macro in preprocessor definitions
  staging: mt7621-pci: rename RALINK_PCI_CONFIG_DATA_VIRTUAL_REG
definition
  staging: mt7621-pci: remove remaining pci_legacy dependant code
  staging: mt7621-dts: add pcie 

[PATCH v9 07/15] staging: mt7621-pci: remove unused macros

2018-08-02 Thread Sergio Paracuellos
There some macros that are not being used. Remove them.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-pci/pci-mt7621.c | 24 +---
 1 file changed, 1 insertion(+), 23 deletions(-)

diff --git a/drivers/staging/mt7621-pci/pci-mt7621.c 
b/drivers/staging/mt7621-pci/pci-mt7621.c
index aa95457..65c573c 100644
--- a/drivers/staging/mt7621-pci/pci-mt7621.c
+++ b/drivers/staging/mt7621-pci/pci-mt7621.c
@@ -84,7 +84,6 @@
 #define RALINK_PCI_PCIMSK_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 
0x000C)
 #define RALINK_PCI_BASE0xBE14
 
-#define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000)
 #define RT6855_PCIE0_OFFSET0x2000
 #define RT6855_PCIE1_OFFSET0x3000
 #define RT6855_PCIE2_OFFSET0x4000
@@ -95,8 +94,6 @@
 #define RALINK_PCI0_CLASS  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0034)
 #define RALINK_PCI0_SUBID  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0038)
 #define RALINK_PCI0_STATUS *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0050)
-#define RALINK_PCI0_DERR   *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0060)
-#define RALINK_PCI0_ECRC   *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE0_OFFSET + 0x0064)
 
 #define RALINK_PCI1_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0010)
 #define RALINK_PCI1_IMBASEBAR0_ADDR*(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0018)
@@ -104,8 +101,6 @@
 #define RALINK_PCI1_CLASS  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0034)
 #define RALINK_PCI1_SUBID  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0038)
 #define RALINK_PCI1_STATUS *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0050)
-#define RALINK_PCI1_DERR   *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0060)
-#define RALINK_PCI1_ECRC   *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE1_OFFSET + 0x0064)
 
 #define RALINK_PCI2_BAR0SETUP_ADDR *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0010)
 #define RALINK_PCI2_IMBASEBAR0_ADDR*(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0018)
@@ -113,17 +108,10 @@
 #define RALINK_PCI2_CLASS  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0034)
 #define RALINK_PCI2_SUBID  *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0038)
 #define RALINK_PCI2_STATUS *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0050)
-#define RALINK_PCI2_DERR   *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0060)
-#define RALINK_PCI2_ECRC   *(volatile u32 *)(RALINK_PCI_BASE + 
RT6855_PCIE2_OFFSET + 0x0064)
 
 #define RALINK_PCIEPHY_P0P1_CTL_OFFSET (RALINK_PCI_BASE + 0x9000)
 #define RALINK_PCIEPHY_P2_CTL_OFFSET   (RALINK_PCI_BASE + 0xA000)
 
-#define MV_WRITE(ofs, data)\
-   *(volatile u32 *)(RALINK_PCI_BASE+(ofs)) = cpu_to_le32(data)
-#define MV_READ(ofs, data) \
-   *(data) = le32_to_cpu(*(volatile u32 *)(RALINK_PCI_BASE+(ofs)))
-
 #define RALINK_PCI_MM_MAP_BASE 0x6000
 #define RALINK_PCI_IO_MAP_BASE 0x1e16
 
@@ -141,28 +129,18 @@
else\
rt_sysc_m32(0, val, RALINK_RSTCTRL);\
} while (0)
+
 #define RALINK_CLKCFG1 0x30
 #define RALINK_RSTCTRL 0x34
 #define RALINK_GPIOMODE0x60
 #define RALINK_PCIE_CLK_GEN0x7c
 #define RALINK_PCIE_CLK_GEN1   0x80
-#define PPLL_CFG1  0x9c
-#define PPLL_DRV   0xa0
-/* SYSC_REG_SYSTEM_CONFIG1 bits */
-#define RALINK_PCI_HOST_MODE_EN(1<<7)
-#define RALINK_PCIE_RC_MODE_EN (1<<8)
 //RALINK_RSTCTRL bit
 #define RALINK_PCIE_RST(1<<23)
 #define RALINK_PCI_RST (1<<24)
 //RALINK_CLKCFG1 bit
 #define RALINK_PCI_CLK_EN  (1<<19)
 #define RALINK_PCIE_CLK_EN (1<<21)
-//RALINK_GPIOMODE bit
-#define PCI_SLOTx2 (1<<11)
-#define PCI_SLOTx1 (2<<11)
-//MTK PCIE PLL bit
-#define PDRV_SW_SET(1<<31)
-#define LC_CKDRVPD_(1<<19)
 
 #define MEMORY_BASE 0x0
 static int pcie_link_status = 0;
-- 
2.7.4

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


Re: [PATCH] staging: mt29f_spinand: fix memory leak while programming pages

2018-08-02 Thread Dan Carpenter
On Thu, Aug 02, 2018 at 11:42:30AM +0800, Jheng-Jhong Wu wrote:
> Dear Dan,
> 
> I know what you wrote, but before the spinand device is removed and
> freed memory automatically, programming pages may do many many times.
> Assume we erase and rewrite a large part of the flash, then
> spinand_program_page() might exhaust memory if memory is not large
> enough.
> In fact, OOM indeed occured when I tested programming multi-pages by
> mtd_debug tool.
> If OOM was not caused by devm_kzalloc() in spinand_program_page(),
> what may exhaust memory?
> 

Ok.  That makes sense.  I didn't look at it in context.  You should say
that sort of thing in your changelog.  Looking at it now, the devm_
model isn't right for this function so we should change it to use normal
kzalloc().

We should fix all the error paths as well.  It looks like if this
function starts returning errors, we are probably toasted, but it's
still good practice to avoid slow leaks.

regards,
dan carpenter


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