Re: [PATCH net] hv_netvsc: Fix the variable sizes in ipsecv2 and rsc offload

2018-06-14 Thread David Miller
From: Haiyang Zhang 
Date: Thu, 14 Jun 2018 18:29:09 -0700

> From: Haiyang Zhang 
> 
> These fields in struct ndis_ipsecv2_offload and struct ndis_rsc_offload
> are one byte according to the specs. This patch defines them with the
> right size. These structs are not in use right now, but will be used soon.
> 
> Signed-off-by: Haiyang Zhang 

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


RE: [PATCH net-next] hv_netvsc: Fix the variable sizes in ipsecv2 and rsc offload

2018-06-14 Thread Haiyang Zhang



> -Original Message-
> From: David Miller 
> Sent: Thursday, June 14, 2018 8:00 PM
> To: Haiyang Zhang ; haiya...@linuxonhyperv.com
> Cc: net...@vger.kernel.org; KY Srinivasan ; Stephen
> Hemminger ; o...@aepfle.de;
> vkuzn...@redhat.com; de...@linuxdriverproject.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH net-next] hv_netvsc: Fix the variable sizes in ipsecv2 and
> rsc offload
> 
> 
> Bug fixes should be targetted at net, not net-next.  Furthermore, net-next is
> closed.

Thanks for the reminder. I just sent out the patch to "net" tree.

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


[PATCH net] hv_netvsc: Fix the variable sizes in ipsecv2 and rsc offload

2018-06-14 Thread Haiyang Zhang
From: Haiyang Zhang 

These fields in struct ndis_ipsecv2_offload and struct ndis_rsc_offload
are one byte according to the specs. This patch defines them with the
right size. These structs are not in use right now, but will be used soon.

Signed-off-by: Haiyang Zhang 
---
 drivers/net/hyperv/hyperv_net.h | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index d31c0cd329a1..1a924b867b07 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -1277,17 +1277,17 @@ struct ndis_lsov2_offload {
 
 struct ndis_ipsecv2_offload {
u32 encap;
-   u16 ip6;
-   u16 ip4opt;
-   u16 ip6ext;
-   u16 ah;
-   u16 esp;
-   u16 ah_esp;
-   u16 xport;
-   u16 tun;
-   u16 xport_tun;
-   u16 lso;
-   u16 extseq;
+   u8  ip6;
+   u8  ip4opt;
+   u8  ip6ext;
+   u8  ah;
+   u8  esp;
+   u8  ah_esp;
+   u8  xport;
+   u8  tun;
+   u8  xport_tun;
+   u8  lso;
+   u8  extseq;
u32 udp_esp;
u32 auth;
u32 crypto;
@@ -1295,8 +1295,8 @@ struct ndis_ipsecv2_offload {
 };
 
 struct ndis_rsc_offload {
-   u16 ip4;
-   u16 ip6;
+   u8  ip4;
+   u8  ip6;
 };
 
 struct ndis_encap_offload {
-- 
2.17.1

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


Re: [PATCH net-next] hv_netvsc: Fix the variable sizes in ipsecv2 and rsc offload

2018-06-14 Thread David Miller


Bug fixes should be targetted at net, not net-next.  Furthermore,
net-next is closed.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [lustre-devel] [PATCH v3] staging: lustre: Change return type to vm_fault_t

2018-06-14 Thread NeilBrown
On Thu, Jun 14 2018, Souptick Joarder wrote:

> On Thu, Jun 14, 2018 at 12:59 PM, NeilBrown  wrote:
>> On Tue, Jun 12 2018, Souptick Joarder wrote:
>>
>>> On 12-Jun-2018 2:21 AM, "Greg KH"  wrote:
>>>>
>>>> On Tue, Jun 12, 2018 at 02:00:47AM +0530, Souptick Joarder wrote:
>>>> > On Mon, May 21, 2018 at 11:39 PM, Souptick Joarder 
>>>> >
>>>> > If no further comment, we would like to get this patch in 4.18-rc-X.
>>>>
>>>> Why?  Is it a regression fix?  That's all that is allowed after -rc1.
>>>
>>> No, this is not regression fix. We need to get this into 4.18-rc-1.  But
>>> mostly it can't make into linus tree in rc-1 :)
>>>>
>>>> And have you tried applying it to Linus's current tree?  :)
>>>
>>> Last tested on 4.17-rc-6 and it worked fine. Let me verify in current tree.
>>>
>>
>> As you have undoubtedly noticed, lustre is no longer in Linus' tree.
>> I'm experimenting with maintaining a branch which retains the code
>> (lustre/* in github.com/neilbrown/linux) so we can get it ready for
>> merging properly.
>> I've added you patch to my tree.
>
> You need to add this patch in your tree as well.
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20180614=1c8f422059ae5da07db7406ab916203f9417e396
>
> This patch appears to be missing in your github branch.
??
That patch is in 4.17-rc1 (v4.17-rc1~99^2~6) and my lustre trees are
based on 4.17 (at least).  My 'master' might be a bit behind - maybe
that confused you.

Thanks,
NeilBrown


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


[PATCH] staging: mt7621-eth: Fix memory leaks in mtk_add_mac() error path

2018-06-14 Thread Kamal Heib
Fix memory leaks in error path of mtk_add_mac() by make sure to free
the allocated resources.

Fixes: e3cbf478f846 ('staging: mt7621-eth: add the drivers core files')
Signed-off-by: Kamal Heib 
---
 drivers/staging/mt7621-eth/mtk_eth_soc.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/mt7621-eth/mtk_eth_soc.c 
b/drivers/staging/mt7621-eth/mtk_eth_soc.c
index 2c7a2e666bfb..e2818844dfec 100644
--- a/drivers/staging/mt7621-eth/mtk_eth_soc.c
+++ b/drivers/staging/mt7621-eth/mtk_eth_soc.c
@@ -2012,8 +2012,11 @@ static int mtk_add_mac(struct mtk_eth *eth, struct 
device_node *np)
mac->hw_stats = devm_kzalloc(eth->dev,
 sizeof(*mac->hw_stats),
 GFP_KERNEL);
-   if (!mac->hw_stats)
-   return -ENOMEM;
+   if (!mac->hw_stats) {
+   dev_err(eth->dev, "failed to allocate hw_stats\n");
+   err = -ENOMEM;
+   goto free_netdev;
+   }
spin_lock_init(>hw_stats->stats_lock);
mac->hw_stats->reg_offset = id * MTK_STAT_OFFSET;
}
@@ -2037,7 +2040,8 @@ static int mtk_add_mac(struct mtk_eth *eth, struct 
device_node *np)
err = register_netdev(eth->netdev[id]);
if (err) {
dev_err(eth->dev, "error bringing up device\n");
-   return err;
+   err = -ENOMEM;
+   goto free_hw_stats;
}
eth->netdev[id]->irq = eth->irq;
netif_info(eth, probe, eth->netdev[id],
@@ -2045,6 +2049,12 @@ static int mtk_add_mac(struct mtk_eth *eth, struct 
device_node *np)
   eth->netdev[id]->base_addr, eth->netdev[id]->irq);
 
return 0;
+
+free_hw_stats:
+   devm_kfree(eth->dev, mac->hw_stats);
+free_netdev:
+   free_netdev(eth->netdev[id]);
+   return err;
 }
 
 static int mtk_probe(struct platform_device *pdev)
-- 
2.14.4

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


[PATCH net-next] hv_netvsc: Fix the variable sizes in ipsecv2 and rsc offload

2018-06-14 Thread Haiyang Zhang
From: Haiyang Zhang 

These fields in struct ndis_ipsecv2_offload and struct ndis_rsc_offload
are one byte according to the specs. This patch defines them with the
right size.

Signed-off-by: Haiyang Zhang 
---
 drivers/net/hyperv/hyperv_net.h | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
index 23304aca25f9..84eaaa6368a2 100644
--- a/drivers/net/hyperv/hyperv_net.h
+++ b/drivers/net/hyperv/hyperv_net.h
@@ -1277,17 +1277,17 @@ struct ndis_lsov2_offload {
 
 struct ndis_ipsecv2_offload {
u32 encap;
-   u16 ip6;
-   u16 ip4opt;
-   u16 ip6ext;
-   u16 ah;
-   u16 esp;
-   u16 ah_esp;
-   u16 xport;
-   u16 tun;
-   u16 xport_tun;
-   u16 lso;
-   u16 extseq;
+   u8  ip6;
+   u8  ip4opt;
+   u8  ip6ext;
+   u8  ah;
+   u8  esp;
+   u8  ah_esp;
+   u8  xport;
+   u8  tun;
+   u8  xport_tun;
+   u8  lso;
+   u8  extseq;
u32 udp_esp;
u32 auth;
u32 crypto;
@@ -1295,8 +1295,8 @@ struct ndis_ipsecv2_offload {
 };
 
 struct ndis_rsc_offload {
-   u16 ip4;
-   u16 ip6;
+   u8  ip4;
+   u8  ip6;
 };
 
 struct ndis_encap_offload {
-- 
2.17.1

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


Re: [PATCH] Staging: comedi: ssv_dnp: Remove unnecessary comment

2018-06-14 Thread Dan Carpenter
On Thu, Jun 14, 2018 at 01:19:12PM -0400, Javier Martinez wrote:
> Removal of a comment that was not needed at all.
> We can clearly see that they are include/header files.
> 
> Signed-off-by: Javier Martinez 
> ---
>  drivers/staging/comedi/drivers/ssv_dnp.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c 
> b/drivers/staging/comedi/drivers/ssv_dnp.c
> index 0628060e42ca..50de018ab9bb 100644
> --- a/drivers/staging/comedi/drivers/ssv_dnp.c
> +++ b/drivers/staging/comedi/drivers/ssv_dnp.c
> @@ -16,7 +16,6 @@
>   * Status: unknown
>   */
>  
> -/* include files --- 
> */
>  

You need to remove a blank line or I think checkpatch.pl will complain
if you re-run it over the whole file.  (You aren't allowed to have
multiple blank lines in a row).

regards,
dan carpenter


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


Re: [PATCH v5] staging: comedi: Improved readability of function comedi_nsamples_left.

2018-06-14 Thread Dan Carpenter
On Thu, Jun 14, 2018 at 06:17:18PM +0200, Chris Opperman wrote:
> Hi Ian,
> 
> Thank you! Are there any more steps for me to take to complete this
> patch process?
> 

No.  You're done...  Greg will apply the patch in a week or two and
you'll get an email.

regards,
dan carpenter

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


[PATCH v4 09/18] staging: mt7621-gpio: remove no more necessary PIN_MASK macro

2018-06-14 Thread Sergio Paracuellos
PIN_MASK macro was being used because of the fact we were only
using one interrupt controller for all of the gpio chips. This
has been changed to use one per gpio chip and each has 32 irqs.
Because of this this macro is not needed anymore. Use BIT macro
instead.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index d2a7512..a8893e8 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -15,7 +15,6 @@
 
 #define MTK_BANK_CNT   3
 #define MTK_BANK_WIDTH 32
-#define PIN_MASK(nr)   (1UL << ((nr % MTK_BANK_WIDTH)))
 
 #define GPIO_BANK_WIDE 0x04
 #define GPIO_REG_CTRL  0x00
@@ -133,10 +132,10 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
high = mtk_gpio_r32(rg, GPIO_REG_HLVL);
low = mtk_gpio_r32(rg, GPIO_REG_LLVL);
-   mtk_gpio_w32(rg, GPIO_REG_REDGE, rise | (PIN_MASK(pin) & rg->rising));
-   mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall | (PIN_MASK(pin) & rg->falling));
-   mtk_gpio_w32(rg, GPIO_REG_HLVL, high | (PIN_MASK(pin) & rg->hlevel));
-   mtk_gpio_w32(rg, GPIO_REG_LLVL, low | (PIN_MASK(pin) & rg->llevel));
+   mtk_gpio_w32(rg, GPIO_REG_REDGE, rise | (BIT(pin) & rg->rising));
+   mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall | (BIT(pin) & rg->falling));
+   mtk_gpio_w32(rg, GPIO_REG_HLVL, high | (BIT(pin) & rg->hlevel));
+   mtk_gpio_w32(rg, GPIO_REG_LLVL, low | (BIT(pin) & rg->llevel));
spin_unlock_irqrestore(>lock, flags);
 }
 
@@ -157,10 +156,10 @@ mediatek_gpio_irq_mask(struct irq_data *d)
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
high = mtk_gpio_r32(rg, GPIO_REG_HLVL);
low = mtk_gpio_r32(rg, GPIO_REG_LLVL);
-   mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall & ~PIN_MASK(pin));
-   mtk_gpio_w32(rg, GPIO_REG_REDGE, rise & ~PIN_MASK(pin));
-   mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~PIN_MASK(pin));
-   mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~PIN_MASK(pin));
+   mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall & ~BIT(pin));
+   mtk_gpio_w32(rg, GPIO_REG_REDGE, rise & ~BIT(pin));
+   mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~BIT(pin));
+   mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~BIT(pin));
spin_unlock_irqrestore(>lock, flags);
 }
 
