[PATCH] staging: rtl8188eu: Add 'rtl8188eufw.bin' to MODULE_FIRMWARE list

2019-06-30 Thread Alexander Dahl
This is the file loaded by the code anyway, but now you can use
'modinfo' to determine the needed firmware file for this module.

Spotted when packaging firmware files for the fli4l Linux router
distribution, where a script uses the information from 'modinfo' to
collect all needed firmware files to package.

Cc: Christoph Schulz 
Signed-off-by: Alexander Dahl 
---
 drivers/staging/rtl8188eu/os_dep/os_intfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/rtl8188eu/os_dep/os_intfs.c 
b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
index 2c088af44c8b..8907bf6bb7ff 100644
--- a/drivers/staging/rtl8188eu/os_dep/os_intfs.c
+++ b/drivers/staging/rtl8188eu/os_dep/os_intfs.c
@@ -19,6 +19,7 @@ MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("Realtek Wireless Lan Driver");
 MODULE_AUTHOR("Realtek Semiconductor Corp.");
 MODULE_VERSION(DRIVERVERSION);
+MODULE_FIRMWARE("rtlwifi/rtl8188eufw.bin");
 
 #define RTW_NOTCH_FILTER 0 /* 0:Disable, 1:Enable, */
 
-- 
2.20.1

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


Re: [PATCH 1/2] staging: rts5208: Rewrite redundant if statement to improve code style

2019-06-30 Thread Tobias Nießen
Am 26.06.2019 um 16:56 schrieb Dan Carpenter:
> Both these patches seem fine.
> 
> On Wed, Jun 26, 2019 at 04:28:56PM +0200, Tobias Nießen wrote:
>> This commit uses the fact that
>>
>> if (a) {
>> if (b) {
>> ...
>> }
>> }
>>
>> can instead be written as
>>
>> if (a && b) {
>> ...
>> }
>>
>> without any change in behavior, allowing to decrease the indentation
>> of the contained code block and thus reducing the average line length.
>>
>> Signed-off-by: Tobias Nießen 
>> Signed-off-by: Sabrina Gaube 
> 
> Signed-off-by is like signing a legal document that you didn't put any
> of SCO's secret UNIXWARE source code into your patch or do other illegal
> activities.  Everyone who handles a patch is supposed to Sign it.
> 
> It's weird to see Sabrina randomly signing your patches.  Probably there
> is a more appropriate kind of tag to use as well or instead such as
> Co-Developed-by, Reviewed-by or Suggested-by.
> 
> regards,
> dan carpenter
> 

Thank you, Dan. This patch series is a mandatory part of a course Sabrina and I 
are taking at university. We were told to add Signed-off-by for both of us. I 
can add Co-Developed-by if that helps? Or should she just verify via email that 
she did indeed sign off?

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


[PATCH v2] Staging: most: fix coding style issues

2019-06-30 Thread Gabriel Beauchamp
This is a patch for the core.[ch] files that fixes up warnings
found with the checkpatch.pl tool.