@@ -170,7 +169,7 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int 
type)
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
struct mtk_gc *rg = to_mediatek_gpio(gc);
int pin = d->hwirq;
-   u32 mask = PIN_MASK(pin);
+   u32 mask = BIT(pin);
 
if (!rg)
return -1;
-- 
2.7.4

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


[PATCH v4 08/18] staging: mt7621-gpio: avoid custom irq_domain for gpio

2018-06-14 Thread Sergio Paracuellos
Instead of create a custom irq_domain for this chip, use
'gpiochip_set_chained_irqchip' from GPIOLIB_IRQCHIP. It
is ok to call this function several times. We have to
manually mark the line with 'IRQF_SHARED' and then loop
over the three banks until you find a hit. There were
some problems with removing an irqchip like that but this
driver is a bool so it might work just fine. After this
changes the functions 'mediatek_gpio_to_irq' is not needed
anymore and also the 'gpio_irq_domain' field from the state
container. Instead of use the custom irq domain in the irq
handler use the associated domain from the gpio_chip in
'irq_find_mapping' function. Function 'mediatek_gpio_bank_probe'
has been moved a it to the botton to have all the irq related
functions together and avoid some forward declarations to resolve
some symbols along the code.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-gpio/Kconfig   |   1 +
 drivers/staging/mt7621-gpio/gpio-mt7621.c | 221 +++---
 2 files changed, 81 insertions(+), 141 deletions(-)

diff --git a/drivers/staging/mt7621-gpio/Kconfig 
b/drivers/staging/mt7621-gpio/Kconfig
index 835998a..e32facb 100644
--- a/drivers/staging/mt7621-gpio/Kconfig
+++ b/drivers/staging/mt7621-gpio/Kconfig
@@ -2,6 +2,7 @@ config GPIO_MT7621
bool "Mediatek GPIO Support"
depends on SOC_MT7620 || SOC_MT7621 || COMPILE_TEST
select GPIO_GENERIC
+   select GPIOLIB_IRQCHIP
select ARCH_REQUIRE_GPIOLIB
help
  Say yes here to support the Mediatek SoC GPIO device
diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 0c344a5..d2a7512 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -8,7 +8,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -58,14 +57,12 @@ struct mtk_gc {
  * @dev: device instance
  * @gpio_membase: memory base address
  * @gpio_irq: irq number from the device tree
- * @gpio_irq_domain: irq domain for this chip
  * @gc_map: array of the gpio chips
  */
 struct mtk_data {
struct device *dev;
void __iomem *gpio_membase;
int gpio_irq;
-   struct irq_domain *gpio_irq_domain;
struct mtk_gc gc_map[MTK_BANK_CNT];
 };
 
@@ -95,98 +92,36 @@ mtk_gpio_r32(struct mtk_gc *rg, u32 offset)
return gc->read_reg(gpio_data->gpio_membase + offset);
 }
 
-static int
-mediatek_gpio_to_irq(struct gpio_chip *chip, unsigned int pin)
-{
-   struct mtk_data *gpio_data = gpiochip_get_data(chip);
-   struct mtk_gc *rg = to_mediatek_gpio(chip);
-
-   return irq_create_mapping(gpio_data->gpio_irq_domain,
- pin + (rg->bank * MTK_BANK_WIDTH));
-}
-
-static int
-mediatek_gpio_bank_probe(struct platform_device *pdev, struct device_node 
*bank)
-{
-   struct mtk_data *gpio = dev_get_drvdata(>dev);
-   const __be32 *id = of_get_property(bank, "reg", NULL);
-   struct mtk_gc *rg;
-   void __iomem *dat, *set, *ctrl, *diro;
-   int ret;
-
-   if (!id || be32_to_cpu(*id) >= MTK_BANK_CNT)
-   return -EINVAL;
-
-   rg = >gc_map[be32_to_cpu(*id)];
-   memset(rg, 0, sizeof(*rg));
-
-   spin_lock_init(>lock);
-   rg->chip.of_node = bank;
-   rg->bank = be32_to_cpu(*id);
-
-   dat = gpio->gpio_membase + GPIO_REG_DATA + (rg->bank * GPIO_BANK_WIDE);
-   set = gpio->gpio_membase + GPIO_REG_DSET + (rg->bank * GPIO_BANK_WIDE);
-   ctrl = gpio->gpio_membase + GPIO_REG_DCLR + (rg->bank * GPIO_BANK_WIDE);
-   diro = gpio->gpio_membase + GPIO_REG_CTRL + (rg->bank * GPIO_BANK_WIDE);
-
-   ret = bgpio_init(>chip, >dev, 4,
-dat, set, ctrl, diro, NULL, 0);
-   if (ret) {
-   dev_err(>dev, "bgpio_init() failed\n");
-   return ret;
-   }
-
-   if (gpio->gpio_irq_domain)
-   rg->chip.to_irq = mediatek_gpio_to_irq;
-
-   ret = devm_gpiochip_add_data(>dev, >chip, gpio);
-   if (ret < 0) {
-   dev_err(>dev, "Could not register gpio %d, ret=%d\n",
-   rg->chip.ngpio, ret);
-   return ret;
-   }
-
-   /* set polarity to low for all gpios */
-   mtk_gpio_w32(rg, GPIO_REG_POL, 0);
-
-   dev_info(>dev, "registering %d gpios\n", rg->chip.ngpio);
-
-   return 0;
-}
-
-static void
-mediatek_gpio_irq_handler(struct irq_desc *desc)
+static irqreturn_t
+mediatek_gpio_irq_handler(int irq, void *data)
 {
-   struct mtk_data *gpio_data = irq_desc_get_handler_data(desc);
-   int i;
-
-   for (i = 0; i < MTK_BANK_CNT; i++) {
-   struct mtk_gc *rg = _data->gc_map[i];
-   unsigned long pending;
-   int bit;
-
-   if (!rg)
-   continue;
+   struct gpio_chip *gc = data;
+   struct mtk_gc *rg = to_mediatek_gpio(gc);
+   irqreturn_t ret = IRQ_NONE;
+   

[PATCH v4 02/18] staging: mt7621-gpio: avoid including 'gpio.h'

2018-06-14 Thread Sergio Paracuellos
Including file '' should be avoided in
new drivers code, so just remove it because it is
no necessary at all.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index eb60dd4..f95310c 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -5,7 +5,6 @@
  */
 
 #include 
-#include 
 #include 
 #include 
 #include 
-- 
2.7.4

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


[PATCH v4 03/18] staging: mt7621-gpio: make use of 'builtin_platform_driver'

2018-06-14 Thread Sergio Paracuellos
This driver was being registered using 'module_platform_driver'
but it is not a module at all. Instead of this use
'builtin_platform_driver' which seems to be the correct one.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index f95310c..6a31f60 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -312,4 +312,4 @@ static struct platform_driver mediatek_gpio_driver = {
},
 };
 
-module_platform_driver(mediatek_gpio_driver);
+builtin_platform_driver(mediatek_gpio_driver);
-- 
2.7.4

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


[PATCH v4 13/18] staging: mt7621-gpio: avoid to set up irqs if not defined in dts

2018-06-14 Thread Sergio Paracuellos
If there is no interrupt defined in the dts 'irq_of_parse_and_map'
returns 0 and we should't set up interrupts for each gpio chip in
that case.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 1318003..96dee10 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -237,30 +237,32 @@ mediatek_gpio_bank_probe(struct platform_device *pdev, 
struct device_node *bank)
return ret;
}
 
-   /*
-* Manually request the irq here instead of passing a flow-handler
-* to gpiochip_set_chained_irqchip, because the irq is shared.
-*/
-   ret = devm_request_irq(>dev, gpio->gpio_irq,
-  mediatek_gpio_irq_handler, IRQF_SHARED,
-  "mt7621", >chip);
+   if (gpio->gpio_irq) {
+   /*
+* Manually request the irq here instead of passing a 
flow-handler
+* to gpiochip_set_chained_irqchip, because the irq is shared.
+*/
+   ret = devm_request_irq(>dev, gpio->gpio_irq,
+  mediatek_gpio_irq_handler, IRQF_SHARED,
+  "mt7621", >chip);
+
+   if (ret) {
+   dev_err(>dev, "Error requesting IRQ %d: %d\n",
+   gpio->gpio_irq, ret);
+   return ret;
+   }
 
-   if (ret) {
-   dev_err(>dev, "Error requesting IRQ %d: %d\n",
-   gpio->gpio_irq, ret);
-   return ret;
-   }
+   ret = gpiochip_irqchip_add(>chip, _gpio_irq_chip,
+  0, handle_simple_irq, IRQ_TYPE_NONE);
+   if (ret) {
+   dev_err(>dev, "failed to add gpiochip_irqchip\n");
+   return ret;
+   }
 
-   ret = gpiochip_irqchip_add(>chip, _gpio_irq_chip,
-  0, handle_simple_irq, IRQ_TYPE_NONE);
-   if (ret) {
-   dev_err(>dev, "failed to add gpiochip_irqchip\n");
-   return ret;
+   gpiochip_set_chained_irqchip(>chip, _gpio_irq_chip,
+gpio->gpio_irq, NULL);
}
 
-   gpiochip_set_chained_irqchip(>chip, _gpio_irq_chip,
-gpio->gpio_irq, NULL);
-
/* set polarity to low for all gpios */
mtk_gpio_w32(rg, GPIO_REG_POL, 0);
 
-- 
2.7.4

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


[PATCH v4 10/18] staging: mt7621-gpio: update kerneldoc for state containers

2018-06-14 Thread Sergio Paracuellos
Update kernel doc for mtk_data and also remove no needed
documentation for mtk_gc which is clear enough to don't
need it.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index a8893e8..5f7d524c 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -29,16 +29,6 @@
 #define GPIO_REG_STAT  0x90
 #define GPIO_REG_EDGE  0xA0
 
-/**
- * struct mtk_gc - data for a single gpio-chip
- * @chip: gpio chip instance
- * @lock: spinlock to protect the chip
- * @bank: gpio bank number for the chip
- * @rising: mask for rising irqs
- * @falling: mask for falling irqs
- * @hlevel: mask for high level irqs
- * @llevel: mask for low level irqs
- */
 struct mtk_gc {
struct gpio_chip chip;
spinlock_t lock;
@@ -51,8 +41,9 @@ struct mtk_gc {
 
 /**
  * struct mtk_data - state container for
- * data of the platform driver. It is a
- * single irq-chip but 3 separate gpio-chip.
+ * data of the platform driver. It is 3
+ * separate gpio-chip each one with its
+ * own irq_chip.
  * @dev: device instance
  * @gpio_membase: memory base address
  * @gpio_irq: irq number from the device tree
-- 
2.7.4

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


[PATCH v4 06/18] staging: mt7621-gpio: add kerneldoc for state data containers

2018-06-14 Thread Sergio Paracuellos
This commit adds kerneldoc for the two data containers in
order to better understanding of its existence.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index e5a7979..54c18c1 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -31,6 +31,14 @@
 #define GPIO_REG_STAT  0x90
 #define GPIO_REG_EDGE  0xA0
 
+/**
+ * struct mtk_gc - data for a single gpio-chip
+ * @chip: gpio chip instance
+ * @lock: spinlock to protect the chip
+ * @bank: gpio bank number for the chip
+ * @rising: mask for rising irqs
+ * @falling: mask for falling irqs
+ */
 struct mtk_gc {
struct gpio_chip chip;
spinlock_t lock;
@@ -39,6 +47,16 @@ struct mtk_gc {
u32 falling;
 };
 
+/**
+ * struct mtk_data - state container for
+ * data of the platform driver. It is a
+ * single irq-chip but 3 separate gpio-chip.
+ * @dev: device instance
+ * @gpio_membase: memory base address
+ * @gpio_irq: irq number from the device tree
+ * @gpio_irq_domain: irq domain for this chip
+ * @gc_map: array of the gpio chips
+ */
 struct mtk_data {
struct device *dev;
void __iomem *gpio_membase;
-- 
2.7.4

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


[PATCH v4 07/18] staging: mt7621-gpio: implement high level and low level irqs

2018-06-14 Thread Sergio Paracuellos
This chip support high level and low level interrupts. Those
have to be implemented also to get a complete and clean driver.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 54c18c1..0c344a5 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -38,6 +38,8 @@
  * @bank: gpio bank number for the chip
  * @rising: mask for rising irqs
  * @falling: mask for falling irqs
+ * @hlevel: mask for high level irqs
+ * @llevel: mask for low level irqs
  */
 struct mtk_gc {
struct gpio_chip chip;
@@ -45,6 +47,8 @@ struct mtk_gc {
int bank;
u32 rising;
u32 falling;
+   u32 hlevel;
+   u32 llevel;
 };
 
 /**
@@ -184,7 +188,7 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
int bank = pin / MTK_BANK_WIDTH;
struct mtk_gc *rg = _data->gc_map[bank];
unsigned long flags;
-   u32 rise, fall;
+   u32 rise, fall, high, low;
 
if (!rg)
return;
@@ -192,8 +196,12 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
spin_lock_irqsave(>lock, flags);
rise = mtk_gpio_r32(rg, GPIO_REG_REDGE);
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
+   high = mtk_gpio_r32(rg, GPIO_REG_HLVL);
+   low = mtk_gpio_r32(rg, GPIO_REG_LLVL);
mtk_gpio_w32(rg, GPIO_REG_REDGE, rise | (PIN_MASK(pin) & rg->rising));
mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall | (PIN_MASK(pin) & rg->falling));
+   mtk_gpio_w32(rg, GPIO_REG_HLVL, high | (PIN_MASK(pin) & rg->hlevel));
+   mtk_gpio_w32(rg, GPIO_REG_LLVL, low | (PIN_MASK(pin) & rg->llevel));
spin_unlock_irqrestore(>lock, flags);
 }
 
@@ -205,7 +213,7 @@ mediatek_gpio_irq_mask(struct irq_data *d)
int bank = pin / MTK_BANK_WIDTH;
struct mtk_gc *rg = _data->gc_map[bank];
unsigned long flags;
-   u32 rise, fall;
+   u32 rise, fall, high, low;
 
if (!rg)
return;
@@ -213,8 +221,12 @@ mediatek_gpio_irq_mask(struct irq_data *d)
spin_lock_irqsave(>lock, flags);
rise = mtk_gpio_r32(rg, GPIO_REG_REDGE);
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
+   high = mtk_gpio_r32(rg, GPIO_REG_HLVL);
+   low = mtk_gpio_r32(rg, GPIO_REG_LLVL);
mtk_gpio_w32(rg, GPIO_REG_FEDGE, fall & ~PIN_MASK(pin));
mtk_gpio_w32(rg, GPIO_REG_REDGE, rise & ~PIN_MASK(pin));
+   mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~PIN_MASK(pin));
+   mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~PIN_MASK(pin));
spin_unlock_irqrestore(>lock, flags);
 }
 
@@ -231,21 +243,36 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int 
type)
return -1;
 
if (type == IRQ_TYPE_PROBE) {
-   if ((rg->rising | rg->falling) & mask)
+   if ((rg->rising | rg->falling |
+rg->hlevel | rg->llevel) & mask)
return 0;
 
type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
}
 
-   if (type & IRQ_TYPE_EDGE_RISING)
-   rg->rising |= mask;
-   else
-   rg->rising &= ~mask;
+   rg->rising &= ~mask;
+   rg->falling &= ~mask;
+   rg->hlevel &= ~mask;
+   rg->llevel &= ~mask;
 
-   if (type & IRQ_TYPE_EDGE_FALLING)
+   switch (type & IRQ_TYPE_SENSE_MASK) {
+   case IRQ_TYPE_EDGE_BOTH:
+   rg->rising |= mask;
rg->falling |= mask;
-   else
-   rg->falling &= ~mask;
+   break;
+   case IRQ_TYPE_EDGE_RISING:
+   rg->rising |= mask;
+   break;
+   case IRQ_TYPE_EDGE_FALLING:
+   rg->falling |= mask;
+   break;
+   case IRQ_TYPE_LEVEL_HIGH:
+   rg->hlevel |= mask;
+   break;
+   case IRQ_TYPE_LEVEL_LOW:
+   rg->llevel |= mask;
+   break;
+   }
 
return 0;
 }
-- 
2.7.4

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


[PATCH v4 04/18] staging: mt7621-gpio: implement '.irq_[request|release]_resources' functions

2018-06-14 Thread Sergio Paracuellos
When implementing custom irqchips it is important to also
implement .irq_request_resources() and .irq_release_resources()
and make sure these call gpiochip_[un]lock_as_irq().
Add those two for this driver. Also store struct device pointer
in global state structure to be able to use 'dev_err' with the
device from 'mediatek_request_resources' function.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 6a31f60..e5a7979 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -40,6 +40,7 @@ struct mtk_gc {
 };
 
 struct mtk_data {
+   struct device *dev;
void __iomem *gpio_membase;
int gpio_irq;
struct irq_domain *gpio_irq_domain;
@@ -231,12 +232,42 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int 
type)
return 0;
 }
 
+static int mediatek_irq_reqres(struct irq_data *d)
+{
+   struct mtk_data *gpio_data = irq_data_get_irq_chip_data(d);
+   int bank = irqd_to_hwirq(d) / MTK_BANK_WIDTH;
+   struct mtk_gc *rg = _data->gc_map[bank];
+   struct gpio_chip *gc = >chip;
+   int ret;
+
+   ret = gpiochip_lock_as_irq(gc, irqd_to_hwirq(d));
+   if (ret) {
+   dev_err(gpio_data->dev, "unable to lock HW IRQ %lu for IRQ\n",
+   irqd_to_hwirq(d));
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+static void mediatek_irq_relres(struct irq_data *d)
+{
+   struct mtk_data *gpio_data = irq_data_get_irq_chip_data(d);
+   int bank = irqd_to_hwirq(d) / MTK_BANK_WIDTH;
+   struct mtk_gc *rg = _data->gc_map[bank];
+   struct gpio_chip *gc = >chip;
+
+   gpiochip_unlock_as_irq(gc, irqd_to_hwirq(d));
+}
+
 static struct irq_chip mediatek_gpio_irq_chip = {
-   .name   = "GPIO",
-   .irq_unmask = mediatek_gpio_irq_unmask,
-   .irq_mask   = mediatek_gpio_irq_mask,
-   .irq_mask_ack   = mediatek_gpio_irq_mask,
-   .irq_set_type   = mediatek_gpio_irq_type,
+   .name   = "GPIO",
+   .irq_unmask = mediatek_gpio_irq_unmask,
+   .irq_mask   = mediatek_gpio_irq_mask,
+   .irq_mask_ack   = mediatek_gpio_irq_mask,
+   .irq_set_type   = mediatek_gpio_irq_type,
+   .irq_request_resources  = mediatek_irq_reqres,
+   .irq_release_resources  = mediatek_irq_relres,
 };
 
 static int
@@ -284,6 +315,7 @@ mediatek_gpio_probe(struct platform_device *pdev)
dev_err(>dev, "irq_domain_add_linear failed\n");
}
 
+   gpio_data->dev = >dev;
platform_set_drvdata(pdev, gpio_data);
 
for_each_child_of_node(np, bank)
-- 
2.7.4

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


[PATCH v4 15/18] staging: mt7621-gpio: set different names for each gpio_chip and irq_chip

2018-06-14 Thread Sergio Paracuellos
Currently the driver defines 3 gpiochips, one for each bank.

/sys/class/gpio/gpiochip416/label:1e000600.gpio
/sys/class/gpio/gpiochip448/label:1e000600.gpio
/sys/class/gpio/gpiochip480/label:1e000600.gpio

Unfortunately they all have the same label

Interrupts from /proc/interrupt show the same name which is
confusing:

/proc/interrupts:

17: 0  0  0  0  MIPS GIC  19  mt7621, mt7621, mt7621

which is the interrupt from the GPIO controller.
It is a little weird that all three banks are named "mt7621"
here. We also have:

26: 0  0  0  0  GPIO  18  reset

which is the interrupt from GPIO which provides the "reset"
button. I suspect that if I had interrupts form two different
banks they would both be called "GPIO" which would be a little
confusing.

In order to unify all of this set different names for each chip
Use a 'bank-based' name instead the same for all: 'mt7621-bank[0-2]'.
Create a new 'mediatek_gpio_bank_name' function which return the
name depending on the bank number. This function is allways called
with a valid index 0, 1 or 2.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 698a95d..63fb5a1 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -190,13 +190,21 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int 
type)
 }
 
 static struct irq_chip mediatek_gpio_irq_chip = {
-   .name   = "GPIO",
.irq_unmask = mediatek_gpio_irq_unmask,
.irq_mask   = mediatek_gpio_irq_mask,
.irq_mask_ack   = mediatek_gpio_irq_mask,
.irq_set_type   = mediatek_gpio_irq_type,
 };
 
+static inline const char * const mediatek_gpio_bank_name(int bank)
+{
+   static const char * const bank_names[] = {
+   "mt7621-bank0", "mt7621-bank1", "mt7621-bank2",
+   };
+
+   return bank_names[bank];
+}
+
 static int
 mediatek_gpio_bank_probe(struct platform_device *pdev, struct device_node 
*bank)
 {
@@ -215,6 +223,7 @@ mediatek_gpio_bank_probe(struct platform_device *pdev, 
struct device_node *bank)
spin_lock_init(>lock);
rg->chip.of_node = bank;
rg->bank = be32_to_cpu(*id);
+   rg->chip.label = mediatek_gpio_bank_name(rg->bank);
 
dat = gpio->gpio_membase + GPIO_REG_DATA + (rg->bank * GPIO_BANK_WIDE);
set = gpio->gpio_membase + GPIO_REG_DSET + (rg->bank * GPIO_BANK_WIDE);
@@ -242,7 +251,7 @@ mediatek_gpio_bank_probe(struct platform_device *pdev, 
struct device_node *bank)
 */
ret = devm_request_irq(>dev, gpio->gpio_irq,
   mediatek_gpio_irq_handler, IRQF_SHARED,
-  "mt7621", >chip);
+  rg->chip.label, >chip);
 
if (ret) {
dev_err(>dev, "Error requesting IRQ %d: %d\n",
@@ -250,6 +259,7 @@ mediatek_gpio_bank_probe(struct platform_device *pdev, 
struct device_node *bank)
return ret;
}
 
+   mediatek_gpio_irq_chip.name = rg->chip.label;
ret = gpiochip_irqchip_add(>chip, _gpio_irq_chip,
   0, handle_simple_irq, IRQ_TYPE_NONE);
if (ret) {
-- 
2.7.4

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


[PATCH v4 00/18] staging: mt7621-gpio: last cleanups

2018-06-14 Thread Sergio Paracuellos
After submiting this driver to try to get mainlined and get
out of staging some new cleanups seems to be necessary.
According to this mail of Linus Walleij:

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-June/121742.html

and this mail os Rob Herring:

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-June/121974.html

this series tries to fix all of the issues in order to send
v2 and give it a new try. Because I don't have to hardware to
test my changes I send new cleanups first in staging to make
easier to NeilBrown test it and get a feedback about them.

Changes in v4:
- Add "last minor cleanups" series to the same patch series.
- Update Kconfig being more specific in description and help
  about the SoC.
- Update dt-bindings, device tree and code to don't use
  banks in the device tree assuming this SoC has 3 banks
  with 32 gpios each.

Changes in v3:
- PATCH 7: refactor irq_type to make better code.
- Add PATCH 8 avoiding the use of custom domain and requesting
  manually a 'IRQF_SHARED'. It should be working now??

Changes in v2:
- Patch where GPIOLIB_IRQCHIP was used avoiding
  the use of a custom irq domain has been dropped to
  be sure after this changes all is working properly.
  (This was PATCH 7 in previous series)
- PATCH 1:
 * avoid introducing new macros and use 'bank'
   field of mtk_gc with register offset.
 * Make correct use of bgpio_init passing new
   void __iomem pointers instead of use the
   macros.
- Previous series PATCH 8 now is PATCH 7. Avoid the
  use of a switch-case statement which was wrong and
  distinc if we have RISSING AND FALLING EDGE interrupt
  or HIGH LOW level ones. This last two are exclusive and
  cannot be generated at the same time.

Hope this helps.

Thanks in advance.

Best regards,
Sergio Paracuellos

Sergio Paracuellos (18):
  staging: mt7621-gpio: make use 'bgpio_init' from GPIO_GENERIC
  staging: mt7621-gpio: avoid including 'gpio.h'
  staging: mt7621-gpio: make use of 'builtin_platform_driver'
  staging: mt7621-gpio: implement '.irq_[request|release]_resources'
functions
  staging: mt7621-gpio: add COMPILE_TEST
  staging: mt7621-gpio: add kerneldoc for state data containers
  staging: mt7621-gpio: implement high level and low level irqs
  staging: mt7621-gpio: avoid custom irq_domain for gpio
  staging: mt7621-gpio: remove no more necessary PIN_MASK macro
  staging: mt7621-gpio: update kerneldoc for state containers
  staging: mt7621-gpio: align indentation for all defines
  staging: mt7621-gpio: avoid check for NULL in 'to_mediatek_gpio' calls
  staging: mt7621-gpio: avoid to set up irqs if not defined in dts
  staging: mt7621-gpio: avoid one level indentation in interrupt handler
  staging: mt7621-gpio: set different names for each gpio_chip and
irq_chip
  staging: mt7621-gpio: avoid long line in a comment
  staging: mt7621-gpio: update Kconfig with SoC details
  staging: mt7621-gpio: avoid use banks in device tree

 drivers/staging/mt7621-dts/gbpc1.dts   |  10 +-
 drivers/staging/mt7621-dts/mt7621.dtsi |  31 +-
 drivers/staging/mt7621-gpio/Kconfig|   8 +-
 drivers/staging/mt7621-gpio/gpio-mt7621.c  | 404 +
 .../staging/mt7621-gpio/mediatek,mt7621-gpio.txt   |  59 +--
 5 files changed, 204 insertions(+), 308 deletions(-)

-- 
2.7.4

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


[PATCH v4 17/18] staging: mt7621-gpio: update Kconfig with SoC details

2018-06-14 Thread Sergio Paracuellos
Kconfig is using a generic 'Mediatek GPIO Support' in
description and help which is not specific at all about
the current SoC which is MT7621. Update it.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-gpio/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/mt7621-gpio/Kconfig 
b/drivers/staging/mt7621-gpio/Kconfig
index e32facb..5485dd2 100644
--- a/drivers/staging/mt7621-gpio/Kconfig
+++ b/drivers/staging/mt7621-gpio/Kconfig
@@ -1,8 +1,8 @@
 config GPIO_MT7621
-   bool "Mediatek GPIO Support"
+   bool "Mediatek MT7621 GPIO Support"
depends on SOC_MT7620 || SOC_MT7621 || COMPILE_TEST
select GPIO_GENERIC
select GPIOLIB_IRQCHIP
select ARCH_REQUIRE_GPIOLIB
help
- Say yes here to support the Mediatek SoC GPIO device
+ Say yes here to support the Mediatek MT7621 SoC GPIO device
-- 
2.7.4

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


[PATCH v4 14/18] staging: mt7621-gpio: avoid one level indentation in interrupt handler

2018-06-14 Thread Sergio Paracuellos
There is no need to check for 'pending' before loop over the
interrupts using 'for_each_set_bit' if nothing is set the
return values will be the same so just avoid this check avoiding
also one level intentation and improving readability.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 96dee10..698a95d 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -93,14 +93,12 @@ mediatek_gpio_irq_handler(int irq, void *data)
 
pending = mtk_gpio_r32(rg, GPIO_REG_STAT);
 
-   if (pending) {
-   for_each_set_bit(bit, , MTK_BANK_WIDTH) {
-   u32 map = irq_find_mapping(gc->irq.domain, bit);
+   for_each_set_bit(bit, , MTK_BANK_WIDTH) {
+   u32 map = irq_find_mapping(gc->irq.domain, bit);
 
-   generic_handle_irq(map);
-   mtk_gpio_w32(rg, GPIO_REG_STAT, BIT(bit));
-   ret |= IRQ_HANDLED;
-   }
+   generic_handle_irq(map);
+   mtk_gpio_w32(rg, GPIO_REG_STAT, BIT(bit));
+   ret |= IRQ_HANDLED;
}
 
return ret;
-- 
2.7.4

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


[PATCH v4 12/18] staging: mt7621-gpio: avoid check for NULL in 'to_mediatek_gpio' calls

2018-06-14 Thread Sergio Paracuellos
Function 'to_mediatek_gpio' cannot return NULL, so this NULL
checkings are pointless.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 853817a..1318003 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -115,9 +115,6 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
unsigned long flags;
u32 rise, fall, high, low;
 
-   if (!rg)
-   return;
-
spin_lock_irqsave(>lock, flags);
rise = mtk_gpio_r32(rg, GPIO_REG_REDGE);
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
@@ -139,9 +136,6 @@ mediatek_gpio_irq_mask(struct irq_data *d)
unsigned long flags;
u32 rise, fall, high, low;
 
-   if (!rg)
-   return;
-
spin_lock_irqsave(>lock, flags);
rise = mtk_gpio_r32(rg, GPIO_REG_REDGE);
fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
@@ -162,9 +156,6 @@ mediatek_gpio_irq_type(struct irq_data *d, unsigned int 
type)
int pin = d->hwirq;
u32 mask = BIT(pin);
 
-   if (!rg)
-   return -1;
-
if (type == IRQ_TYPE_PROBE) {
if ((rg->rising | rg->falling |
 rg->hlevel | rg->llevel) & mask)
-- 
2.7.4

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


[PATCH v4 11/18] staging: mt7621-gpio: align indentation for all defines

2018-06-14 Thread Sergio Paracuellos
There was two remaining defines which weren't properly
aligned with the rest. Align them improving readability.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 5f7d524c..853817a 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -13,8 +13,8 @@
 #include 
 #include 
 
-#define MTK_BANK_CNT   3
-#define MTK_BANK_WIDTH 32
+#define MTK_BANK_CNT   3
+#define MTK_BANK_WIDTH 32
 
 #define GPIO_BANK_WIDE 0x04
 #define GPIO_REG_CTRL  0x00
-- 
2.7.4

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


[PATCH v4 16/18] staging: mt7621-gpio: avoid long line in a comment

2018-06-14 Thread Sergio Paracuellos
Checkpatch script is complaining about a comment line
which exceeds 80 characteres. Just silence it.

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

diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 63fb5a1..9a4a12f 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -246,8 +246,9 @@ mediatek_gpio_bank_probe(struct platform_device *pdev, 
struct device_node *bank)
 
if (gpio->gpio_irq) {
/*
-* Manually request the irq here instead of passing a 
flow-handler
-* to gpiochip_set_chained_irqchip, because the irq is shared.
+* Manually request the irq here instead of passing
+* a flow-handler to gpiochip_set_chained_irqchip,
+* because the irq is shared.
 */
ret = devm_request_irq(>dev, gpio->gpio_irq,
   mediatek_gpio_irq_handler, IRQF_SHARED,
-- 
2.7.4

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


[PATCH v4 05/18] staging: mt7621-gpio: add COMPILE_TEST

2018-06-14 Thread Sergio Paracuellos
This driver is actually platform-agnostic.  Add COMPILE_TEST for
the compilation test coverage.

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

diff --git a/drivers/staging/mt7621-gpio/Kconfig 
b/drivers/staging/mt7621-gpio/Kconfig
index f4453e8..835998a 100644
--- a/drivers/staging/mt7621-gpio/Kconfig
+++ b/drivers/staging/mt7621-gpio/Kconfig
@@ -1,6 +1,6 @@
 config GPIO_MT7621
bool "Mediatek GPIO Support"
-   depends on SOC_MT7620 || SOC_MT7621
+   depends on SOC_MT7620 || SOC_MT7621 || COMPILE_TEST
select GPIO_GENERIC
select ARCH_REQUIRE_GPIOLIB
help
-- 
2.7.4

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


[PATCH v4 18/18] staging: mt7621-gpio: avoid use banks in device tree

2018-06-14 Thread Sergio Paracuellos
Banks shouldn't be defined in DT if number of resources
per bank is not variable. We actually know that this SoC
has three banks so take that into account in order to don't
overspecify the device tree. Device tree will only have one
node making it simple. Update device tree, binding doc and
code accordly.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-dts/gbpc1.dts   | 10 ++--
 drivers/staging/mt7621-dts/mt7621.dtsi | 31 ++--
 drivers/staging/mt7621-gpio/gpio-mt7621.c  | 19 +++
 .../staging/mt7621-gpio/mediatek,mt7621-gpio.txt   | 59 +-
 4 files changed, 30 insertions(+), 89 deletions(-)

diff --git a/drivers/staging/mt7621-dts/gbpc1.dts 
b/drivers/staging/mt7621-dts/gbpc1.dts
index 6b13d85..352945d 100644
--- a/drivers/staging/mt7621-dts/gbpc1.dts
+++ b/drivers/staging/mt7621-dts/gbpc1.dts
@@ -32,7 +32,7 @@
 
reset {
label = "reset";
-   gpios = < 18 GPIO_ACTIVE_HIGH>;
+   gpios = < 18 GPIO_ACTIVE_HIGH>;
linux,code = ;
};
};
@@ -42,22 +42,22 @@
 
system {
label = "gb-pc1:green:system";
-   gpios = < 6 GPIO_ACTIVE_LOW>;
+   gpios = < 6 GPIO_ACTIVE_LOW>;
};
 
status {
label = "gb-pc1:green:status";
-   gpios = < 8 GPIO_ACTIVE_LOW>;
+   gpios = < 8 GPIO_ACTIVE_LOW>;
};
 
lan1 {
label = "gb-pc1:green:lan1";
-   gpios = < 24 GPIO_ACTIVE_LOW>;
+   gpios = < 24 GPIO_ACTIVE_LOW>;
};
 
lan2 {
label = "gb-pc1:green:lan2";
-   gpios = < 25 GPIO_ACTIVE_LOW>;
+   gpios = < 25 GPIO_ACTIVE_LOW>;
};
};
 };
diff --git a/drivers/staging/mt7621-dts/mt7621.dtsi 
b/drivers/staging/mt7621-dts/mt7621.dtsi
index acb6b8c..02746af 100644
--- a/drivers/staging/mt7621-dts/mt7621.dtsi
+++ b/drivers/staging/mt7621-dts/mt7621.dtsi
@@ -61,37 +61,14 @@
};
 
gpio: gpio@600 {
-   #address-cells = <1>;
-   #size-cells = <0>;
-
+   #gpio-cells = <2>;
+   #interrupt-cells = <2>;
compatible = "mediatek,mt7621-gpio";
+   gpio-controller;
+   interrupt-controller;
reg = <0x600 0x100>;
-
interrupt-parent = <>;
interrupts = ;
-   interrupt-controller;
-   #interrupt-cells = <2>;
-
-   gpio0: bank@0 {
-   reg = <0>;
-   compatible = "mediatek,mt7621-gpio-bank";
-   gpio-controller;
-   #gpio-cells = <2>;
-   };
-
-   gpio1: bank@1 {
-   reg = <1>;
-   compatible = "mediatek,mt7621-gpio-bank";
-   gpio-controller;
-   #gpio-cells = <2>;
-   };
-
-   gpio2: bank@2 {
-   reg = <2>;
-   compatible = "mediatek,mt7621-gpio-bank";
-   gpio-controller;
-   #gpio-cells = <2>;
-   };
};
 
i2c: i2c@900 {
diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 9a4a12f..892424a 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -206,23 +206,20 @@ static inline const char * const 
mediatek_gpio_bank_name(int bank)
 }
 
 static int
-mediatek_gpio_bank_probe(struct platform_device *pdev, struct device_node 
*bank)
+mediatek_gpio_bank_probe(struct platform_device *pdev,
+struct device_node *node, int bank)
 {
struct mtk_data *gpio = dev_get_drvdata(>dev);
-   const __be32 *id = of_get_property(bank, "reg", NULL);
struct mtk_gc *rg;
void __iomem *dat, *set, *ctrl, *diro;
int ret;
 
-   if (!id || be32_to_cpu(*id) >= MTK_BANK_CNT)
-   return -EINVAL;
-
-   rg = >gc_map[be32_to_cpu(*id)];
+   rg = >gc_map[bank];
memset(rg, 0, sizeof(*rg));
 
spin_lock_init(>lock);
-   rg->chip.of_node = bank;
-   rg->bank = be32_to_cpu(*id);
+   rg->chip.of_node = node;
+   rg->bank = bank;
rg->chip.label = mediatek_gpio_bank_name(rg->bank);
 
dat = gpio->gpio_membase + GPIO_REG_DATA + (rg->bank * 

[PATCH v4 01/18] staging: mt7621-gpio: make use 'bgpio_init' from GPIO_GENERIC

2018-06-14 Thread Sergio Paracuellos
Gpio complexity is just masking the fact that offset is always
0..n and writes to bits 0..n of some memory address. Because
of this whole thing can just me converted to use GPIO_GENERIC
and avoid duplications of a lot of driver custom functions.
So use bgpio_init instead of custom code adding GPIO_GENERIC
dependency to the Kconfig file. Also to make easier using
bgpio_init function offset for each gpio bank, enumeration
where register were defined has been replaced in favour of
some macros which handle each gpio offset taking into account
the bank where are located. Because of this change write and
read functions which are being used for remaining irq handling
stuff have been updated also as well as its dependencies along
the code.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/mt7621-gpio/Kconfig   |   1 +
 drivers/staging/mt7621-gpio/gpio-mt7621.c | 136 +-
 2 files changed, 42 insertions(+), 95 deletions(-)

diff --git a/drivers/staging/mt7621-gpio/Kconfig 
b/drivers/staging/mt7621-gpio/Kconfig
index c741ec3..f4453e8 100644
--- a/drivers/staging/mt7621-gpio/Kconfig
+++ b/drivers/staging/mt7621-gpio/Kconfig
@@ -1,6 +1,7 @@
 config GPIO_MT7621
bool "Mediatek GPIO Support"
depends on SOC_MT7620 || SOC_MT7621
+   select GPIO_GENERIC
select ARCH_REQUIRE_GPIOLIB
help
  Say yes here to support the Mediatek SoC GPIO device
diff --git a/drivers/staging/mt7621-gpio/gpio-mt7621.c 
b/drivers/staging/mt7621-gpio/gpio-mt7621.c
index 0c4fb4a..eb60dd4 100644
--- a/drivers/staging/mt7621-gpio/gpio-mt7621.c
+++ b/drivers/staging/mt7621-gpio/gpio-mt7621.c
@@ -19,19 +19,18 @@
 #define MTK_BANK_WIDTH 32
 #define PIN_MASK(nr)   (1UL << ((nr % MTK_BANK_WIDTH)))
 
-enum mediatek_gpio_reg {
-   GPIO_REG_CTRL = 0,
-   GPIO_REG_POL,
-   GPIO_REG_DATA,
-   GPIO_REG_DSET,
-   GPIO_REG_DCLR,
-   GPIO_REG_REDGE,
-   GPIO_REG_FEDGE,
-   GPIO_REG_HLVL,
-   GPIO_REG_LLVL,
-   GPIO_REG_STAT,
-   GPIO_REG_EDGE,
-};
+#define GPIO_BANK_WIDE 0x04
+#define GPIO_REG_CTRL  0x00
+#define GPIO_REG_POL   0x10
+#define GPIO_REG_DATA  0x20
+#define GPIO_REG_DSET  0x30
+#define GPIO_REG_DCLR  0x40
+#define GPIO_REG_REDGE 0x50
+#define GPIO_REG_FEDGE 0x60
+#define GPIO_REG_HLVL  0x70
+#define GPIO_REG_LLVL  0x80
+#define GPIO_REG_STAT  0x90
+#define GPIO_REG_EDGE  0xA0
 
 struct mtk_gc {
struct gpio_chip chip;
@@ -55,80 +54,23 @@ to_mediatek_gpio(struct gpio_chip *chip)
 }
 
 static inline void
-mtk_gpio_w32(struct mtk_gc *rg, u8 reg, u32 val)
+mtk_gpio_w32(struct mtk_gc *rg, u32 offset, u32 val)
 {
-   struct mtk_data *gpio_data = gpiochip_get_data(>chip);
-   u32 offset = (reg * 0x10) + (rg->bank * 0x4);
+   struct gpio_chip *gc = >chip;
+   struct mtk_data *gpio_data = gpiochip_get_data(gc);
 
-   iowrite32(val, gpio_data->gpio_membase + offset);
+   offset = (rg->bank * GPIO_BANK_WIDE) + offset;
+   gc->write_reg(gpio_data->gpio_membase + offset, val);
 }
 
 static inline u32
-mtk_gpio_r32(struct mtk_gc *rg, u8 reg)
-{
-   struct mtk_data *gpio_data = gpiochip_get_data(>chip);
-   u32 offset = (reg * 0x10) + (rg->bank * 0x4);
-
-   return ioread32(gpio_data->gpio_membase + offset);
-}
-
-static void
-mediatek_gpio_set(struct gpio_chip *chip, unsigned int offset, int value)
-{
-   struct mtk_gc *rg = to_mediatek_gpio(chip);
-
-   mtk_gpio_w32(rg, (value) ? GPIO_REG_DSET : GPIO_REG_DCLR, BIT(offset));
-}
-
-static int
-mediatek_gpio_get(struct gpio_chip *chip, unsigned int offset)
-{
-   struct mtk_gc *rg = to_mediatek_gpio(chip);
-
-   return !!(mtk_gpio_r32(rg, GPIO_REG_DATA) & BIT(offset));
-}
-
-static int
-mediatek_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
-{
-   struct mtk_gc *rg = to_mediatek_gpio(chip);
-   unsigned long flags;
-   u32 t;
-
-   spin_lock_irqsave(>lock, flags);
-   t = mtk_gpio_r32(rg, GPIO_REG_CTRL);
-   t &= ~BIT(offset);
-   mtk_gpio_w32(rg, GPIO_REG_CTRL, t);
-   spin_unlock_irqrestore(>lock, flags);
-
-   return 0;
-}
-
-static int
-mediatek_gpio_direction_output(struct gpio_chip *chip,
-   unsigned int offset, int value)
+mtk_gpio_r32(struct mtk_gc *rg, u32 offset)
 {
-   struct mtk_gc *rg = to_mediatek_gpio(chip);
-   unsigned long flags;
-   u32 t;
+   struct gpio_chip *gc = >chip;
+   struct mtk_data *gpio_data = gpiochip_get_data(gc);
 
-   spin_lock_irqsave(>lock, flags);
-   t = mtk_gpio_r32(rg, GPIO_REG_CTRL);
-   t |= BIT(offset);
-   mtk_gpio_w32(rg, GPIO_REG_CTRL, t);
-   mediatek_gpio_set(chip, offset, value);
-   spin_unlock_irqrestore(>lock, flags);
-
-   return 0;
-}
-
-static int
-mediatek_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
-{
-   struct mtk_gc *rg = to_mediatek_gpio(chip);
-   u32 t = mtk_gpio_r32(rg, GPIO_REG_CTRL);
-
- 

[PATCH] Staging: comedi: ssv_dnp: Remove unnecessary comment

2018-06-14 Thread Javier Martinez
Removal of a comment that was not needed at all.
We can clearly see that they are include/header files.

Signed-off-by: Javier Martinez 
---
 drivers/staging/comedi/drivers/ssv_dnp.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c 
b/drivers/staging/comedi/drivers/ssv_dnp.c
index 0628060e42ca..50de018ab9bb 100644
--- a/drivers/staging/comedi/drivers/ssv_dnp.c
+++ b/drivers/staging/comedi/drivers/ssv_dnp.c
@@ -16,7 +16,6 @@
  * Status: unknown
  */
 
-/* include files --- */
 
 #include 
 #include "../comedidev.h"
-- 
2.17.1

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


Re: [PATCH v3 04/27] docs: fix broken references with multiple hints

2018-06-14 Thread Steven Rostedt
On Thu, 14 Jun 2018 13:08:49 -0300
Mauro Carvalho Chehab  wrote:

> +++ b/Documentation/trace/events.rst
> @@ -8,7 +8,7 @@ Event Tracing
>  1. Introduction
>  ===
>  
> -Tracepoints (see Documentation/trace/tracepoints.txt) can be used
> +Tracepoints (see Documentation/trace/tracepoints.rst) can be used
>  without creating custom kernel modules to register probe functions
>  using the event tracing infrastructure.
>  
> diff --git a/Documentation/trace/tracepoint-analysis.rst 
> b/Documentation/trace/tracepoint-analysis.rst
> index a4d3ff2e5efb..bef37abf4ad3 100644
> --- a/Documentation/trace/tracepoint-analysis.rst
> +++ b/Documentation/trace/tracepoint-analysis.rst
> @@ -6,7 +6,7 @@ Notes on Analysing Behaviour Using Events and Tracepoints
>  1. Introduction
>  ===
>  
> -Tracepoints (see Documentation/trace/tracepoints.txt) can be used without
> +Tracepoints (see Documentation/trace/tracepoints.rst) can be used without
>  creating custom kernel modules to register probe functions using the event
>  tracing infrastructure.
>  

Acked-by: Steven Rostedt (VMware) 

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


Re: [PATCH 2/2] dt-bindings: document gpio-mt7621 bindings

2018-06-14 Thread Sergio Paracuellos
On Thu, Jun 14, 2018 at 4:17 PM, Linus Walleij  wrote:
> On Thu, Jun 14, 2018 at 6:45 AM, Sergio Paracuellos
>  wrote:
>
>> Ok, so... does the following single node sounds acceptable?
>>
>> gpio: gpio@600 {
>>   #gpio-cells = <2>;
>>   #interrupt-cells = <2>;
>>   compatible = "mediatek,mt7621-gpio";
>>   gpio-controller;
>>   interrupt-controller;
>>   reg = <0x600 0x60>;
>>   interrupt-parent = <>;
>>   interrupts = ;
>>   mediatek,gpio-bank-widths = <32 32 32>;
>
> Why would you need this? It is pretty obvious from the
> compatible string isn't it? Just use that to tell that
> "aha, it is mediatek,mt7321-gpio, so it has 3x32 GPIOs
> indexed from 0..95".
>
> No need of overspecifying stuff.

Ok, So just one node with no extra stuff.

gpio: gpio@600 {
   #gpio-cells = <2>;
   #interrupt-cells = <2>;
   compatible = "mediatek,mt7621-gpio";
   gpio-controller;
   interrupt-controller;
   reg = <0x600 0x60>;
   interrupt-parent = <>;
   interrupts = ;

Thanks for your answers!

>
> Yours,
> Linus Walleij

Best regards,
Sergio Paracuellos
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4] staging: comedi: Improved readability of function comedi_nsamples_left.

2018-06-14 Thread Chris Opperman
Hi Ian/Dan,

In that case I'll stick to the cut-off line format in future. Thanks!

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


Re: [PATCH v5] staging: comedi: Improved readability of function comedi_nsamples_left.

2018-06-14 Thread Chris Opperman
Hi Ian,

Thank you! Are there any more steps for me to take to complete this
patch process?

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


[PATCH v3 05/27] docs: Fix some broken references

2018-06-14 Thread Mauro Carvalho Chehab
As we move stuff around, some doc references are broken. Fix some of
them via this script:
./scripts/documentation-file-ref-check --fix

Manually checked if the produced result is valid, removing a few
false-positives.

Acked-by: Takashi Iwai 
Acked-by: Masami Hiramatsu 
Acked-by: Stephen Boyd 
Acked-by: Charles Keepax 
Acked-by: Mathieu Poirier 
Signed-off-by: Mauro Carvalho Chehab 
---
 .../admin-guide/kernel-parameters.txt |  4 ++--
 .../bindings/input/rotary-encoder.txt |  2 +-
 Documentation/driver-api/gpio/consumer.rst|  2 +-
 Documentation/kprobes.txt |  4 ++--
 Documentation/trace/coresight.txt |  2 +-
 Documentation/trace/ftrace-uses.rst   |  2 +-
 Documentation/trace/histogram.txt |  2 +-
 Documentation/trace/intel_th.rst  |  2 +-
 Documentation/trace/tracepoint-analysis.rst   |  6 +++---
 Documentation/translations/ja_JP/howto.rst|  4 ++--
 .../translations/zh_CN/magic-number.txt   |  4 ++--
 .../zh_CN/video4linux/omap3isp.txt|  4 ++--
 MAINTAINERS   | 20 +--
 arch/Kconfig  |  2 +-
 arch/arm/include/asm/cacheflush.h |  2 +-
 arch/arm64/include/asm/cacheflush.h   |  2 +-
 arch/microblaze/include/asm/cacheflush.h  |  2 +-
 arch/um/Kconfig.um|  2 +-
 arch/unicore32/include/asm/cacheflush.h   |  2 +-
 arch/x86/entry/vsyscall/vsyscall_64.c |  2 +-
 arch/xtensa/include/asm/cacheflush.h  |  4 ++--
 block/Kconfig |  2 +-
 certs/Kconfig |  2 +-
 crypto/asymmetric_keys/asymmetric_type.c  |  2 +-
 crypto/asymmetric_keys/signature.c|  2 +-
 drivers/char/Kconfig  |  2 +-
 drivers/clk/clk.c |  4 ++--
 drivers/clk/ingenic/cgu.h |  2 +-
 drivers/gpu/vga/Kconfig   |  2 +-
 drivers/gpu/vga/vgaarb.c  |  2 +-
 drivers/input/joystick/Kconfig| 10 +-
 drivers/input/joystick/walkera0701.c  |  2 +-
 drivers/input/misc/Kconfig|  4 ++--
 drivers/input/misc/rotary_encoder.c   |  2 +-
 drivers/input/mouse/Kconfig   |  6 +++---
 drivers/input/mouse/alps.c|  2 +-
 drivers/input/touchscreen/wm97xx-core.c   |  2 +-
 drivers/lightnvm/pblk-rb.c|  2 +-
 drivers/md/bcache/Kconfig |  2 +-
 drivers/md/bcache/btree.c |  2 +-
 drivers/md/bcache/extents.c   |  2 +-
 drivers/media/dvb-core/dvb_ringbuffer.c   |  2 +-
 drivers/media/pci/meye/Kconfig|  2 +-
 drivers/media/platform/pxa_camera.c   |  4 ++--
 .../soc_camera/sh_mobile_ceu_camera.c |  2 +-
 drivers/media/radio/Kconfig   |  2 +-
 drivers/media/radio/si470x/Kconfig|  2 +-
 drivers/media/usb/dvb-usb-v2/lmedm04.c|  2 +-
 drivers/media/usb/zr364xx/Kconfig |  2 +-
 drivers/parport/Kconfig   |  6 +++---
 drivers/staging/media/bcm2048/TODO|  2 +-
 include/keys/asymmetric-subtype.h |  2 +-
 include/keys/asymmetric-type.h|  2 +-
 include/linux/assoc_array.h   |  2 +-
 include/linux/assoc_array_priv.h  |  2 +-
 include/linux/circ_buf.h  |  2 +-
 include/linux/ftrace.h|  2 +-
 include/linux/rculist_nulls.h |  2 +-
 include/uapi/linux/prctl.h|  2 +-
 include/xen/interface/io/kbdif.h  |  2 +-
 kernel/cgroup/cpuset.c|  2 +-
 kernel/trace/Kconfig  | 16 +++
 lib/Kconfig   |  2 +-
 security/selinux/hooks.c  |  2 +-
 sound/core/Kconfig|  4 ++--
 sound/drivers/Kconfig |  4 ++--
 sound/pci/Kconfig | 10 +-
 tools/include/uapi/linux/prctl.h  |  2 +-
 tools/lib/api/fs/fs.c |  2 +-
 tools/perf/util/bpf-prologue.c|  2 +-
 .../config/custom-timeline-functions.cfg  |  4 ++--
 71 files changed, 113 insertions(+), 113 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt 
b/Documentation/admin-guide/kernel-parameters.txt
index 638342d0a095..6fa3f31ed2a5 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -4335,7 +4335,7 @@
[FTRACE] Set and start specified trace events in order
to facilitate early boot debugging. The event-list is a
comma separated list of trace events to enable. See
-   also 

[PATCH v3 08/27] media: v4l: fix broken video4linux docs locations

2018-06-14 Thread Mauro Carvalho Chehab
There are several places pointing to old documentation files:

  Documentation/video4linux/API.html
  Documentation/video4linux/bttv/
  Documentation/video4linux/cx2341x/fw-encoder-api.txt
  Documentation/video4linux/m5602.txt
  Documentation/video4linux/v4l2-framework.txt
  Documentation/video4linux/videobuf
  Documentation/video4linux/Zoran

Make them point to the new location where available, removing
otherwise.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../translations/zh_CN/video4linux/v4l2-framework.txt  |  6 +++---
 drivers/media/pci/bt8xx/Kconfig|  2 +-
 drivers/media/pci/cx18/cx18-streams.c  |  4 ++--
 drivers/media/radio/Kconfig| 10 +-
 drivers/media/radio/wl128x/Kconfig |  2 +-
 drivers/media/usb/gspca/m5602/Kconfig  |  2 --
 drivers/staging/media/zoran/Kconfig|  2 +-
 7 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt 
b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt
index c77c0f060864..66c7c568bd86 100644
--- a/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt
+++ b/Documentation/translations/zh_CN/video4linux/v4l2-framework.txt
@@ -1,4 +1,4 @@
-Chinese translated version of Documentation/video4linux/v4l2-framework.txt
+Chinese translated version of Documentation/media/media_kapi.rst
 
 If you have any comment or update to the content, please contact the
 original document maintainer directly.  However, if you have a problem
@@ -9,7 +9,7 @@ or if there is a problem with the translation.
 Maintainer: Mauro Carvalho Chehab 
 Chinese maintainer: Fu Wei 
 -
-Documentation/video4linux/v4l2-framework.txt 的中文翻译
+Documentation/media/media_kapi.rst 的中文翻译
 
 如果想评论或更新本文的内容,请直接联系原文档的维护者。如果你使用英文
 交流有困难的话,也可以向中文版维护者求助。如果本翻译更新不及时或者翻
@@ -777,7 +777,7 @@ v4l2 核心 API 提供了一个处理视频缓冲的标准方法(称为“videob
 线性 DMA(videobuf-dma-contig)以及大多用于 USB 设备的用 vmalloc
 分配的缓冲(videobuf-vmalloc)。
 
-请参阅 Documentation/video4linux/videobuf,以获得更多关于 videobuf
+请参阅 Documentation/media/kapi/v4l2-videobuf.rst,以获得更多关于 videobuf
 层的使用信息。
 
 v4l2_fh 结构体
diff --git a/drivers/media/pci/bt8xx/Kconfig b/drivers/media/pci/bt8xx/Kconfig
index 4a93f6ded100..bc89e37608cd 100644
--- a/drivers/media/pci/bt8xx/Kconfig
+++ b/drivers/media/pci/bt8xx/Kconfig
@@ -16,7 +16,7 @@ config VIDEO_BT848
---help---
  Support for BT848 based frame grabber/overlay boards. This includes
  the Miro, Hauppauge and STB boards. Please read the material in
-  for more information.
+  for more information.
 
  To compile this driver as a module, choose M here: the
  module will be called bttv.
diff --git a/drivers/media/pci/cx18/cx18-streams.c 
b/drivers/media/pci/cx18/cx18-streams.c
index a594cfdeca20..b36f4ce25d22 100644
--- a/drivers/media/pci/cx18/cx18-streams.c
+++ b/drivers/media/pci/cx18/cx18-streams.c
@@ -853,7 +853,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
 
/*
 * Audio related reset according to
-* Documentation/video4linux/cx2341x/fw-encoder-api.txt
+* Documentation/media/v4l-drivers/cx2341x.rst
 */
if (atomic_read(>ana_capturing) == 0)
cx18_vapi(cx, CX18_CPU_SET_MISC_PARAMETERS, 2,
@@ -861,7 +861,7 @@ int cx18_start_v4l2_encode_stream(struct cx18_stream *s)
 
/*
 * Number of lines for Field 1 & Field 2 according to
-* Documentation/video4linux/cx2341x/fw-encoder-api.txt
+* Documentation/media/v4l-drivers/cx2341x.rst
 * Field 1 is 312 for 625 line systems in BT.656
 * Field 2 is 313 for 625 line systems in BT.656
 */
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index b426d6f9787d..9b99dfb2d0c6 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -35,7 +35,7 @@ config RADIO_SI476X
  In order to control your radio card, you will need to use programs
  that are compatible with the Video For Linux 2 API.  Information on
  this API and pointers to "v4l2" programs may be found at
- .
+ .
 
  To compile this driver as a module, choose M here: the
  module will be called radio-si476x.
@@ -75,7 +75,7 @@ config RADIO_MAXIRADIO
  In order to control your radio card, you will need to use programs
  that are compatible with the Video For Linux API.  Information on
  this API and pointers to "v4l" programs may be found at
- .
+ .
 
  To compile this driver as a module, choose M here: the
  module will be called radio-maxiradio.
@@ -93,7 +93,7 @@ config RADIO_SHARK
  In order to control your radio card, you 

[PATCH v3 04/27] docs: fix broken references with multiple hints

2018-06-14 Thread Mauro Carvalho Chehab
The script:
./scripts/documentation-file-ref-check --fix-rst

Gives multiple hints for broken references on some files.
Manually use the one that applies for some files.

Signed-off-by: Mauro Carvalho Chehab 
---
 Documentation/ABI/obsolete/sysfs-gpio | 2 +-
 .../devicetree/bindings/display/bridge/tda998x.txt| 2 +-
 Documentation/trace/events.rst| 2 +-
 Documentation/trace/tracepoint-analysis.rst   | 2 +-
 Documentation/translations/zh_CN/SubmittingDrivers| 2 +-
 Documentation/translations/zh_CN/gpio.txt | 4 ++--
 MAINTAINERS   | 2 +-
 drivers/hid/usbhid/Kconfig| 2 +-
 drivers/input/Kconfig | 4 ++--
 drivers/input/joystick/Kconfig| 4 ++--
 drivers/input/joystick/iforce/Kconfig | 4 ++--
 drivers/input/serio/Kconfig   | 4 ++--
 drivers/staging/fsl-mc/bus/dpio/dpio-driver.txt   | 2 +-
 drivers/video/fbdev/skeletonfb.c  | 8 
 include/linux/tracepoint.h| 2 +-
 security/device_cgroup.c  | 2 +-
 16 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/Documentation/ABI/obsolete/sysfs-gpio 
b/Documentation/ABI/obsolete/sysfs-gpio
index 32513dc2eec9..40d41ea1a3f5 100644
--- a/Documentation/ABI/obsolete/sysfs-gpio
+++ b/Documentation/ABI/obsolete/sysfs-gpio
@@ -11,7 +11,7 @@ Description:
   Kernel code may export it for complete or partial access.
 
   GPIOs are identified as they are inside the kernel, using integers in
-  the range 0..INT_MAX.  See Documentation/gpio/gpio.txt for more information.
+  the range 0..INT_MAX.  See Documentation/gpio for more information.
 
 /sys/class/gpio
/export ... asks the kernel to export a GPIO to userspace
diff --git a/Documentation/devicetree/bindings/display/bridge/tda998x.txt 
b/Documentation/devicetree/bindings/display/bridge/tda998x.txt
index 1a4eaca40d94..f5a02f61dd36 100644
--- a/Documentation/devicetree/bindings/display/bridge/tda998x.txt
+++ b/Documentation/devicetree/bindings/display/bridge/tda998x.txt
@@ -30,7 +30,7 @@ Optional properties:
   - nxp,calib-gpios: calibration GPIO, which must correspond with the
gpio used for the TDA998x interrupt pin.
 
-[1] Documentation/sound/alsa/soc/DAI.txt
+[1] Documentation/sound/soc/dai.rst
 [2] include/dt-bindings/display/tda998x.h
 
 Example:
diff --git a/Documentation/trace/events.rst b/Documentation/trace/events.rst
index 1afae55dc55c..696dc69b8158 100644
--- a/Documentation/trace/events.rst
+++ b/Documentation/trace/events.rst
@@ -8,7 +8,7 @@ Event Tracing
 1. Introduction
 ===
 
-Tracepoints (see Documentation/trace/tracepoints.txt) can be used
+Tracepoints (see Documentation/trace/tracepoints.rst) can be used
 without creating custom kernel modules to register probe functions
 using the event tracing infrastructure.
 
diff --git a/Documentation/trace/tracepoint-analysis.rst 
b/Documentation/trace/tracepoint-analysis.rst
index a4d3ff2e5efb..bef37abf4ad3 100644
--- a/Documentation/trace/tracepoint-analysis.rst
+++ b/Documentation/trace/tracepoint-analysis.rst
@@ -6,7 +6,7 @@ Notes on Analysing Behaviour Using Events and Tracepoints
 1. Introduction
 ===
 
-Tracepoints (see Documentation/trace/tracepoints.txt) can be used without
+Tracepoints (see Documentation/trace/tracepoints.rst) can be used without
 creating custom kernel modules to register probe functions using the event
 tracing infrastructure.
 
diff --git a/Documentation/translations/zh_CN/SubmittingDrivers 
b/Documentation/translations/zh_CN/SubmittingDrivers
index 929385e4b194..15e73562f710 100644
--- a/Documentation/translations/zh_CN/SubmittingDrivers
+++ b/Documentation/translations/zh_CN/SubmittingDrivers
@@ -107,7 +107,7 @@ Linux 2.6:
程序测试的指导,请参阅
Documentation/power/drivers-testing.txt。有关驱动程序电
源管理问题相对全面的概述,请参阅
-   Documentation/power/admin-guide/devices.rst。
+   Documentation/driver-api/pm/devices.rst。
 
 管理:如果一个驱动程序的作者还在进行有效的维护,那么通常除了那
些明显正确且不需要任何检查的补丁以外,其他所有的补丁都会
diff --git a/Documentation/translations/zh_CN/gpio.txt 
b/Documentation/translations/zh_CN/gpio.txt
index 4f8bf30a41dc..4cb1ba8b8fed 100644
--- a/Documentation/translations/zh_CN/gpio.txt
+++ b/Documentation/translations/zh_CN/gpio.txt
@@ -1,4 +1,4 @@
-Chinese translated version of Documentation/gpio.txt
+Chinese translated version of Documentation/gpio
 
 If you have any comment or update to the content, please contact the
 original document maintainer directly.  However, if you have a problem
@@ -10,7 +10,7 @@ Maintainer: Grant Likely 
Linus Walleij 
 Chinese maintainer: Fu Wei 
 

[PATCH 3/3] ds2490.c: Move struct open braces to previous line

2018-06-14 Thread Henriette Hofmeier
Move open braces of two structs to the declaration line,
as criticized by checkpatch.

Signed-off-by: Henriette Hofmeier 
Signed-off-by: Florian Harbecke 
---
 drivers/w1/masters/ds2490.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 1e4b243..0f4ecfc 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -134,8 +134,7 @@
 #define EP_DATA_OUT2
 #define EP_DATA_IN 3
 
-struct ds_device
-{
+struct ds_device {
struct list_headds_entry;
 
struct usb_device   *udev;
@@ -158,8 +157,7 @@ struct ds_device
struct w1_bus_mastermaster;
 };
 
-struct ds_status
-{
+struct ds_status {
u8  enable;
u8  speed;
u8  pullup_dur;
-- 
2.7.4

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


[PATCH 0/3] drivers/w1/masters/ds2490: Correct errors reported by checkpatch

2018-06-14 Thread Henriette Hofmeier
Remove unnecessary spaces, add required spaced and 
move braces to fix errors reported by checkpatch.

Henriette Hofmeier (3):
  ds2490.c: Add required spaces
  ds2490.c: Remove unnecessary whitespace
  ds2490.c: Move struct open braces to previous line

 drivers/w1/masters/ds2490.c | 16 +++-
 1 file changed, 7 insertions(+), 9 deletions(-)

-- 
2.7.4

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


[PATCH 1/3] ds2490.c: Add required spaces

2018-06-14 Thread Henriette Hofmeier
Add missing spaces in for- and while-loops
reported missing by checkpatch.

Signed-off-by: Henriette Hofmeier 
Signed-off-by: Florian Harbecke 
---
 drivers/w1/masters/ds2490.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index c423bdb..917a5f1 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -236,7 +236,7 @@ static void ds_dump_status(struct ds_device *dev, unsigned 
char *buf, int count)
int i;
 
pr_info("0x%x: count=%d, status: ", dev->ep[EP_STATUS], count);
-   for (i=0; i= 0) {
int i;
printk("0x%x: count=%d, status: ", dev->ep[EP_STATUS], 
err);
-   for (i=0; ist_buf[i]);
printk("\n");
}
-- 
2.7.4

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


[PATCH 2/3] ds2490.c: Remove unnecessary whitespace

2018-06-14 Thread Henriette Hofmeier
Remove unnecessary whitespace criticized by
checkpatch.

Signed-off-by: Henriette Hofmeier 
Signed-off-by: Florian Harbecke 
---
 drivers/w1/masters/ds2490.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/w1/masters/ds2490.c b/drivers/w1/masters/ds2490.c
index 917a5f1..1e4b243 100644
--- a/drivers/w1/masters/ds2490.c
+++ b/drivers/w1/masters/ds2490.c
@@ -613,7 +613,7 @@ static int ds_read_byte(struct ds_device *dev, u8 *byte)
int err;
struct ds_status st;
 
-   err = ds_send_control(dev, COMM_BYTE_IO | COMM_IM , 0xff);
+   err = ds_send_control(dev, COMM_BYTE_IO | COMM_IM, 0xff);
if (err)
return err;
 
-- 
2.7.4

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


Re: [PATCH 2/2] dt-bindings: document gpio-mt7621 bindings

2018-06-14 Thread Linus Walleij
On Thu, Jun 14, 2018 at 4:33 PM, Rob Herring  wrote:
> On Thu, Jun 14, 2018 at 8:14 AM, Linus Walleij  
> wrote:
>> On Wed, Jun 13, 2018 at 9:28 PM, Rob Herring  wrote:
>>
 "Some system-on-chips (SoCs) use the concept of GPIO banks. ...
 Usually each such bank is
 exposed in the device tree as an individual gpio-controller node. ..."
>>>
>>> This should be conditioned on being able to divide up the registers by
>>> bank which seems like you can't. Or there's the case like the DW GPIO
>>> block and the number of banks is configurable.
>>
>> If it is possible to create one device per bank I usually prefer that
>> approach, as it also (often) makes it possible to use the
>> generic GPIO library, i.e. the hardware abstraction start to
>> share more with other GPIO controllers.
>
> But that should be possible whether there are banks in DT or not, right?

Possible yes, but more complex, requireing a bigger and more complex
chunk of code to get it right. Which we don't have for Linux (I don't know
about $OS).

For 1 bank = 1 device, all callbacks etc naturally offsets to something
like 0..31 landing in (1 << offset) which makes for a simple support library.

If there is more complex calculations, more complex helper libs are
required and maybe not even worth it, ending up with more duplicated
or slightly-different code.

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


Re: [PATCH 2/2] dt-bindings: document gpio-mt7621 bindings

2018-06-14 Thread Rob Herring
On Thu, Jun 14, 2018 at 8:14 AM, Linus Walleij  wrote:
> On Wed, Jun 13, 2018 at 9:28 PM, Rob Herring  wrote:
>
>>> "Some system-on-chips (SoCs) use the concept of GPIO banks. ...
>>> Usually each such bank is
>>> exposed in the device tree as an individual gpio-controller node. ..."
>>
>> This should be conditioned on being able to divide up the registers by
>> bank which seems like you can't. Or there's the case like the DW GPIO
>> block and the number of banks is configurable.
>
> If it is possible to create one device per bank I usually prefer that
> approach, as it also (often) makes it possible to use the
> generic GPIO library, i.e. the hardware abstraction start to
> share more with other GPIO controllers.

But that should be possible whether there are banks in DT or not, right?

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


Re: [PATCH] staging: gdm724x: add error handling for nlmsg_put

2018-06-14 Thread Dan Carpenter
Also I think the email list is rejecting your replies because they're
in html?

regards,
dan carpenter

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


Re: [PATCH 2/2] dt-bindings: document gpio-mt7621 bindings

2018-06-14 Thread Linus Walleij
On Thu, Jun 14, 2018 at 6:45 AM, Sergio Paracuellos
 wrote:

> Ok, so... does the following single node sounds acceptable?
>
> gpio: gpio@600 {
>   #gpio-cells = <2>;
>   #interrupt-cells = <2>;
>   compatible = "mediatek,mt7621-gpio";
>   gpio-controller;
>   interrupt-controller;
>   reg = <0x600 0x60>;
>   interrupt-parent = <>;
>   interrupts = ;
>   mediatek,gpio-bank-widths = <32 32 32>;

Why would you need this? It is pretty obvious from the
compatible string isn't it? Just use that to tell that
"aha, it is mediatek,mt7321-gpio, so it has 3x32 GPIOs
indexed from 0..95".

No need of overspecifying stuff.

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


Re: [PATCH 2/2] dt-bindings: document gpio-mt7621 bindings

2018-06-14 Thread Linus Walleij
On Wed, Jun 13, 2018 at 9:28 PM, Rob Herring  wrote:

>> "Some system-on-chips (SoCs) use the concept of GPIO banks. ...
>> Usually each such bank is
>> exposed in the device tree as an individual gpio-controller node. ..."
>
> This should be conditioned on being able to divide up the registers by
> bank which seems like you can't. Or there's the case like the DW GPIO
> block and the number of banks is configurable.

If it is possible to create one device per bank I usually prefer that
approach, as it also (often) makes it possible to use the
generic GPIO library, i.e. the hardware abstraction start to
share more with other GPIO controllers.

>> If this is not a good approach, could you please me point me out to a
>> device tree example where
>> the correct approach is being used?
>
> I'm not sure offhand. There are lots of examples of single nodes I'm
> sure. Which ones have banks I haven't a clue. IIRC, there were some
> cases where the bank # was part of the GPIO cells, but I seem to
> recall Linus prefers not having 3 cells.

I don't like 3 cells, stuff is complicated enough as it is already.

Better in that case to concatenate the offsets and instead of
having an extra cell 0, 1 and offsets 0-31, 0-31
have two cells and offsets 0-63.

My reasoning is that since it is represented by a single device
we are indexing into that one device from 0-n.

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


Re: [PATCH] staging: gdm724x: add error handling for nlmsg_put

2018-06-14 Thread Dan Carpenter
On Thu, Jun 14, 2018 at 11:27:26AM +0800, Zhouyang Jia wrote:
> Hi,
> 
> I reported this bug since more than 95% callsites of nlmsg_put are
> well handled in kernel, and many of them also allocated skb before.
> 

That's probably true, but the NULL check is not required *here*.

Just mark it as a false positive in your tool and move on...  It's not
like we are close to running out of real bugs to deal with.

regards,
dan carpenter

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


Re: [PATCH v2] staging: gdm724x: add error handling for nlmsg_put

2018-06-14 Thread Dan Carpenter
On Thu, Jun 14, 2018 at 07:31:51PM +0800, Zhouyang Jia wrote:
> When nlmsg_put fails, the lack of error-handling code may
> cause unexpected results.
> 
> This patch adds error-handling code after calling nlmsg_put.
> 
> Signed-off-by: Zhouyang Jia 
> ---
> v1->v2:
> - Add some cleanup
> ---
>  drivers/staging/gdm724x/netlink_k.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/staging/gdm724x/netlink_k.c 
> b/drivers/staging/gdm724x/netlink_k.c
> index abe2425..16da03b 100644
> --- a/drivers/staging/gdm724x/netlink_k.c
> +++ b/drivers/staging/gdm724x/netlink_k.c
> @@ -119,6 +119,11 @@ int netlink_send(struct sock *sock, int group, u16 type, 
> void *msg, int len)
>   seq++;
>  
>   nlh = nlmsg_put(skb, 0, seq, type, len, 0);
> + if (!nlh) {
> + kfree_skb(skb);
> + return -EMSGSIZE;
> + }

As I mentioned earlier, this patch is not required because the we just
allocated the skb and we know that it is large enough.

regards,
dan carpenter


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


Re: [PATCH v4] staging: pi433: fix race condition in pi433_ioctl

2018-06-14 Thread Dan Carpenter
Perfect.  Thanks!

regards,
dan carpenter


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


Re: [PATCH] Staging: comedi: ssv_dnp: fixed style line length warning

2018-06-14 Thread Dan Carpenter
On Wed, Jun 13, 2018 at 03:01:08PM -0400, Javier Martinez wrote:
> Fixed style line length warning detected by checkpatch.pl in the file
> ssv_dnp.c.
> 
> Signed-off-by: Javier Martinez 
> ---
>  drivers/staging/comedi/drivers/ssv_dnp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c 
> b/drivers/staging/comedi/drivers/ssv_dnp.c
> index 0628060e42ca..87f46e0eb9ee 100644
> --- a/drivers/staging/comedi/drivers/ssv_dnp.c
> +++ b/drivers/staging/comedi/drivers/ssv_dnp.c
> @@ -16,7 +16,7 @@
>   * Status: unknown
>   */
>  
> -/* include files --- 
> */
> +/* include files -- */

Just delete the line.  It's not useful.

regards,
dan carpenter


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


[PATCH v2 5/5] staging: use BIT_ULL for NL80211_STA_INFO_* attribute types

2018-06-14 Thread Omer Efrat
Since 'filled' member in station_info changed to u64, BIT_ULL macro
should be used with NL80211_STA_INFO_* attribute types instead of BIT.

The BIT macro uses unsigned long type which some architectures handle as 32bit
and this results in compilation warnings such as:

net/mac80211/sta_info.c:2223:2: warning: left shift count >= width of type
  sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
  ^

Signed-off-by: Omer Efrat 
---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 10 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 14 +++---
 drivers/staging/wlan-ng/cfg80211.c|  4 ++--
 3 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c 
b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
index 46bc2e5..d0c5dbd 100644
--- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
@@ -1281,16 +1281,16 @@ static int cfg80211_rtw_get_station(struct wiphy *wiphy,
goto exit;
}
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
sinfo->signal = 
translate_percentage_to_dbm(padapter->recvpriv.signal_strength);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
sinfo->txrate.legacy = rtw_get_cur_max_rate(padapter);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_RX_PACKETS);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_RX_PACKETS);
sinfo->rx_packets = sta_rx_data_pkts(psta);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_PACKETS);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_PACKETS);
sinfo->tx_packets = psta->sta_stats.tx_pkts;
 
}
@@ -3021,7 +3021,7 @@ static intcfg80211_rtw_dump_station(struct wiphy 
*wiphy, struct net_device *nde
goto exit;
}
memcpy(mac, psta->hwaddr, ETH_ALEN);
-   sinfo->filled = BIT(NL80211_STA_INFO_SIGNAL);
+   sinfo->filled = BIT_ULL(NL80211_STA_INFO_SIGNAL);
sinfo->signal = psta->rssi;
 
 exit:
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 730d64f..830b48c 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1184,7 +1184,7 @@ static int get_station(struct wiphy *wiphy, struct 
net_device *dev,
return -ENOENT;
}
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_INACTIVE_TIME);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_INACTIVE_TIME);
 
wilc_get_inactive_time(vif, mac, _time);
sinfo->inactive_time = 1000 * inactive_time;
@@ -1195,11 +1195,11 @@ static int get_station(struct wiphy *wiphy, struct 
net_device *dev,
 
wilc_get_statistics(vif, );
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL) |
-   
BIT(NL80211_STA_INFO_RX_PACKETS) |
-   
BIT(NL80211_STA_INFO_TX_PACKETS) |
-   BIT(NL80211_STA_INFO_TX_FAILED) 
|
-   
BIT(NL80211_STA_INFO_TX_BITRATE);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL) |
+   
BIT_ULL(NL80211_STA_INFO_RX_PACKETS) |
+   
BIT_ULL(NL80211_STA_INFO_TX_PACKETS) |
+   
BIT_ULL(NL80211_STA_INFO_TX_FAILED) |
+   
BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
 
sinfo->signal = stats.rssi;
sinfo->rx_packets = stats.rx_cnt;
@@ -1776,7 +1776,7 @@ static int dump_station(struct wiphy *wiphy, struct 
net_device *dev,
priv = wiphy_priv(wiphy);
vif = netdev_priv(priv->dev);
 
-   sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_SIGNAL);
 
wilc_get_rssi(vif, >signal);
 
diff --git a/drivers/staging/wlan-ng/cfg80211.c 
b/drivers/staging/wlan-ng/cfg80211.c
index 4291225..07c52e3 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -282,9 +282,9 @@ static int prism2_get_station(struct wiphy *wiphy, struct 
net_device *dev,
 
if (result == 0) {
sinfo->txrate.legacy = quality.txrate.data;
-   sinfo->filled |= BIT(NL80211_STA_INFO_TX_BITRATE);
+   sinfo->filled |= BIT_ULL(NL80211_STA_INFO_TX_BITRATE);
sinfo->signal = quality.level.data;
-   sinfo->filled |= BIT(NL80211_STA_INFO_SIGNAL);
+   sinfo->filled |= 

Re: [PATCH v3] staging: pi433: fix race condition in pi433_ioctl

2018-06-14 Thread Hugo Lefeuvre
> Thank you for the patch! Yet something to improve:
> 
> [auto build test ERROR on staging/staging-testing]
> [also build test ERROR on v4.17 next-20180613]
> [if your patch is applied to the wrong git tree, please drop us a note to 
> help improve the system]

Already fixed in v4. Sorry for the noise.

-- 
 Hugo Lefeuvre (hle)|www.owl.eu.com
4096/ 9C4F C8BF A4B0 8FC5 48EB 56B8 1962 765B B9A8 BACA


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


Re: [PATCH v2 5/5] staging: use BIT_ULL for NL80211_STA_INFO_* attribute types

2018-06-14 Thread Johannes Berg
On Thu, 2018-06-14 at 13:13 +0300, Omer Efrat wrote:
> Since 'filled' member in station_info changed to u64, BIT_ULL macro
> should be used with NL80211_STA_INFO_* attribute types instead of BIT.
> 
> The BIT macro uses unsigned long type which some architectures handle as 32bit
> and this results in compilation warnings such as:
> 
> net/mac80211/sta_info.c:2223:2: warning: left shift count >= width of type
>   sinfo->filled |= BIT(NL80211_STA_INFO_TID_STATS);
>   ^

Same here, I don't think this patch is really needed, but I'll leave it
up to Greg.

Greg, FWIW, only a few values are >=31 to need this, including the one
pointed out in the commit message, but none in this code are affected.

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


[PATCH v2] staging: gdm724x: add error handling for nlmsg_put

2018-06-14 Thread Zhouyang Jia
When nlmsg_put fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling nlmsg_put.

Signed-off-by: Zhouyang Jia 
---
v1->v2:
- Add some cleanup
---
 drivers/staging/gdm724x/netlink_k.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/gdm724x/netlink_k.c 
b/drivers/staging/gdm724x/netlink_k.c
index abe2425..16da03b 100644
--- a/drivers/staging/gdm724x/netlink_k.c
+++ b/drivers/staging/gdm724x/netlink_k.c
@@ -119,6 +119,11 @@ int netlink_send(struct sock *sock, int group, u16 type, 
void *msg, int len)
seq++;
 
nlh = nlmsg_put(skb, 0, seq, type, len, 0);
+   if (!nlh) {
+   kfree_skb(skb);
+   return -EMSGSIZE;
+   }
+
memcpy(NLMSG_DATA(nlh), msg, len);
NETLINK_CB(skb).portid = 0;
NETLINK_CB(skb).dst_group = 0;
-- 
2.7.4

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


Re: [PATCH] Staging: comedi: ssv_dnp: fixed style line length warning

2018-06-14 Thread Ian Abbott

On 13/06/18 20:01, Javier Martinez wrote:

Fixed style line length warning detected by checkpatch.pl in the file
ssv_dnp.c.

Signed-off-by: Javier Martinez 
---
  drivers/staging/comedi/drivers/ssv_dnp.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ssv_dnp.c 
b/drivers/staging/comedi/drivers/ssv_dnp.c
index 0628060e42ca..87f46e0eb9ee 100644
--- a/drivers/staging/comedi/drivers/ssv_dnp.c
+++ b/drivers/staging/comedi/drivers/ssv_dnp.c
@@ -16,7 +16,7 @@
   * Status: unknown
   */
  
-/* include files --- */

+/* include files -- */
  
  #include 

  #include "../comedidev.h"



I cannot reproduce the checkpatch.pl warning.  The line is only 79 
columns wide.


--
-=( Ian Abbott  || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:)=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [lustre-devel] [PATCH v3] staging: lustre: Change return type to vm_fault_t

2018-06-14 Thread Souptick Joarder
On Thu, Jun 14, 2018 at 12:59 PM, NeilBrown  wrote:
> On Tue, Jun 12 2018, Souptick Joarder wrote:
>
>> On 12-Jun-2018 2:21 AM, "Greg KH"  wrote:
>>>
>>> On Tue, Jun 12, 2018 at 02:00:47AM +0530, Souptick Joarder wrote:
>>> > On Mon, May 21, 2018 at 11:39 PM, Souptick Joarder 
>>> >
>>> > If no further comment, we would like to get this patch in 4.18-rc-X.
>>>
>>> Why?  Is it a regression fix?  That's all that is allowed after -rc1.
>>
>> No, this is not regression fix. We need to get this into 4.18-rc-1.  But
>> mostly it can't make into linus tree in rc-1 :)
>>>
>>> And have you tried applying it to Linus's current tree?  :)
>>
>> Last tested on 4.17-rc-6 and it worked fine. Let me verify in current tree.
>>
>
> As you have undoubtedly noticed, lustre is no longer in Linus' tree.
> I'm experimenting with maintaining a branch which retains the code
> (lustre/* in github.com/neilbrown/linux) so we can get it ready for
> merging properly.
> I've added you patch to my tree.

You need to add this patch in your tree as well.
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?h=next-20180614=1c8f422059ae5da07db7406ab916203f9417e396

This patch appears to be missing in your github branch.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v4] staging: comedi: Improved readability of function comedi_nsamples_left.

2018-06-14 Thread Ian Abbott

On 13/06/18 20:05, Dan Carpenter wrote:

On Wed, Jun 13, 2018 at 08:26:43PM +0200, Chris Opperman wrote:

Hi Dan/Ian,

Noted your comments regarding additional text, thanks! Just curious whether
the "scissors" format given at the link below is valid?

https://kernelnewbies.org/PatchTipsAndTricks

It is given as an alternative to placing additional text below the
cut-off line.



Try it yourself.  Save your email as email.txt and then
`cat email.txt | git am` and then review the patch with git log -p.

I've seen people do the scissors thing, but I assume the maintainer has
to hand edit the log which we refuse to do.


It can be done automatically with the git am -c or --scissors option, or 
by setting mailinfo.scissors to true in the git config.  But since the 
use of these special scissors lines is not documented in 
Documentation/process/submitting-patches.rst, I don't think it is safe 
to assume that no manual intervention would be required by the 
maintainer to deal with it.


I wonder where the "scissors" advice on the kernelnewbies page came from?

--
-=( Ian Abbott  || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:)=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: comedi: add error handling for vmap

2018-06-14 Thread Ian Abbott

On 14/06/18 08:57, Zhouyang Jia wrote:

Hi,

I reported this bug since more than 90% callsites of vmap are
well handled in kernel. The caller function __comedi_buf_alloc
has no return value, so I don't know how the error is handled in
its caller.

I believe there would be a better error handling method, but I
have limited domain knowledge, so I'm sorry I can't help here.

Thanks for your kind reply.

Best,
Zhouyang


__comedi_buf_alloc is just a helper function factored out of, and called 
by comedi_buf_alloc.  __comedi_buf_alloc does not clean up after itself 
on error because it expects comedi_buf_alloc to detect the error and 
call __comedi_buf_free to clean up any partially allocated mess:


__comedi_buf_alloc(dev, s, n_pages);
if (!async->prealloc_buf) {
/*
 * [This is not the actual comment in the code!]
 *
 * Error occured in __comedi_buf_alloc().
 * Buffer may be partially allocated.
 * Call __comedi_buf_free() to clean it up.
 */
__comedi_buf_free(dev, s);
return -ENOMEM;
}





2018-06-12 19:50 GMT+08:00 Dan Carpenter >:


On Tue, Jun 12, 2018 at 11:25:35AM +0800, Zhouyang Jia wrote:
> When vmap fails, the lack of error-handling code may
> cause unexpected results.
> 
> This patch adds error-handling code after calling vmap.
> 


Again, this is not error handling, this is just an error message.  This
error condition is handled in the caller.

regards,
dan carpenter






--
-=( Ian Abbott  || Web: www.mev.co.uk )=-
-=( MEV Ltd. is a company registered in England & Wales. )=-
-=( Registered number: 02862268.  Registered address:)=-
-=( 15 West Park Road, Bramhall, STOCKPORT, SK7 3JZ, UK. )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [lustre-devel] [PATCH v3] staging: lustre: Change return type to vm_fault_t

2018-06-14 Thread NeilBrown
On Tue, Jun 12 2018, Souptick Joarder wrote:

> On 12-Jun-2018 2:21 AM, "Greg KH"  wrote:
>>
>> On Tue, Jun 12, 2018 at 02:00:47AM +0530, Souptick Joarder wrote:
>> > On Mon, May 21, 2018 at 11:39 PM, Souptick Joarder 
>> >
>> > If no further comment, we would like to get this patch in 4.18-rc-X.
>>
>> Why?  Is it a regression fix?  That's all that is allowed after -rc1.
>
> No, this is not regression fix. We need to get this into 4.18-rc-1.  But
> mostly it can't make into linus tree in rc-1 :)
>>
>> And have you tried applying it to Linus's current tree?  :)
>
> Last tested on 4.17-rc-6 and it worked fine. Let me verify in current tree.
>

As you have undoubtedly noticed, lustre is no longer in Linus' tree.
I'm experimenting with maintaining a branch which retains the code
(lustre/* in github.com/neilbrown/linux) so we can get it ready for
merging properly.
I've added you patch to my tree.

Thanks,
NeilBrown


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