Signed-off-by: Gabriel Beauchamp 
---
Changes in v2:
- use a single snprintf
---
 drivers/staging/most/core.c | 7 +--
 drivers/staging/most/core.h | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 86a8545c8d97..852f8788ce2e 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -299,13 +299,15 @@ static ssize_t set_datatype_show(struct device *dev,
 char *buf)
 {
int i;
+   char *type = "unconfigured\n";
+
struct most_channel *c = to_channel(dev);
 
for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
-   return snprintf(buf, PAGE_SIZE, "%s", 
ch_data_type[i].name);
+   type = ch_data_type[i].name;
}
-   return snprintf(buf, PAGE_SIZE, "unconfigured\n");
+   return snprintf(buf, PAGE_SIZE, "%s", type);
 }
 
 static ssize_t set_subbuffer_size_show(struct device *dev,
@@ -728,6 +730,7 @@ int most_add_link(char *mdev, char *mdev_ch, char 
*comp_name, char *link_name,
 
return link_channel_to_component(c, comp, link_name, comp_param);
 }
+
 /**
  * remove_link_store - store function for remove_link attribute
  * @drv: device driver
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index 652aaa771029..6ba7c2b34c1c 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * most.h - API for component and adapter drivers
  *
-- 
2.21.0

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


[PATCH v3] Staging: most: fix coding style issues

2019-06-30 Thread Gabriel Beauchamp
This is a patch for the core.[ch] files that fixes up warnings
found with the checkpatch.pl tool.

Signed-off-by: Gabriel Beauchamp 
---
Changes in v3:
- add a break statement to preserve the control flow
Changes in v2:
- use a single snprintf
---
 drivers/staging/most/core.c | 11 ---
 drivers/staging/most/core.h |  2 +-
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/core.c b/drivers/staging/most/core.c
index 86a8545c8d97..eb18d4df8ad1 100644
--- a/drivers/staging/most/core.c
+++ b/drivers/staging/most/core.c
@@ -299,13 +299,17 @@ static ssize_t set_datatype_show(struct device *dev,
 char *buf)
 {
int i;
+   char *type = "unconfigured\n";
+
struct most_channel *c = to_channel(dev);
 
for (i = 0; i < ARRAY_SIZE(ch_data_type); i++) {
-   if (c->cfg.data_type & ch_data_type[i].most_ch_data_type)
-   return snprintf(buf, PAGE_SIZE, "%s", 
ch_data_type[i].name);
+   if (c->cfg.data_type & ch_data_type[i].most_ch_data_type) {
+   type = ch_data_type[i].name;
+   break;
+   }
}
-   return snprintf(buf, PAGE_SIZE, "unconfigured\n");
+   return snprintf(buf, PAGE_SIZE, "%s", type);
 }
 
 static ssize_t set_subbuffer_size_show(struct device *dev,
@@ -728,6 +732,7 @@ int most_add_link(char *mdev, char *mdev_ch, char 
*comp_name, char *link_name,
 
return link_channel_to_component(c, comp, link_name, comp_param);
 }
+
 /**
  * remove_link_store - store function for remove_link attribute
  * @drv: device driver
diff --git a/drivers/staging/most/core.h b/drivers/staging/most/core.h
index 652aaa771029..6ba7c2b34c1c 100644
--- a/drivers/staging/most/core.h
+++ b/drivers/staging/most/core.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * most.h - API for component and adapter drivers
  *
-- 
2.21.0

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


Investitionsmöglichkeit

2019-06-30 Thread Peter Wong
Schöne Grüße,

Bitte finden Sie den Inhalt dieser Mail sehr vertraulich und legal. Ich heiße 
Peter Wong und arbeite mit einer Bank hier in Hongkong zusammen. 
Ich habe mich entschlossen, mit Ihnen Kontakt aufzunehmen, um in jedes 
lukrative Geschäft in Ihrem Land investieren zu können. Ich bin bereit, 
Ihnen 40% des Anlageergebnisses als Geschäftspartner anzubieten.

Wir bieten auch ein schnelles Darlehen zu niedrigen Zinssätzen an, ohne dass 
Sicherheiten erforderlich sind. Bei Interesse antworten Sie bitte auf 
meine private E-Mail: pw178...@gmail.com

Mit freundlichen Grüßen: Peter Wong





This email was sent by the shareware version of Postman Professional.

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


Investitionsmöglichkeit

2019-06-30 Thread Peter Wong
Schöne Grüße,

Bitte finden Sie den Inhalt dieser Mail sehr vertraulich und legal. Ich heiße 
Peter Wong und arbeite mit einer Bank hier in Hongkong zusammen. 
Ich habe mich entschlossen, mit Ihnen Kontakt aufzunehmen, um in jedes 
lukrative Geschäft in Ihrem Land investieren zu können. Ich bin bereit, 
Ihnen 40% des Anlageergebnisses als Geschäftspartner anzubieten.

Wir bieten auch ein schnelles Darlehen zu niedrigen Zinssätzen an, ohne dass 
Sicherheiten erforderlich sind. Bei Interesse antworten Sie bitte auf 
meine private E-Mail: pw178...@gmail.com

Mit freundlichen Grüßen: Peter Wong





This email was sent by the shareware version of Postman Professional.

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


[PATCH] staging: erofs: fix LZ4 limited bounced page mis-reuse

2019-06-30 Thread Gao Xiang
From: Gao Xiang 

Like all lz77-based algrithms, lz4 has a dynamically populated
("sliding window") dictionary and the maximum lookback distance
is 65535. Therefore the number of bounced pages could be limited
by erofs based on this property.

However, just now we observed some lz4 sequences in the extreme
case cannot be decompressed correctly after this feature is enabled,
the root causes after analysis are clear as follows:
1) max bounced pages should be 17 rather than 16 pages;
2) considering the following case, the broken implementation
   could reuse unsafely in advance (in other words, reuse it
   less than a safe distance),
   0 1 2 ... 16 17 18 ... 33 34
   b p  b b
   note that the bounce page that we are concerned was allocated
   at 0, and it reused at 18 since page 17 exists, but it mis-reused
   at 34 in advance again, which causes decompress failure.

This patch resolves the issue by introducing a bitmap to mark
whether the page in the same position of last round is a bounced
page or not, and a micro stack data structure to store all
available bounced pages.

Fixes: 7fc45dbc938a ("staging: erofs: introduce generic decompression backend")
Signed-off-by: Gao Xiang 
---
 drivers/staging/erofs/decompressor.c | 50 
 1 file changed, 28 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/erofs/decompressor.c 
b/drivers/staging/erofs/decompressor.c
index 80f1f39719ba..1fb0abb98dff 100644
--- a/drivers/staging/erofs/decompressor.c
+++ b/drivers/staging/erofs/decompressor.c
@@ -13,7 +13,7 @@
 #define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */
 #endif
 
-#define LZ4_MAX_DISTANCE_PAGES DIV_ROUND_UP(LZ4_DISTANCE_MAX, PAGE_SIZE)
+#define LZ4_MAX_DISTANCE_PAGES (DIV_ROUND_UP(LZ4_DISTANCE_MAX, PAGE_SIZE) + 1)
 #ifndef LZ4_DECOMPRESS_INPLACE_MARGIN
 #define LZ4_DECOMPRESS_INPLACE_MARGIN(srcsize)  (((srcsize) >> 8) + 32)
 #endif
@@ -35,19 +35,28 @@ static int lz4_prepare_destpages(struct 
z_erofs_decompress_req *rq,
const unsigned int nr =
PAGE_ALIGN(rq->pageofs_out + rq->outputsize) >> PAGE_SHIFT;
struct page *availables[LZ4_MAX_DISTANCE_PAGES] = { NULL };
-   unsigned long unused[DIV_ROUND_UP(LZ4_MAX_DISTANCE_PAGES,
- BITS_PER_LONG)] = { 0 };
+   unsigned long bounced[DIV_ROUND_UP(LZ4_MAX_DISTANCE_PAGES,
+  BITS_PER_LONG)] = { 0 };
void *kaddr = NULL;
-   unsigned int i, j, k;
+   unsigned int i, j, top;
 
-   for (i = 0; i < nr; ++i) {
+   top = 0;
+   for (i = j = 0; i < nr; ++i, ++j) {
struct page *const page = rq->out[i];
+   struct page *victim;
 
-   j = i & (LZ4_MAX_DISTANCE_PAGES - 1);
-   if (availables[j])
-   __set_bit(j, unused);
+   if (j >= LZ4_MAX_DISTANCE_PAGES)
+   j = 0;
+
+   /* 'valid' bounced can only be tested after a complete round */
+   if (test_bit(j, bounced)) {
+   DBG_BUGON(i < LZ4_MAX_DISTANCE_PAGES);
+   DBG_BUGON(top >= LZ4_MAX_DISTANCE_PAGES);
+   availables[top++] = rq->out[i - LZ4_MAX_DISTANCE_PAGES];
+   }
 
if (page) {
+   __clear_bit(j, bounced);
if (kaddr) {
if (kaddr + PAGE_SIZE == page_address(page))
kaddr += PAGE_SIZE;
@@ -59,27 +68,24 @@ static int lz4_prepare_destpages(struct 
z_erofs_decompress_req *rq,
continue;
}
kaddr = NULL;
+   __set_bit(j, bounced);
 
-   k = find_first_bit(unused, LZ4_MAX_DISTANCE_PAGES);
-   if (k < LZ4_MAX_DISTANCE_PAGES) {
-   j = k;
-   get_page(availables[j]);
+   if (top) {
+   victim = availables[--top];
+   get_page(victim);
} else {
-   DBG_BUGON(availables[j]);
-
if (!list_empty(pagepool)) {
-   availables[j] = lru_to_page(pagepool);
-   list_del(&availables[j]->lru);
-   DBG_BUGON(page_ref_count(availables[j]) != 1);
+   victim = lru_to_page(pagepool);
+   list_del(&victim->lru);
+   DBG_BUGON(page_ref_count(victim) != 1);
} else {
-   availables[j] = alloc_pages(GFP_KERNEL, 0);
-   if (!availables[j])
+   victim = alloc_pages(GFP_KERNEL, 0);
+   if (!victim)
return -ENOMEM;
}
-   

Re: [PATCH 4/4] ipvs: reduce kernel stack usage

2019-06-30 Thread Julian Anastasov


Hello,

On Fri, 28 Jun 2019, Arnd Bergmann wrote:

> With the new CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL option, the stack
> usage in the ipvs debug output grows because each instance of
> IP_VS_DBG_BUF() now has its own buffer of 160 bytes that add up
> rather than reusing the stack slots:
> 
> net/netfilter/ipvs/ip_vs_core.c: In function 'ip_vs_sched_persist':
> net/netfilter/ipvs/ip_vs_core.c:427:1: error: the frame size of 1052 bytes is 
> larger than 1024 bytes [-Werror=frame-larger-than=]
> net/netfilter/ipvs/ip_vs_core.c: In function 'ip_vs_new_conn_out':
> net/netfilter/ipvs/ip_vs_core.c:1231:1: error: the frame size of 1048 bytes 
> is larger than 1024 bytes [-Werror=frame-larger-than=]
> net/netfilter/ipvs/ip_vs_ftp.c: In function 'ip_vs_ftp_out':
> net/netfilter/ipvs/ip_vs_ftp.c:397:1: error: the frame size of 1104 bytes is 
> larger than 1024 bytes [-Werror=frame-larger-than=]
> net/netfilter/ipvs/ip_vs_ftp.c: In function 'ip_vs_ftp_in':
> net/netfilter/ipvs/ip_vs_ftp.c:555:1: error: the frame size of 1200 bytes is 
> larger than 1024 bytes [-Werror=frame-larger-than=]
> 
> Since printk() already has a way to print IPv4/IPv6 addresses using
> the %pIS format string, use that instead, combined with a macro that
> creates a local sockaddr structure on the stack. These will still
> add up, but the stack frames are now under 200 bytes.
> 
> Signed-off-by: Arnd Bergmann 
> ---
> I'm not sure this actually does what I think it does. Someone
> needs to verify that we correctly print the addresses here.
> I've also only added three files that caused the warning messages
> to be reported. There are still a lot of other instances of
> IP_VS_DBG_BUF() that could be converted the same way after the
> basic idea is confirmed.
> ---
>  include/net/ip_vs.h | 71 +++--
>  net/netfilter/ipvs/ip_vs_core.c | 44 ++--
>  net/netfilter/ipvs/ip_vs_ftp.c  | 20 +-
>  3 files changed, 72 insertions(+), 63 deletions(-)
> 
> diff --git a/include/net/ip_vs.h b/include/net/ip_vs.h
> index 3759167f91f5..3dfbeef67be6 100644
> --- a/include/net/ip_vs.h
> +++ b/include/net/ip_vs.h
> @@ -227,6 +227,16 @@ static inline const char *ip_vs_dbg_addr(int af, char 
> *buf, size_t buf_len,
>  sizeof(ip_vs_dbg_buf), addr, \
>  &ip_vs_dbg_idx)
>  
> +#define IP_VS_DBG_SOCKADDR4(fam, addr, port) \
> + (struct sockaddr*)&(struct sockaddr_in) \
> + { .sin_family = (fam), .sin_addr = (addr)->in, .sin_port = (port) }
> +#define IP_VS_DBG_SOCKADDR6(fam, addr, port) \
> + (struct sockaddr*)&(struct sockaddr_in6) \
> + { .sin6_family = (fam), .sin6_addr = (addr)->in6, .sin6_port = (port) }
> +#define IP_VS_DBG_SOCKADDR(fam, addr, port) (fam == AF_INET ?
> \
> + IP_VS_DBG_SOCKADDR4(fam, addr, port) :  \
> + IP_VS_DBG_SOCKADDR6(fam, addr, port))
> +
>  #define IP_VS_DBG(level, msg, ...)   \
>   do {\
>   if (level <= ip_vs_get_debug_level())   \
> @@ -251,6 +261,7 @@ static inline const char *ip_vs_dbg_addr(int af, char 
> *buf, size_t buf_len,
>  #else/* NO DEBUGGING at ALL */
>  #define IP_VS_DBG_BUF(level, msg...)  do {} while (0)
>  #define IP_VS_ERR_BUF(msg...)  do {} while (0)
> +#define IP_VS_DBG_SOCKADDR(fam, addr, port) NULL
>  #define IP_VS_DBG(level, msg...)  do {} while (0)
>  #define IP_VS_DBG_RL(msg...)  do {} while (0)
>  #define IP_VS_DBG_PKT(level, af, pp, skb, ofs, msg)  do {} while (0)
> @@ -1244,31 +1255,31 @@ static inline void ip_vs_control_del(struct 
> ip_vs_conn *cp)
>  {
>   struct ip_vs_conn *ctl_cp = cp->control;
>   if (!ctl_cp) {
> - IP_VS_ERR_BUF("request control DEL for uncontrolled: "
> -   "%s:%d to %s:%d\n",
> -   IP_VS_DBG_ADDR(cp->af, &cp->caddr),
> -   ntohs(cp->cport),
> -   IP_VS_DBG_ADDR(cp->af, &cp->vaddr),
> -   ntohs(cp->vport));
> + pr_err("request control DEL for uncontrolled: "
> +"%pISp to %pISp\n",

ip_vs_dbg_addr() used compact form (%pI6c), so it would be
better to use %pISc and %pISpc everywhere in IPVS...

Also, note that before now port was printed with %d and
ntohs() was used, now port should be in network order, so:

- ntohs() should be removed
- htons() should be added, if missing. At first look, this case
is not present in IPVS, we have only ntohs() usage

Regards

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


[PATCH 0/2] staging: update mt7621 dts for some recent driver changes

2019-06-30 Thread NeilBrown
The mt7621 MMC driver was recently removed from staging due to
copyright concerns.  Since then drivers/mmc/host/mtk-sd.c has been
enhanced to work with the mt7621 IP.  The first patch updates
the dts file to match this driver.

Earlier, the drivers/net/ethernet/mediatek/ driver was enhanced
to work with mt7621 hardware and the mt7621-eth driver was removed
from staging.  The second patch enhances the mt7621.dtsi to better
support this driver and particularly to allow the second network port
to be used in at least one of its possible configurations.

Thanks,
NeilBrown

---

NeilBrown (2):
  staging: mt7621-dts: update sdhci config.
  staging: mt7621-dts: add support for second network interface


 drivers/staging/mt7621-dts/Kconfig |7 
 drivers/staging/mt7621-dts/Makefile|1 +
 drivers/staging/mt7621-dts/gbpc1.dts   |2 +
 drivers/staging/mt7621-dts/gbpc2.dts   |   21 +
 drivers/staging/mt7621-dts/mt7621.dtsi |   53 +---
 5 files changed, 77 insertions(+), 7 deletions(-)
 create mode 100644 drivers/staging/mt7621-dts/gbpc2.dts

--
Signature

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


[PATCH 1/2] staging: mt7621-dts: update sdhci config.

2019-06-30 Thread NeilBrown
The mtk-sd driver has been updated to support
the IP in the mt7621, so update our configuration
to work with it.

Signed-off-by: NeilBrown 
---
 drivers/staging/mt7621-dts/mt7621.dtsi |   41 +++-
 1 file changed, 40 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi 
b/drivers/staging/mt7621-dts/mt7621.dtsi
index 9c90cac82efc..549ff5a0699e 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/drivers/staging/mt7621-dts/mt7621.dtsi
@@ -43,6 +43,30 @@
clock-frequency = <22000>;
};
 
+   mmc_clock: mmc_clock@0 {
+   #clock-cells = <0>;
+   compatible = "fixed-clock";
+   clock-frequency = <4800>;
+   };
+
+   mmc_fixed_3v3: fixedregulator@0 {
+   compatible = "regulator-fixed";
+   regulator-name = "mmc_power";
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   enable-active-high;
+   regulator-always-on;
+ };
+
+ mmc_fixed_1v8_io: fixedregulator@1 {
+   compatible = "regulator-fixed";
+   regulator-name = "mmc_io";
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   enable-active-high;
+   regulator-always-on;
+   };
+
palmbus: palmbus@1E00 {
compatible = "palmbus";
reg = <0x1E00 0x10>;
@@ -299,9 +323,24 @@
sdhci: sdhci@1E13 {
status = "disabled";
 
-   compatible = "ralink,mt7620-sdhci";
+   compatible = "mediatek,mt7620-mmc";
reg = <0x1E13 0x4000>;
 
+   bus-width = <4>;
+   max-frequency = <4800>;
+   cap-sd-highspeed;
+   cap-mmc-highspeed;
+   vmmc-supply = <&mmc_fixed_3v3>;
+   vqmmc-supply = <&mmc_fixed_1v8_io>;
+   disable-wp;
+
+   pinctrl-names = "default", "state_uhs";
+   pinctrl-0 = <&sdhci_pins>;
+   pinctrl-1 = <&sdhci_pins>;
+
+   clocks = <&mmc_clock &mmc_clock>;
+   clock-names = "source", "hclk";
+
interrupt-parent = <&gic>;
interrupts = ;
};


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


[PATCH 2/2] staging: mt7621-dts: add support for second network interface

2019-06-30 Thread NeilBrown
The mt7621 has two network interfaces, one that connects to an
internal switch, and one that can connect to either that switch
or an external phy, or possibly an internal phy.

The Gnubee-PC2 has an external phy for use with the second interface.

This patch add some support for the second interface to mt7621.dtsi
and add a gbpc2.dts which makes use of this.  This allows the second
interface to be used.

I don't fully understand how to configure this interface - the
documentation is thin - so there could well be room for improvement
here.

Signed-off-by: NeilBrown 
---
 drivers/staging/mt7621-dts/Kconfig |7 ++-
 drivers/staging/mt7621-dts/Makefile|1 +
 drivers/staging/mt7621-dts/gbpc1.dts   |2 +-
 drivers/staging/mt7621-dts/gbpc2.dts   |   21 +
 drivers/staging/mt7621-dts/mt7621.dtsi |   12 
 5 files changed, 37 insertions(+), 6 deletions(-)
 create mode 100644 drivers/staging/mt7621-dts/gbpc2.dts

diff --git a/drivers/staging/mt7621-dts/Kconfig 
b/drivers/staging/mt7621-dts/Kconfig
index 3ea08ab9d0d3..6932ab7acadf 100644
--- a/drivers/staging/mt7621-dts/Kconfig
+++ b/drivers/staging/mt7621-dts/Kconfig
@@ -1,6 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0
 config DTB_GNUBEE1
-   bool "GnuBee1 NAS"
+   bool "GnuBee1 2.5inch NAS"
+   depends on SOC_MT7621 && DTB_RT_NONE
+   select BUILTIN_DTB
+
+config DTB_GNUBEE2
+   bool "GnuBee2 3.5inch NAS"
depends on SOC_MT7621 && DTB_RT_NONE
select BUILTIN_DTB
 
diff --git a/drivers/staging/mt7621-dts/Makefile 
b/drivers/staging/mt7621-dts/Makefile
index aeec48a4edc7..b4ab99fed932 100644
--- a/drivers/staging/mt7621-dts/Makefile
+++ b/drivers/staging/mt7621-dts/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 dtb-$(CONFIG_DTB_GNUBEE1)  += gbpc1.dtb
+dtb-$(CONFIG_DTB_GNUBEE2)  += gbpc2.dtb
 
 obj-y  += $(patsubst %.dtb, %.dtb.o, $(dtb-y))
diff --git a/drivers/staging/mt7621-dts/gbpc1.dts 
b/drivers/staging/mt7621-dts/gbpc1.dts
index 250c15ace2a7..1fb560ff059c 100644
--- a/drivers/staging/mt7621-dts/gbpc1.dts
+++ b/drivers/staging/mt7621-dts/gbpc1.dts
@@ -119,7 +119,7 @@
 
 &pinctrl {
state_default: pinctrl0 {
-   gpio {
+   default_gpio: gpio {
groups = "wdt", "rgmii2", "uart3";
function = "gpio";
};
diff --git a/drivers/staging/mt7621-dts/gbpc2.dts 
b/drivers/staging/mt7621-dts/gbpc2.dts
new file mode 100644
index ..52760e7351f6
--- /dev/null
+++ b/drivers/staging/mt7621-dts/gbpc2.dts
@@ -0,0 +1,21 @@
+/dts-v1/;
+
+#include "gbpc1.dts"
+
+/ {
+   compatible = "gnubee,gb-pc2", "mediatek,mt7621-soc";
+   model = "GB-PC2";
+};
+
+&default_gpio {
+   groups = "wdt", "uart3";
+   function = "gpio";
+};
+
+&gmac1 {
+   status = "ok";
+};
+
+&phy_external {
+   status = "ok";
+};
diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi 
b/drivers/staging/mt7621-dts/mt7621.dtsi
index 549ff5a0699e..a4c08110094b 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/drivers/staging/mt7621-dts/mt7621.dtsi
@@ -427,16 +427,20 @@
compatible = "mediatek,eth-mac";
reg = <1>;
status = "off";
-   phy-mode = "rgmii";
-   phy-handle = <&phy5>;
+   phy-mode = "rgmii-rxid";
+   phy-handle = <&phy_external>;
};
mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
 
-   phy5: ethernet-phy@5 {
+   phy_external: ethernet-phy@5 {
+   status = "off";
reg = <5>;
-   phy-mode = "rgmii";
+   phy-mode = "rgmii-rxid";
+
+   pinctrl-names = "default";
+   pinctrl-0 = <&rgmii2_pins>;
};
 
switch0: switch0@0 {


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


[PATCH] staging: rtl8192u: Replace function rtl8192_rx_enable()

2019-06-30 Thread Nishka Dasgupta
Remove function rtl8192_rx_enable as all it does is call
rtl8192_rx_initiate.
Rename rtl8192_rx_initiate to rtl8192_rx_enable and change its type from
static to non-static to maintain compatibility with call sites of
rtl8192_rx_enable.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8192u/r8192U_core.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index e78806fef79f..9125c490bb37 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -713,7 +713,8 @@ static u32 get_rxpacket_shiftbytes_819xusb(struct 
ieee80211_rx_stats *pstats)
+ pstats->RxBufShift);
 }
 
-static void rtl8192_rx_initiate(struct net_device *dev)
+/* wait to be removed */
+void rtl8192_rx_enable(struct net_device *dev)
 {
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
struct urb *entry;
@@ -808,12 +809,6 @@ void rtl8192_set_rxconf(struct net_device *dev)
write_nic_dword(dev, RCR, rxconf);
 }
 
-/* wait to be removed */
-void rtl8192_rx_enable(struct net_device *dev)
-{
-   rtl8192_rx_initiate(dev);
-}
-
 void rtl8192_rtx_disable(struct net_device *dev)
 {
u8 cmd;
-- 
2.19.1

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


[PATCH 01/10] staging: rtl8723bs: Remove function rtw_modular64()

2019-06-30 Thread Nishka Dasgupta
Remove function rtw_modular64 as all it does is call do_div.
Modify call sites accordingly.
Issue found with Coccinelle.

Signed-off-by: Nishka Dasgupta 
---
 drivers/staging/rtl8723bs/core/rtw_wlan_util.c| 2 +-
 drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c | 2 +-
 drivers/staging/rtl8723bs/include/osdep_service.h | 2 --
 drivers/staging/rtl8723bs/os_dep/osdep_service.c  | 5 -
 4 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
index 93f4ea0ac433..76c50377f0fe 100644
--- a/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723bs/core/rtw_wlan_util.c
@@ -1932,7 +1932,7 @@ void adaptive_early_32k(struct mlme_ext_priv *pmlmeext, 
u8 *pframe, uint len)
 
/* delay = (timestamp mod 1024*100)/1000 (unit: ms) */
/* delay_ms = do_div(tsf, (pmlmeinfo->bcn_interval*1024))/1000; */
-   delay_ms = rtw_modular64(tsf, (pmlmeinfo->bcn_interval*1024));
+   delay_ms = do_div(tsf, (pmlmeinfo->bcn_interval*1024));
delay_ms = delay_ms/1000;
 
if (delay_ms >= 8)
diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c 
b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
index 6cfd240318f3..a1fc3bdd3d4f 100644
--- a/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
+++ b/drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
@@ -3463,7 +3463,7 @@ static void hw_var_set_correct_tsf(struct adapter 
*padapter, u8 variable, u8 *va
pmlmeext = &padapter->mlmeextpriv;
pmlmeinfo = &pmlmeext->mlmext_info;
 
-   tsf = pmlmeext->TSFValue-rtw_modular64(pmlmeext->TSFValue, 
(pmlmeinfo->bcn_interval*1024))-1024; /* us */
+   tsf = pmlmeext->TSFValue-do_div(pmlmeext->TSFValue, 
(pmlmeinfo->bcn_interval*1024))-1024; /* us */
 
if (
((pmlmeinfo->state&0x03) == WIFI_FW_ADHOC_STATE) ||
diff --git a/drivers/staging/rtl8723bs/include/osdep_service.h 
b/drivers/staging/rtl8723bs/include/osdep_service.h
index 76d619585046..d2616af95ffa 100644
--- a/drivers/staging/rtl8723bs/include/osdep_service.h
+++ b/drivers/staging/rtl8723bs/include/osdep_service.h
@@ -178,8 +178,6 @@ extern int rtw_retrive_from_file(char *path, u8 *buf, u32 
sz);
 extern void rtw_free_netdev(struct net_device * netdev);
 
 
-extern u64 rtw_modular64(u64 x, u64 y);
-
 /* Macros for handling unaligned memory accesses */
 
 #define RTW_GET_BE16(a) ((u16) (((a)[0] << 8) | (a)[1]))
diff --git a/drivers/staging/rtl8723bs/os_dep/osdep_service.c 
b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
index 1d2c581327b2..62fdd24ba427 100644
--- a/drivers/staging/rtl8723bs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723bs/os_dep/osdep_service.c
@@ -316,11 +316,6 @@ int rtw_change_ifname(struct adapter *padapter, const char 
*ifname)
 
 }
 
-u64 rtw_modular64(u64 x, u64 y)
-{
-   return do_div(x, y);
-}
-
 void rtw_buf_free(u8 **buf, u32 *buf_len)
 {
u32 ori_len;
-- 
2.19.1

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