[PATCH v2] staging: Android: Add 'vsoc' driver for cuttlefish.

2018-04-12 Thread Alistair Strachan
From: Greg Hartman 

The cuttlefish system is a virtual SoC architecture based on QEMU. It
uses the QEMU ivshmem feature to share memory regions between guest and
host with a custom protocol.

Cc: Greg Kroah-Hartman 
Cc: Arve Hjønnevåg 
Cc: Todd Kjos 
Cc: Martijn Coenen 
Cc: Dan Carpenter 
Cc: de...@driverdev.osuosl.org
Cc: kernel-t...@android.com
Signed-off-by: Greg Hartman 
[astrachan: rebased against 4.16, added TODO, fixed checkpatch issues]
Signed-off-by: Alistair Strachan 
---
v2: addressed issues with class_create() failure handling and redundant
null pointer checks noticed by Dan Carpenter

 drivers/staging/android/Kconfig |9 +
 drivers/staging/android/Makefile|1 +
 drivers/staging/android/TODO|   10 +
 drivers/staging/android/uapi/vsoc_shm.h |  303 ++
 drivers/staging/android/vsoc.c  | 1169 +++
 5 files changed, 1492 insertions(+)
 create mode 100644 drivers/staging/android/uapi/vsoc_shm.h
 create mode 100644 drivers/staging/android/vsoc.c

diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig
index 71a50b99caff..29d891355f7a 100644
--- a/drivers/staging/android/Kconfig
+++ b/drivers/staging/android/Kconfig
@@ -14,6 +14,15 @@ config ASHMEM
  It is, in theory, a good memory allocator for low-memory devices,
  because it can discard shared memory units when under memory pressure.
 
+config ANDROID_VSOC
+   tristate "Android Virtual SoC support"
+   default n
+   depends on PCI_MSI
+   ---help---
+ This option adds support for the Virtual SoC driver needed to boot
+ a 'cuttlefish' Android image inside QEmu. The driver interacts with
+ a QEmu ivshmem device. If built as a module, it will be called vsoc.
+
 source "drivers/staging/android/ion/Kconfig"
 
 endif # if ANDROID
diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile
index 7cf1564a49a5..90e6154f11a4 100644
--- a/drivers/staging/android/Makefile
+++ b/drivers/staging/android/Makefile
@@ -3,3 +3,4 @@ ccflags-y += -I$(src)   # needed for trace 
events
 obj-y  += ion/
 
 obj-$(CONFIG_ASHMEM)   += ashmem.o
+obj-$(CONFIG_ANDROID_VSOC) += vsoc.o
diff --git a/drivers/staging/android/TODO b/drivers/staging/android/TODO
index 687e0eac85bf..6aab759efa48 100644
--- a/drivers/staging/android/TODO
+++ b/drivers/staging/android/TODO
@@ -11,5 +11,15 @@ ion/
  - Split /dev/ion up into multiple nodes (e.g. /dev/ion/heap0)
  - Better test framework (integration with VGEM was suggested)
 
+vsoc.c, uapi/vsoc_shm.h
+ - The current driver uses the same wait queue for all of the futexes in a
+   region. This will cause false wakeups in regions with a large number of
+   waiting threads. We should eventually use multiple queues and select the
+   queue based on the region.
+ - Add debugfs support for examining the permissions of regions.
+ - Use ioremap_wc instead of ioremap_nocache.
+ - Remove VSOC_WAIT_FOR_INCOMING_INTERRUPT ioctl. This functionality has been
+   superseded by the futex and is there for legacy reasons.
+
 Please send patches to Greg Kroah-Hartman  and Cc:
 Arve Hjønnevåg  and Riley Andrews 
diff --git a/drivers/staging/android/uapi/vsoc_shm.h 
b/drivers/staging/android/uapi/vsoc_shm.h
new file mode 100644
index ..741b1387c25b
--- /dev/null
+++ b/drivers/staging/android/uapi/vsoc_shm.h
@@ -0,0 +1,303 @@
+/*
+ * Copyright (C) 2017 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _UAPI_LINUX_VSOC_SHM_H
+#define _UAPI_LINUX_VSOC_SHM_H
+
+#include 
+
+/**
+ * A permission is a token that permits a receiver to read and/or write an area
+ * of memory within a Vsoc region.
+ *
+ * An fd_scoped permission grants both read and write access, and can be
+ * attached to a file description (see open(2)).
+ * Ownership of the area can then be shared by passing a file descriptor
+ * among processes.
+ *
+ * begin_offset and end_offset define the area of memory that is controlled by
+ * the permission. owner_offset points to a word, also in shared memory, that
+ * controls ownership of the area.
+ *
+ * ownership of the region expires when the associated file description is
+ * released.
+ *
+ * At most one permission can be attached 

[PATCH] staging fbtft: Fixed lines exceeding columns limit

2018-04-12 Thread Renato Soma
Fix checkpatch.pl warnings of line sizes exceeding 80 columns.
Break lines in order to reduce the instructions lengths to less than 80 columns.

Signed-off-by: Renato Soma 
---
 drivers/staging/fbtft/fbtft-bus.c | 13 +
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-bus.c 
b/drivers/staging/fbtft/fbtft-bus.c
index a263bce2..57742d7 100644
--- a/drivers/staging/fbtft/fbtft-bus.c
+++ b/drivers/staging/fbtft/fbtft-bus.c
@@ -22,10 +22,13 @@ void func(struct fbtft_par *par, int len, ...)  
  \
if (unlikely(par->debug & DEBUG_WRITE_REGISTER)) {\
va_start(args, len);  \
for (i = 0; i < len; i++) {   \
-   buf[i] = modifier((data_type)va_arg(args, unsigned 
int)); \
+   buf[i] = modifier((data_type)va_arg(args, \
+   unsigned int));   \
} \
va_end(args); \
-   fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par, par->info->device, 
buffer_type, buf, len, "%s: ", __func__); \
+   fbtft_par_dbg_hex(DEBUG_WRITE_REGISTER, par,  \
+   par->info->device, buffer_type,   \
+   buf, len, "%s: ", __func__);  \
} \
  \
va_start(args, len);  \
@@ -37,7 +40,8 @@ void func(struct fbtft_par *par, int len, ...)
\
} \
  \
*buf = modifier((data_type)va_arg(args, unsigned int));   \
-   ret = fbtft_write_buf_dc(par, par->buf, sizeof(data_type) + offset, 0); 
\
+   ret = fbtft_write_buf_dc(par, par->buf,   \
+   sizeof(data_type) + offset, 0);   \
if (ret < 0)  \
goto out; \
len--;\
@@ -48,7 +52,8 @@ void func(struct fbtft_par *par, int len, ...)
\
if (len) {\
i = len;  \
while (i--)   \
-   *buf++ = modifier((data_type)va_arg(args, unsigned 
int)); \
+   *buf++ = modifier((data_type)va_arg(args, \
+   unsigned int));   \
fbtft_write_buf_dc(par, par->buf, \
   len * (sizeof(data_type) + offset), 1);\
} \
-- 
2.7.4

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


Re: [PATCH] staging: comedi: cb_pcidas64: fix alignment of function parameters

2018-04-12 Thread Gabriel Francisco Mandaji
On Wed, Apr 11, 2018 at 10:18:38AM +0100, Ian Abbott wrote:
> On 10/04/18 23:50, Gabriel Francisco Mandaji wrote:
> >Fix most checkpatch.pl issues of type:
> >
> >CHECK: Alignment should match open parenthesis
> >---
> Looks good, thanks.  I guess the remaining case of open parentheses
> alignment wasn't changed because that would exceed 80 columns.

Exactly. I wasn't sure whether it would be OK to use a temporary variable
to store the longest parameter on that line 
(devpriv->ai_buffer[devpriv->ai_dma_index]),
so I ended up fixing only the straightforward occurrences.

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


Chargen-Nr .: ES67189098011 / 245679

2018-04-12 Thread Ana Lisa SANCHEZ
Plaza Romano N°19 Planta 5
28011 Madrid, Spain.

 DATUM: 12.04.2018
INTERNATIONALES SUPER DRAW-PROGRAMM.
Promotions / Preisverleihung dept
Chargen-Nr .: ES67189098011 / 245679
Ref: MT / 11278998789/908796 // 14

BEKANNTMACHUNG 
LETZTE NOTIZ

Wir freuen uns, Ihnen das E-Mail-Aktionsprogramm der E-Lotterie am 22
Marz. 2018, aber aufgrund der Verwechslung der Zahlen und
Adressen das Ergebnis wurden spдter am 4 April verцffentlicht. 2018. Alle 10 
Gewinner E-Mail-Adressen wurden zufдllig aus einer Charge
Von 50.000.000 internationalen E-Mails. Ihre E-Mail-Adresse ist aufgetaucht
Zusammen mit 8 anderen als Gewinner der Kategorie 3 in der diesjдhrigen E
Gewinnspiel. Sie haben sich daher fьr eine
Gesamtpauschale von 620.000,00 Ђ (SECHS HUNDERT UND ZWEI TAUSEND EURO) 

Dem Lotto-Zahlungsauftrag sind folgende Angaben beigefьgt:
Gewinnende Zahlen: 04-13-21-27-36-38 -BB 45 (ii) E-Ticket-Nummer;
FL754 / 22/76 (iii) Lotto Code Nummer: FL09622ES Zu Beginn Ihrer Lotterie
Wenden Sie sich bitte an Ihren Bevollmдchtigten, MR EMILIO SALINAS the Foreign
Dienstleister von CAIXA SEGUROS COMPANY S.A.E-MAIL: groupfacil...@aol.com Fьr 
die Verarbeitung und
Ьberweisung Ihres Preisgeldes an eine ausgewдhlte Wahl von Ihnen.
Denken Sie daran, alle Preisgeld muss spдtestens am 1. Mai beansprucht werden.

Alle Ansprьche, die nicht vor diesem Datum getдtigt wurden, werden an die
MINISTERIO DE ECONOMIA Y HACIENDA als nicht beanspruchten Fonds. Und auch 
informiert werden, dass 10% Ihres Gewinns gehцrt zu CAIXA SEGUROS COMPANY
S.A., obwohl, die zehn Prozent werden zurьckgewiesen, nachdem Sie empfangen 
haben
Ihr preisgekrцntes Preisgeld) In Ihrem benannten Konto. 

Ihr Agent wird Sie weiter auf die administrative Anforderung, um die Bank zu 
ermцglichen
Um Ihren Fonds auf die von Ihnen ausgewдhlte Option freizugeben.
Wir bitten Sie, das untenstehende Zahlungsformular auszufьllen und zu senden
Sofort an Ihre Treuhдnder Agent per E-Mail,(groupfacil...@aol.com) for 
Remittance of your Winning money to your designated Address.
GrьЯe, Ana lisa Sanchez (Frau) Promotion Manager, die E-Lottery Company.

NAME: 
 
NACHNAME: - DATUM DER GEBURT: --- 

TELEFON: --- MOBIL: --- 
--

FAX:  Betrag: -- -
 
STRASSE: 
 
NUMMER:

BUNDESLAND:
 
Postleitzahl: 
 
LAND:-
 
BERUF: -- Nationalitдt:  
 
REFERENZ NR: ---
 
BATCHNR:--
 
EMAIL:-- --
 
SPRACHE BEKANNT: ---

UNTERSCHRIFT DES BEGЬNSTIGTEN: -

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

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


Re: [PATCH] staging: pi433: add descriptions for mutex locks

2018-04-12 Thread Valentin Vidic
On Sun, Apr 08, 2018 at 05:22:46PM +0200, Marcus Wolf wrote:
> Regarding your patch, I did not understand, why you did not remove
> the mutex_lock in pi433_write. Wasn't it the goal to remove it?

Is it possible for more than one userspace program to open the pi433
device and send messages?  In that case more than one pi433_write
could be running and it needs to hold a mutex_lock before calling
kfifo_in.

> Below find a proposal of pi433_write function, I wrote on base
> of my outdated (!), private repo. It is not compiled and not tested.
> Since there is no more handling in case of an error (as well in the
> propsal as in your patch), I removed the error handling completely.
> I only do a test to detect proplems while writing to the tx_fifo,
> but (like in your patch) do nothing for solving, just printing a line.
> If this unexpected situation will occur (most probably never),
> the tx_fifo will be (and stay) out of sync until driver gets unloaded.
> We have to decide, whether we can stay with that. Like written above,
> I thinkt the benefits are great, the chance of such kind of error
> very low.
> What do you think?

Yes, if there is only one writer and it checks the available size,
kfifo_in should not fail.  The only problem might be copy_from_user
but perhaps that is also quite unlikely.  A workaround for that could
be to copy the data into a temporary kernel buffer first and than
start kfifo writes using only kernel memory.

> It could be discussed, whether it is better to return EMSGSIZE or
> EAGAIN on the first check. On the one hand, there is a problem with
> the message size, on the other hand (if message isn't generally too
> big) after a while, there should be some more space available in
> fifo, so EAGAIN may be better choice.

EAGAIN does seem better unless the message is too big to ever fit
in the kfifo.

>   if (retval != required ) {
>   dev_dbg(device->dev, "write to fifo failed, reason unknown, non 
> recoverable.");
>   return -EAGAIN;
>   }

Maybe this should be dev_warn or even dev_crit if the driver is not
usable anymore when this happens?  The error message should than also
be adjusted to EBADF or something similar.

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


Re: [PATCH] staging: pi433: add descriptions for mutex locks

2018-04-12 Thread Valentin Vidic
On Sun, Apr 08, 2018 at 04:15:30PM +0200, Marcus Wolf wrote:
> The hardware of Pi433 is working with every Raspberry Pi (on zero, you
> need to solder the GPIO-pins) and with several other fruits like banana
> pi. The only thing is, that you need different versions of the driver,
> according to the processor, mounted on your fruit.
> 
> If you'd like to test more then ther is no hang up or crash, you will
> need a second party. You could use a 433MHz socket for testing TX or a
> 433 thermometer for testing RX. An example code for communication with a
> socket is available on the Pi433 productpage (www.pi433.de). The sample
> for the thermometer isn't published yet (as always lack of time).
> 
> If you want to test more deeply (using different features of the Rf69
> chip or even do some long time testing, you have more options, if you
> use to Pis with Pi433.
> 
> Just let me know, what you'd like to do and what equipment, you need.

At the moment I have Rpi2 but not any other 433MHz equipment, so I
could only do some basic testing unfortunately.  In case I get the
new Rpi3 some time soon I would be able to do something better.

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


Re: [PATCH 08/15] ASoC: pxa: remove the dmaengine compat need

2018-04-12 Thread Robert Jarzmik
Mark Brown  writes:

> On Mon, Apr 02, 2018 at 04:26:49PM +0200, Robert Jarzmik wrote:
>> As the pxa architecture switched towards the dmaengine slave map, the
>> old compatibility mechanism to acquire the dma requestor line number and
>> priority are not needed anymore.
>
> Acked-by: Mark Brown 
>
> If there's no dependency I'm happy to take this for 4.18.
Thanks for the ack.

The patches 1 and 2 are the dependency here, so I'd rather push it through my
tree once the review is complete.

Cheers.

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


[PATCH v3] staging: ks7010_sdio: fix NULL pointer dereference and memory leak

2018-04-12 Thread Gustavo A. R. Silva
priv is being explicitly dereferenced when it is still null, when
jumping to goto label err_free_netdev, before it is properly
updated with a valid memory address.

Also, when this happens, memory allocated for netdev at line 854:
netdev = alloc_etherdev(sizeof(*priv)) is not being free'd before
return, hence there is a memory leak.

The current code looks a bit too complicated and can be replaced
by just directly freeing netdev before return.

Notice that card->priv = NULL isn't required because the next thing
we do to card is kfree(card).

Addresses-Coverity-ID: 1467844 ("Explicit null dereferenced")
Suggested-by: Dan Carpenter 
Signed-off-by: Gustavo A. R. Silva 
---
Changes in v3:
 - Update subject and improve changelog.
 - Add Suggested-by: Dan Carpenter 

Changes in v2:
 - Update subject and commit changelog.
 - Just directly free netdev. Thanks to Dan Carpenter for the feedback.

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

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index b8f55a1..2c9b92c 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -932,8 +932,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
return 0;
 
  err_free_netdev:
-   free_netdev(priv->net_dev);
-   card->priv = NULL;
+   free_netdev(netdev);
  err_release_irq:
sdio_claim_host(func);
sdio_release_irq(func);
-- 
2.7.4

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


Re: [PATCH v7] Revert "PCI: hv: Use device serial number as PCI domain"

2018-04-12 Thread Lorenzo Pieralisi
On Thu, Apr 12, 2018 at 03:56:42PM +, Sridhar Pitchai wrote:
> > 
> > >> I am still not happy with this patch.
> > >>
> > >> -  You do not explain at all the dependency on commit 
> 0c195567a8f6 and
> > >>you should because that's fundamental, if that patch is not 
> present
> > >>this revert breaks the kernel as per previous discussions[1].
> > >> -  You are sending this patch to all stable kernels that contain 
> the
> > >>commit you are fixing - some that may not contain the commit 
> above
> > >>(that was merged in v4.14), you are breaking those kernels, 
> if not
> > >>explain me why please
> > 
> > >If there's a dependency on 0c195567a8f6, I totally agree that
> > >needs to be cleared up.  I was assuming that turned out to be
> > >irrelevant.
> > That is right. There is no dependency on 0c195567a8f6. We just need to 
> revert
> > 4a9b0933bdfc.
> 
> > This patch should only be applied to later versions after  
> 0c195567a8f6" (transparent VF).
> > Otherwise it causes long & random names of VF NICs for bonding. That 
> will make bonding
> > config difficult, especially for auto config.
> 
> >Thanks,
> >- Haiyang
> Ok. I will update the patch, as Lorenzo suggested. 

Please update your email client quoting policy so that it does not add
unnecessary indentation spaces, for long threads this gets messy.

If you send a patch to a specific stable version you have to test it
first thing on that stable version before adding a stable tag, reverting
a patch from stable kernels is the last thing we want to do - that's the
reason why I keep complaining.

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


Re: [PATCH] staging: ks7010_sdio: fix NULL pointer dereference and memory leak

2018-04-12 Thread Gustavo A. R. Silva

Hi Dan,

On 04/12/2018 10:08 AM, Dan Carpenter wrote:

I added Colin to the Cc list.

On Thu, Apr 12, 2018 at 09:30:09AM -0500, Gustavo A. R. Silva wrote:

priv is being dereferenced when it is still null, hence there is an
explicit null pointer dereference at line 935: free_netdev(priv->net_dev)

Also, memory allocated for netdev at line 854:
netdev = alloc_etherdev(sizeof(*priv));
is not being free'd, hence there is a memory leak.

Fix this by null checking priv before dererefencing it and free netdev
before return.

Addresses-Coverity-ID: 1467844 ("Explicit null dereferenced")
Signed-off-by: Gustavo A. R. Silva 
---
  drivers/staging/ks7010/ks7010_sdio.c | 8 ++--
  1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index b8f55a1..f5d4c62 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -932,8 +932,12 @@ static int ks7010_sdio_probe(struct sdio_func *func,
return 0;
  
   err_free_netdev:

-   free_netdev(priv->net_dev);
-   card->priv = NULL;
+   if (priv) {
+   free_netdev(priv->net_dev);
+   card->priv = NULL;


This isn't required because the next thing we do to card is kfree(card).



I got it.


+   } else {
+   free_netdev(netdev);
+   }



That's too complicated.  Just do:

err_free_netdev:
free_netdev(net_dev);

err_release_irq:
...

Please send a v2 patch.



Sure thing, I'll send it shortly.

Thanks for the feedback.
--
Gustavo
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


RE: [PATCH v7] Revert "PCI: hv: Use device serial number as PCI domain"

2018-04-12 Thread Haiyang Zhang


> -Original Message-
> From: Sridhar Pitchai
> Sent: Thursday, April 12, 2018 11:14 AM
> To: Bjorn Helgaas ; Lorenzo Pieralisi
> 
> Cc: Haiyang Zhang ; Dexuan Cui
> ; Stephen Hemminger ;
> Jake Oshins ; KY Srinivasan ;
> Michael Kelley (EOSG) ;
> de...@linuxdriverproject.org; linux-...@vger.kernel.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH v7] Revert "PCI: hv: Use device serial number as PCI
> domain"
> 
> >> I am still not happy with this patch.
> >>
> >> -  You do not explain at all the dependency on commit 0c195567a8f6 and
> >>you should because that's fundamental, if that patch is not present
> >>this revert breaks the kernel as per previous discussions[1].
> >> -  You are sending this patch to all stable kernels that contain the
> >>commit you are fixing - some that may not contain the commit above
> >>(that was merged in v4.14), you are breaking those kernels, if not
> >>explain me why please
> 
> >If there's a dependency on 0c195567a8f6, I totally agree that
> >needs to be cleared up.  I was assuming that turned out to be
> >irrelevant.
> That is right. There is no dependency on 0c195567a8f6. We just need to revert
> 4a9b0933bdfc.

This patch should only be applied to later versions after  0c195567a8f6" 
(transparent VF). Otherwise it causes long & random names of VF NICs for 
bonding. That will make bonding config difficult, especially for auto config.

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


Re: [PATCH v7] Revert "PCI: hv: Use device serial number as PCI domain"

2018-04-12 Thread Sridhar Pitchai
> 
> >> I am still not happy with this patch.
> >>
> >> -  You do not explain at all the dependency on commit 0c195567a8f6 
and
> >>you should because that's fundamental, if that patch is not 
present
> >>this revert breaks the kernel as per previous discussions[1].
> >> -  You are sending this patch to all stable kernels that contain 
the
> >>commit you are fixing - some that may not contain the commit 
above
> >>(that was merged in v4.14), you are breaking those kernels, if 
not
> >>explain me why please
> 
> >If there's a dependency on 0c195567a8f6, I totally agree that
> >needs to be cleared up.  I was assuming that turned out to be
> >irrelevant.
> That is right. There is no dependency on 0c195567a8f6. We just need to 
revert
> 4a9b0933bdfc.

> This patch should only be applied to later versions after  0c195567a8f6" 
(transparent VF).
> Otherwise it causes long & random names of VF NICs for bonding. That will 
make bonding
> config difficult, especially for auto config.

>Thanks,
>- Haiyang
Ok. I will update the patch, as Lorenzo suggested. 



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


[PATCH 12/14] staging: ks7010: use u8 instead of unsigned char for firmware buffers

2018-04-12 Thread Sergio Paracuellos
This commit replaces type unsigned char which is the one which
is being used for firmware buffers with u8 type which is preferred.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 82bc839..9fc9808 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -680,10 +680,10 @@ static int ks7010_sdio_update_index(struct 
ks_wlan_private *priv, u32 index)
 
 #define ROM_BUFF_SIZE (64 * 1024)
 static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address,
-   unsigned char *data, unsigned int size)
+   u8 *data, unsigned int size)
 {
int ret;
-   unsigned char *read_buf;
+   u8 *read_buf;
 
read_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
if (!read_buf)
@@ -714,7 +714,7 @@ static int ks7010_copy_firmware(struct ks_wlan_private 
*priv,
unsigned int size;
unsigned int offset;
unsigned int n = 0;
-   unsigned char *rom_buf;
+   u8 *rom_buf;
int ret;
 
rom_buf = kmalloc(ROM_BUFF_SIZE, GFP_KERNEL);
-- 
2.7.4

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


[PATCH 09/14] staging: ks7010: replace create_workqueue with alloc_workqueue

2018-04-12 Thread Sergio Paracuellos
This commit replaces deprecated create_workqueue call with the
alloc_workqueue one which is the one to be used now for this
purpose.

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

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index c53f3f4..6db429e 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -1035,7 +1035,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
 
priv->dev_state = DEVICE_STATE_BOOT;
 
-   priv->wq = create_workqueue("wq");
+   priv->wq = alloc_workqueue("wq", WQ_MEM_RECLAIM, 1);
if (!priv->wq) {
netdev_err(priv->net_dev, "create_workqueue failed !!\n");
goto err_free_netdev;
-- 
2.7.4

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


[PATCH 14/14] staging: ks7010: use linux circular buffer header macros to handle tx and rx queues

2018-04-12 Thread Sergio Paracuellos
This commit replace current custom implementation of some circular
buffer head and tail logic in favour of the use of macros defined
in linux circ_buf.h header. It also review internal names and adds
a new CIRC_INC macro to make code more readable. Note also that
CIRC_INC does not need to go inside do-while(0) block because its
use is only located in the four functions that make use of it 
so it won't expand into invalid code at all.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 59 ++--
 1 file changed, 36 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 9c591e0..9676902 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -10,6 +10,7 @@
  *   published by the Free Software Foundation.
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -101,38 +102,50 @@ enum gen_com_reg_b {
 
 #define KS7010_IO_BLOCK_SIZE 512
 
+#define CIRC_INC(a, b) if (++a >= b) a = 0
+
 static inline void inc_txqhead(struct ks_wlan_private *priv)
 {
-   priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
+   CIRC_INC(priv->tx_dev.qhead, TX_DEVICE_BUFF_SIZE);
 }
 
 static inline void inc_txqtail(struct ks_wlan_private *priv)
 {
-   priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE;
+   CIRC_INC(priv->tx_dev.qtail, TX_DEVICE_BUFF_SIZE);
 }
 
-static inline unsigned int cnt_txqbody(struct ks_wlan_private *priv)
+static inline bool txq_has_space(struct ks_wlan_private *priv)
 {
-   unsigned int tx_cnt = priv->tx_dev.qtail - priv->tx_dev.qhead;
-
-   return (tx_cnt + TX_DEVICE_BUFF_SIZE) % TX_DEVICE_BUFF_SIZE;
+   return (CIRC_SPACE(priv->tx_dev.qhead, priv->tx_dev.qtail,
+  TX_DEVICE_BUFF_SIZE) > 0);
 }
 
 static inline void inc_rxqhead(struct ks_wlan_private *priv)
 {
-   priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE;
+   CIRC_INC(priv->rx_dev.qhead, RX_DEVICE_BUFF_SIZE);
 }
 
 static inline void inc_rxqtail(struct ks_wlan_private *priv)
 {
-   priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE;
+   CIRC_INC(priv->rx_dev.qtail, RX_DEVICE_BUFF_SIZE);
 }
 
-static inline unsigned int cnt_rxqbody(struct ks_wlan_private *priv)
+static inline bool rxq_has_space(struct ks_wlan_private *priv)
 {
-   unsigned int rx_cnt = priv->rx_dev.qtail - priv->rx_dev.qhead;
+   return (CIRC_SPACE(priv->rx_dev.qhead, priv->rx_dev.qtail,
+  RX_DEVICE_BUFF_SIZE) > 0);
+}
 
-   return (rx_cnt + RX_DEVICE_BUFF_SIZE) % RX_DEVICE_BUFF_SIZE;
+static inline unsigned int txq_count(struct ks_wlan_private *priv)
+{
+   return CIRC_CNT_TO_END(priv->tx_dev.qhead, priv->tx_dev.qtail,
+  TX_DEVICE_BUFF_SIZE);
+}
+
+static inline unsigned int rxq_count(struct ks_wlan_private *priv)
+{
+   return CIRC_CNT_TO_END(priv->rx_dev.qhead, priv->rx_dev.qtail,
+  RX_DEVICE_BUFF_SIZE);
 }
 
 /* Read single byte from device address into byte (CMD52) */
@@ -258,11 +271,11 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
   atomic_read(>psstatus.status),
   atomic_read(>psstatus.confirm_wait),
   atomic_read(>psstatus.snooze_guard),
-  cnt_txqbody(priv));
+  txq_count(priv));
 
if (atomic_read(>psstatus.confirm_wait) ||
atomic_read(>psstatus.snooze_guard) ||
-   cnt_txqbody(priv)) {
+   txq_has_space(priv)) {
queue_delayed_work(priv->wq, >rw_dwork, 0);
return;
}
@@ -308,7 +321,7 @@ static int enqueue_txdev(struct ks_wlan_private *priv, 
unsigned char *p,
goto err_complete;
}
 
-   if ((TX_DEVICE_BUFF_SIZE - 1) <= cnt_txqbody(priv)) {
+   if ((TX_DEVICE_BUFF_SIZE - 1) <= txq_count(priv)) {
netdev_err(priv->net_dev, "tx buffer overflow\n");
ret = -EOVERFLOW;
goto err_complete;
@@ -366,7 +379,7 @@ static void tx_device_task(struct ks_wlan_private *priv)
struct tx_device_buffer *sp;
int ret;
 
-   if (cnt_txqbody(priv) <= 0 ||
+   if (!txq_has_space(priv) ||
atomic_read(>psstatus.status) == PS_SNOOZE)
return;
 
@@ -385,7 +398,7 @@ static void tx_device_task(struct ks_wlan_private *priv)
(*sp->complete_handler)(priv, sp->skb);
inc_txqhead(priv);
 
-   if (cnt_txqbody(priv) > 0)
+   if (txq_has_space(priv))
queue_delayed_work(priv->wq, >rw_dwork, 0);
 }
 
@@ -413,7 +426,7 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, 
unsigned long size,
result = enqueue_txdev(priv, p, size, complete_handler, skb);
spin_unlock(>tx_dev.tx_dev_lock);
 
-   if 

[PATCH 13/14] staging: ks7010: assign dev_alloc_name() result to variable before check it

2018-04-12 Thread Sergio Paracuellos
This commit assigns dev_alloc_name() call to 'ret' variable to
check it after instead of check directly the call in the if
condition. This improves a bit readability. It also add an empty
line before the new assignment to separate it from the previous
check statement block.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 9fc9808..9c591e0 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -1015,7 +1015,9 @@ static int ks7010_sdio_probe(struct sdio_func *func,
dev_err(>func->dev, "Unable to alloc new net device\n");
goto err_release_irq;
}
-   if (dev_alloc_name(netdev, "wlan%d") < 0) {
+
+   ret = dev_alloc_name(netdev, "wlan%d");
+   if (ret < 0) {
dev_err(>func->dev, "Couldn't get name!\n");
goto err_free_netdev;
}
-- 
2.7.4

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


[PATCH 10/14] staging: ks7010: check sdio_set_block_size return value

2018-04-12 Thread Sergio Paracuellos
This commit checks sdio_set_block_size function return value.
If it fails abort driver initialization.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 6db429e..cdfbec8 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -988,6 +988,9 @@ static int ks7010_sdio_probe(struct sdio_func *func,
sdio_claim_host(func);
 
ret = sdio_set_block_size(func, KS7010_IO_BLOCK_SIZE);
+   if (ret)
+   goto err_free_card;
+
dev_dbg(>func->dev, "multi_block=%d sdio_set_block_size()=%d 
%d\n",
func->card->cccr.multi_block, func->cur_blksize, ret);
 
-- 
2.7.4

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


[PATCH 03/14] staging: ks7010: delete not used definitions in ks7010_sdio source

2018-04-12 Thread Sergio Paracuellos
This commit removes two definitions inside ks7010_sdio source file
because they are not being used at all.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index db1b749..063c461 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -94,10 +94,7 @@ enum gen_com_reg_b {
 
 #define KS7010_IRAM_ADDRESS0x0600
 
-
-#define KS7010_FUNC_NUM 1
 #define KS7010_IO_BLOCK_SIZE 512
-#define KS7010_MAX_CLOCK 2500
 
 static const struct sdio_device_id ks7010_sdio_ids[] = {
{SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_A, SDIO_DEVICE_ID_KS_7010)},
-- 
2.7.4

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


[PATCH 04/14] staging: ks7010: add REG suffix to sdio register definitions

2018-04-12 Thread Sergio Paracuellos
This commit adds REG suffix to register definitions related
with SDIO in order to improve readability.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 96 ++--
 1 file changed, 48 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 063c461..befe9e9 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -32,33 +32,33 @@
 #define SDIO_DEVICE_ID_KS_7010 0x7910
 
 /* Read/Write Status Register */
-#define READ_STATUS0x00
-#define WRITE_STATUS   0x0C
+#define READ_STATUS_REG0x00
+#define WRITE_STATUS_REG   0x0C
 enum reg_status_type {
REG_STATUS_BUSY,
REG_STATUS_IDLE
 };
 
 /* Read Index Register */
-#define READ_INDEX 0x04
+#define READ_INDEX_REG 0x04
 
 /* Read Data Size Register */
-#define READ_DATA_SIZE 0x08
+#define READ_DATA_SIZE_REG 0x08
 
 /* Write Index Register */
-#define WRITE_INDEX0x10
+#define WRITE_INDEX_REG0x10
 
 /* Write Status/Read Data Size Register
  * for network packet (less than 2048 bytes data)
  */
-#define WSTATUS_RSIZE  0x14
+#define WSTATUS_RSIZE_REG  0x14
 #define WSTATUS_MASK   0x80/* Write Status Register value */
 #define RSIZE_MASK 0x7F/* Read Data Size Register value [10:4] 
*/
 
 /* ARM to SD interrupt Enable */
-#define INT_ENABLE 0x20
+#define INT_ENABLE_REG 0x20
 /* ARM to SD interrupt Pending */
-#define INT_PENDING0x24
+#define INT_PENDING_REG0x24
 
 #define INT_GCR_B  BIT(7)
 #define INT_GCR_A  BIT(6)
@@ -70,7 +70,7 @@ enum reg_status_type {
 #define INT_READ_SIZE  BIT(0)
 
 /* General Communication Register A */
-#define GCR_A  0x28
+#define GCR_A_REG  0x28
 enum gen_com_reg_a {
GCR_A_INIT,
GCR_A_REMAP,
@@ -78,14 +78,14 @@ enum gen_com_reg_a {
 };
 
 /* General Communication Register B */
-#define GCR_B  0x2C
+#define GCR_B_REG  0x2C
 enum gen_com_reg_b {
GCR_B_ACTIVE,
GCR_B_DOZE
 };
 
 /* Wakeup Register */
-#define WAKEUP 0x008018
+#define WAKEUP_REG 0x008018
 #define WAKEUP_REQ 0x5a
 
 /* AHB Data Window  0x01-0x01 */
@@ -187,9 +187,9 @@ static void ks_wlan_hw_sleep_doze_request(struct 
ks_wlan_private *priv)
atomic_set(>sleepstatus.doze_request, 0);
 
if (atomic_read(>sleepstatus.status) == 0) {
-   ret = ks7010_sdio_writeb(priv, GCR_B, GCR_B_DOZE);
+   ret = ks7010_sdio_writeb(priv, GCR_B_REG, GCR_B_DOZE);
if (ret) {
-   netdev_err(priv->net_dev, " error : GCR_B\n");
+   netdev_err(priv->net_dev, " error : GCR_B_REG\n");
goto set_sleep_mode;
}
atomic_set(>sleepstatus.status, 1);
@@ -208,9 +208,9 @@ static void ks_wlan_hw_sleep_wakeup_request(struct 
ks_wlan_private *priv)
atomic_set(>sleepstatus.wakeup_request, 0);
 
if (atomic_read(>sleepstatus.status) == 1) {
-   ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ);
+   ret = ks7010_sdio_writeb(priv, WAKEUP_REG, WAKEUP_REQ);
if (ret) {
-   netdev_err(priv->net_dev, " error : WAKEUP\n");
+   netdev_err(priv->net_dev, " error : WAKEUP_REG\n");
goto set_sleep_mode;
}
atomic_set(>sleepstatus.status, 0);
@@ -227,9 +227,9 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv)
int ret;
 
if (atomic_read(>psstatus.status) == PS_SNOOZE) {
-   ret = ks7010_sdio_writeb(priv, WAKEUP, WAKEUP_REQ);
+   ret = ks7010_sdio_writeb(priv, WAKEUP_REG, WAKEUP_REQ);
if (ret)
-   netdev_err(priv->net_dev, " error : WAKEUP\n");
+   netdev_err(priv->net_dev, " error : WAKEUP_REG\n");
 
priv->last_wakeup = jiffies;
++priv->wakeup_count;
@@ -269,17 +269,17 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
return;
}
 
-   ret = ks7010_sdio_readb(priv, INT_PENDING, );
+   ret = ks7010_sdio_readb(priv, INT_PENDING_REG, );
if (ret) {
-   netdev_err(priv->net_dev, " error : INT_PENDING\n");
+   netdev_err(priv->net_dev, " error : INT_PENDING_REG\n");
goto queue_delayed_work;
}
if (byte)
goto queue_delayed_work;
 
-   ret = ks7010_sdio_writeb(priv, GCR_B, GCR_B_DOZE);
+   ret = ks7010_sdio_writeb(priv, GCR_B_REG, 

[PATCH 08/14] staging: ks7010: move MODULE_DEVICE_TABLE related code

2018-04-12 Thread Sergio Paracuellos
This commit moves MODULE_DEVICE_TABLE related code to the end of
the file. This is not necessary at all but moving it just before
its use improves readability.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 12687ae..c53f3f4 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -101,13 +101,6 @@ enum gen_com_reg_b {
 
 #define KS7010_IO_BLOCK_SIZE 512
 
-static const struct sdio_device_id ks7010_sdio_ids[] = {
-   {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_A, SDIO_DEVICE_ID_KS_7010)},
-   {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_B, SDIO_DEVICE_ID_KS_7010)},
-   { /* all zero */ }
-};
-MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
-
 static inline void inc_txqhead(struct ks_wlan_private *priv)
 {
priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE;
@@ -1148,6 +1141,13 @@ static void ks7010_sdio_remove(struct sdio_func *func)
kfree(card);
 }
 
+static const struct sdio_device_id ks7010_sdio_ids[] = {
+   {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_A, SDIO_DEVICE_ID_KS_7010)},
+   {SDIO_DEVICE(SDIO_VENDOR_ID_KS_CODE_B, SDIO_DEVICE_ID_KS_7010)},
+   { /* all zero */ }
+};
+MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
+
 static struct sdio_driver ks7010_sdio_driver = {
.name = "ks7010_sdio",
.id_table = ks7010_sdio_ids,
-- 
2.7.4

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


[PATCH 11/14] staging: ks7010: fix error paths in ks7010_sdio_remove function

2018-04-12 Thread Sergio Paracuellos
This commit reviews and fixes error paths in ks7010_sdio_remove
driver function. It change logic to handle error directly
after priv dereference to avoid one level indentation. It also
removes a temporal netdev variable which wasn't being used in all
of the function calls. Also if send_stop_request call fails it
was making a direct 'return' instead of doing a properly cleaning.
Because of this a new 'err_free_card' label has been added.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 42 ++--
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index cdfbec8..82bc839 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -1107,39 +1107,39 @@ static void ks7010_sdio_remove(struct sdio_func *func)
return;
 
priv = card->priv;
-   if (priv) {
-   struct net_device *netdev = priv->net_dev;
+   if (!priv)
+   goto err_free_card;
 
-   ks_wlan_net_stop(netdev);
+   ks_wlan_net_stop(priv->net_dev);
 
-   /* interrupt disable */
-   sdio_claim_host(func);
-   sdio_writeb(func, 0, INT_ENABLE_REG, );
-   sdio_writeb(func, 0xff, INT_PENDING_REG, );
-   sdio_release_host(func);
+   /* interrupt disable */
+   sdio_claim_host(func);
+   sdio_writeb(func, 0, INT_ENABLE_REG, );
+   sdio_writeb(func, 0xff, INT_PENDING_REG, );
+   sdio_release_host(func);
 
-   ret = send_stop_request(func);
-   if (ret)/* memory allocation failure */
-   return;
+   ret = send_stop_request(func);
+   if (ret)/* memory allocation failure */
+   goto err_free_card;
 
-   if (priv->wq) {
-   flush_workqueue(priv->wq);
-   destroy_workqueue(priv->wq);
-   }
+   if (priv->wq) {
+   flush_workqueue(priv->wq);
+   destroy_workqueue(priv->wq);
+   }
 
-   hostif_exit(priv);
+   hostif_exit(priv);
 
-   unregister_netdev(netdev);
+   unregister_netdev(priv->net_dev);
 
-   trx_device_exit(priv);
-   free_netdev(priv->net_dev);
-   card->priv = NULL;
-   }
+   trx_device_exit(priv);
+   free_netdev(priv->net_dev);
+   card->priv = NULL;
 
sdio_claim_host(func);
sdio_release_irq(func);
sdio_disable_func(func);
sdio_release_host(func);
+err_free_card:
sdio_set_drvdata(func, NULL);
kfree(card);
 }
-- 
2.7.4

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


[PATCH 07/14] staging: ks7010: avoid one extra level indentation in ks_wlan_hw_rx function

2018-04-12 Thread Sergio Paracuellos
This commit use an and operator in a if condition to avoid one
indentation level which is not needed at all.

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

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 19ce50f..12687ae 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -484,11 +484,9 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, 
uint16_t size)
if (ret)
netdev_err(priv->net_dev, "write READ_STATUS_REG\n");
 
-   if (atomic_read(>psstatus.confirm_wait)) {
-   if (is_hif_conf(event)) {
-   netdev_dbg(priv->net_dev, "IS_HIF_CONF true !!\n");
-   atomic_dec(>psstatus.confirm_wait);
-   }
+   if (atomic_read(>psstatus.confirm_wait) && is_hif_conf(event)) {
+   netdev_dbg(priv->net_dev, "IS_HIF_CONF true !!\n");
+   atomic_dec(>psstatus.confirm_wait);
}
 
tasklet_schedule(>rx_bh_task);
-- 
2.7.4

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


[PATCH 05/14] staging: ks7010: review comment style in ks7010_sdio source file

2018-04-12 Thread Sergio Paracuellos
This commit reviews comment style used in ks7010_sdio source file
in order to be coherent with the rest of the code. Most comments
in this source are before definitions but only two of them have
been written at the right. So, be coherent moving this two to the
top of definitions. Also fix one multiline comment style to use
the normal preferred kernel style.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index befe9e9..4fde8d8 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -48,12 +48,17 @@ enum reg_status_type {
 /* Write Index Register */
 #define WRITE_INDEX_REG0x10
 
-/* Write Status/Read Data Size Register
+/*
+ * Write Status/Read Data Size Register
  * for network packet (less than 2048 bytes data)
  */
 #define WSTATUS_RSIZE_REG  0x14
-#define WSTATUS_MASK   0x80/* Write Status Register value */
-#define RSIZE_MASK 0x7F/* Read Data Size Register value [10:4] 
*/
+
+/* Write Status Register value */
+#define WSTATUS_MASK   0x80
+
+/* Read Data Size Register value [10:4] */
+#define RSIZE_MASK 0x7F
 
 /* ARM to SD interrupt Enable */
 #define INT_ENABLE_REG 0x20
-- 
2.7.4

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


[PATCH 06/14] staging: ks7010: review debug and error messages in ks7010_sdio source

2018-04-12 Thread Sergio Paracuellos
This commit reviews debug and error messages in code located
in ks7010_sdio source file avoiding to use 'error' or 'ks7010'
because this file is using netdev_* functions and has non
sense to repeat information in log messages.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 38 +---
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 4fde8d8..19ce50f 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -194,7 +194,7 @@ static void ks_wlan_hw_sleep_doze_request(struct 
ks_wlan_private *priv)
if (atomic_read(>sleepstatus.status) == 0) {
ret = ks7010_sdio_writeb(priv, GCR_B_REG, GCR_B_DOZE);
if (ret) {
-   netdev_err(priv->net_dev, " error : GCR_B_REG\n");
+   netdev_err(priv->net_dev, "write GCR_B_REG\n");
goto set_sleep_mode;
}
atomic_set(>sleepstatus.status, 1);
@@ -215,7 +215,7 @@ static void ks_wlan_hw_sleep_wakeup_request(struct 
ks_wlan_private *priv)
if (atomic_read(>sleepstatus.status) == 1) {
ret = ks7010_sdio_writeb(priv, WAKEUP_REG, WAKEUP_REQ);
if (ret) {
-   netdev_err(priv->net_dev, " error : WAKEUP_REG\n");
+   netdev_err(priv->net_dev, "write WAKEUP_REG\n");
goto set_sleep_mode;
}
atomic_set(>sleepstatus.status, 0);
@@ -234,7 +234,7 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv)
if (atomic_read(>psstatus.status) == PS_SNOOZE) {
ret = ks7010_sdio_writeb(priv, WAKEUP_REG, WAKEUP_REQ);
if (ret)
-   netdev_err(priv->net_dev, " error : WAKEUP_REG\n");
+   netdev_err(priv->net_dev, "write WAKEUP_REG\n");
 
priv->last_wakeup = jiffies;
++priv->wakeup_count;
@@ -276,7 +276,7 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
 
ret = ks7010_sdio_readb(priv, INT_PENDING_REG, );
if (ret) {
-   netdev_err(priv->net_dev, " error : INT_PENDING_REG\n");
+   netdev_err(priv->net_dev, "read INT_PENDING_REG\n");
goto queue_delayed_work;
}
if (byte)
@@ -284,7 +284,7 @@ static void _ks_wlan_hw_power_save(struct ks_wlan_private 
*priv)
 
ret = ks7010_sdio_writeb(priv, GCR_B_REG, GCR_B_DOZE);
if (ret) {
-   netdev_err(priv->net_dev, " error : GCR_B_REG\n");
+   netdev_err(priv->net_dev, "write GCR_B_REG\n");
goto queue_delayed_work;
}
atomic_set(>psstatus.status, PS_SNOOZE);
@@ -355,13 +355,13 @@ static int write_to_device(struct ks_wlan_private *priv, 
unsigned char *buffer,
 
ret = ks7010_sdio_write(priv, DATA_WINDOW, buffer, size);
if (ret) {
-   netdev_err(priv->net_dev, " write error : retval=%d\n", ret);
+   netdev_err(priv->net_dev, "write DATA_WINDOW\n");
return ret;
}
 
ret = ks7010_sdio_writeb(priv, WRITE_STATUS_REG, REG_STATUS_BUSY);
if (ret) {
-   netdev_err(priv->net_dev, " error : WRITE_STATUS_REG\n");
+   netdev_err(priv->net_dev, "write WRITE_STATUS_REG\n");
return ret;
}
 
@@ -469,7 +469,7 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, 
uint16_t size)
 #endif
ret = ks7010_sdio_writeb(priv, READ_STATUS_REG, 
REG_STATUS_IDLE);
if (ret)
-   netdev_err(priv->net_dev, " error : READ_STATUS_REG\n");
+   netdev_err(priv->net_dev, "write READ_STATUS_REG\n");
 
/* length check fail */
return;
@@ -482,7 +482,7 @@ static void ks_wlan_hw_rx(struct ks_wlan_private *priv, 
uint16_t size)
 
ret = ks7010_sdio_writeb(priv, READ_STATUS_REG, REG_STATUS_IDLE);
if (ret)
-   netdev_err(priv->net_dev, " error : READ_STATUS_REG\n");
+   netdev_err(priv->net_dev, "write READ_STATUS_REG\n");
 
if (atomic_read(>psstatus.confirm_wait)) {
if (is_hif_conf(event)) {
@@ -543,7 +543,7 @@ static void ks7010_rw_function(struct work_struct *work)
/* read (WriteStatus/ReadDataSize FN1:00_0014) */
ret = ks7010_sdio_readb(priv, WSTATUS_RSIZE_REG, );
if (ret) {
-   netdev_err(priv->net_dev, " error : WSTATUS_RSIZE_REG 
psstatus=%d\n",
+   netdev_err(priv->net_dev, "read WSTATUS_RSIZE_REG 
psstatus=%d\n",
   atomic_read(>psstatus.status));
goto release_host;
}
@@ -575,7 +575,7 @@ static void ks_sdio_interrupt(struct sdio_func *func)
 
ret = 

[PATCH 00/14] cleanups continue

2018-04-12 Thread Sergio Paracuellos
The following series makes new cleanups for ks7010 SDIO
related code. All of these needs the previous sent patch 
series to be applied before.

Sergio Paracuellos (14):
  staging: ks7010: move ROM_FILE definition into source file
  staging: ks7010: move sdio specific register definitions into source
file
  staging: ks7010: delete not used definitions in ks7010_sdio source
  staging: ks7010: add REG suffix to sdio register definitions
  staging: ks7010: review comment style in ks7010_sdio source file
  staging: ks7010: review debug and error messages in ks7010_sdio source
  staging: ks7010: avoid one extra level indentation in ks_wlan_hw_rx
function
  staging: ks7010: move MODULE_DEVICE_TABLE related code
  staging: ks7010: replace create_workqueue with alloc_workqueue
  staging: ks7010: check sdio_set_block_size return value
  staging: ks7010: fix error paths in ks7010_sdio_remove function
  staging: ks7010: use u8 instead of unsigned char for firmware buffers
  staging: ks7010: assign dev_alloc_name() result to variable before
check it
  staging: ks7010: use linux circular buffer header macros to handle tx
and rx queues

 drivers/staging/ks7010/ks7010_sdio.c | 295 +++
 drivers/staging/ks7010/ks7010_sdio.h |  71 -
 2 files changed, 192 insertions(+), 174 deletions(-)

-- 
2.7.4

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


[PATCH 02/14] staging: ks7010: move sdio specific register definitions into source file

2018-04-12 Thread Sergio Paracuellos
This commit moves SDIO related register definitions from header
to source file. There is no need to have those into the header
because they are only being used in specific SDIO code.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 72 
 drivers/staging/ks7010/ks7010_sdio.h | 69 --
 2 files changed, 72 insertions(+), 69 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index 99f7b1d..db1b749 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -23,6 +23,78 @@
 #include "ks7010_sdio.h"
 
 #define ROM_FILE "ks7010sd.rom"
+
+/*  SDIO KeyStream vendor and device */
+#define SDIO_VENDOR_ID_KS_CODE_A   0x005b
+#define SDIO_VENDOR_ID_KS_CODE_B   0x0023
+
+/* Older sources suggest earlier versions were named 7910 or 79xx */
+#define SDIO_DEVICE_ID_KS_7010 0x7910
+
+/* Read/Write Status Register */
+#define READ_STATUS0x00
+#define WRITE_STATUS   0x0C
+enum reg_status_type {
+   REG_STATUS_BUSY,
+   REG_STATUS_IDLE
+};
+
+/* Read Index Register */
+#define READ_INDEX 0x04
+
+/* Read Data Size Register */
+#define READ_DATA_SIZE 0x08
+
+/* Write Index Register */
+#define WRITE_INDEX0x10
+
+/* Write Status/Read Data Size Register
+ * for network packet (less than 2048 bytes data)
+ */
+#define WSTATUS_RSIZE  0x14
+#define WSTATUS_MASK   0x80/* Write Status Register value */
+#define RSIZE_MASK 0x7F/* Read Data Size Register value [10:4] 
*/
+
+/* ARM to SD interrupt Enable */
+#define INT_ENABLE 0x20
+/* ARM to SD interrupt Pending */
+#define INT_PENDING0x24
+
+#define INT_GCR_B  BIT(7)
+#define INT_GCR_A  BIT(6)
+#define INT_WRITE_STATUS   BIT(5)
+#define INT_WRITE_INDEXBIT(4)
+#define INT_WRITE_SIZE BIT(3)
+#define INT_READ_STATUSBIT(2)
+#define INT_READ_INDEX BIT(1)
+#define INT_READ_SIZE  BIT(0)
+
+/* General Communication Register A */
+#define GCR_A  0x28
+enum gen_com_reg_a {
+   GCR_A_INIT,
+   GCR_A_REMAP,
+   GCR_A_RUN
+};
+
+/* General Communication Register B */
+#define GCR_B  0x2C
+enum gen_com_reg_b {
+   GCR_B_ACTIVE,
+   GCR_B_DOZE
+};
+
+/* Wakeup Register */
+#define WAKEUP 0x008018
+#define WAKEUP_REQ 0x5a
+
+/* AHB Data Window  0x01-0x01 */
+#define DATA_WINDOW0x01
+#define WINDOW_SIZE(64 * 1024)
+
+#define KS7010_IRAM_ADDRESS0x0600
+
+
 #define KS7010_FUNC_NUM 1
 #define KS7010_IO_BLOCK_SIZE 512
 #define KS7010_MAX_CLOCK 2500
diff --git a/drivers/staging/ks7010/ks7010_sdio.h 
b/drivers/staging/ks7010/ks7010_sdio.h
index 1bcdbe3..95ac86b 100644
--- a/drivers/staging/ks7010/ks7010_sdio.h
+++ b/drivers/staging/ks7010/ks7010_sdio.h
@@ -11,75 +11,6 @@
 #ifndef _KS7010_SDIO_H
 #define _KS7010_SDIO_H
 
-/*  SDIO KeyStream vendor and device */
-#define SDIO_VENDOR_ID_KS_CODE_A   0x005b
-#define SDIO_VENDOR_ID_KS_CODE_B   0x0023
-/* Older sources suggest earlier versions were named 7910 or 79xx */
-#define SDIO_DEVICE_ID_KS_7010 0x7910
-
-/* Read/Write Status Register */
-#define READ_STATUS0x00
-#define WRITE_STATUS   0x0C
-enum reg_status_type {
-   REG_STATUS_BUSY,
-   REG_STATUS_IDLE
-};
-
-/* Read Index Register */
-#define READ_INDEX 0x04
-
-/* Read Data Size Register */
-#define READ_DATA_SIZE 0x08
-
-/* Write Index Register */
-#define WRITE_INDEX0x10
-
-/* Write Status/Read Data Size Register
- * for network packet (less than 2048 bytes data)
- */
-#define WSTATUS_RSIZE  0x14
-#define WSTATUS_MASK   0x80/* Write Status Register value */
-#define RSIZE_MASK 0x7F/* Read Data Size Register value [10:4] 
*/
-
-/* ARM to SD interrupt Enable */
-#define INT_ENABLE 0x20
-/* ARM to SD interrupt Pending */
-#define INT_PENDING0x24
-
-#define INT_GCR_B  BIT(7)
-#define INT_GCR_A  BIT(6)
-#define INT_WRITE_STATUS   BIT(5)
-#define INT_WRITE_INDEXBIT(4)
-#define INT_WRITE_SIZE BIT(3)
-#define INT_READ_STATUSBIT(2)
-#define INT_READ_INDEX BIT(1)
-#define INT_READ_SIZE  BIT(0)
-
-/* General Communication Register A */
-#define GCR_A  0x28
-enum gen_com_reg_a {
-   GCR_A_INIT,
-   GCR_A_REMAP,
-   GCR_A_RUN
-};
-
-/* General Communication Register B */
-#define GCR_B  0x2C
-enum gen_com_reg_b {
-   GCR_B_ACTIVE,
-   GCR_B_DOZE
-};
-
-/* Wakeup Register */
-#define WAKEUP 0x008018
-#define WAKEUP_REQ 0x5a

[PATCH 01/14] staging: ks7010: move ROM_FILE definition into source file

2018-04-12 Thread Sergio Paracuellos
This commit moves ROM_FILE from header to source file because
there is not being used outside this.

Signed-off-by: Sergio Paracuellos 
---
 drivers/staging/ks7010/ks7010_sdio.c | 1 +
 drivers/staging/ks7010/ks7010_sdio.h | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index e475e9f..99f7b1d 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -22,6 +22,7 @@
 #include "ks_hostif.h"
 #include "ks7010_sdio.h"
 
+#define ROM_FILE "ks7010sd.rom"
 #define KS7010_FUNC_NUM 1
 #define KS7010_IO_BLOCK_SIZE 512
 #define KS7010_MAX_CLOCK 2500
diff --git a/drivers/staging/ks7010/ks7010_sdio.h 
b/drivers/staging/ks7010/ks7010_sdio.h
index 3f65845..1bcdbe3 100644
--- a/drivers/staging/ks7010/ks7010_sdio.h
+++ b/drivers/staging/ks7010/ks7010_sdio.h
@@ -154,6 +154,4 @@ struct rx_device {
spinlock_t rx_dev_lock; /* protect access to the queue */
 };
 
-#defineROM_FILE "ks7010sd.rom"
-
 #endif /* _KS7010_SDIO_H */
-- 
2.7.4

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


[PATCH v2] staging: ks7010_sdio: fix memory leak

2018-04-12 Thread Gustavo A. R. Silva
Memory allocated for netdev at line 854:
netdev = alloc_etherdev(sizeof(*priv));
is not being free'd before return, hence
there is a memory leak.

Fix this by freeing netdev before return.

Addresses-Coverity-ID: 1467844
Signed-off-by: Gustavo A. R. Silva 
---
Changes in v2:
 - Update subject and commit changelog.
 - Just directly free netdev. Thanks to Dan Carpenter for the feedback.

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

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index b8f55a1..2c9b92c 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -932,8 +932,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
return 0;
 
  err_free_netdev:
-   free_netdev(priv->net_dev);
-   card->priv = NULL;
+   free_netdev(netdev);
  err_release_irq:
sdio_claim_host(func);
sdio_release_irq(func);
-- 
2.7.4

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


Re: [PATCH 08/15] ASoC: pxa: remove the dmaengine compat need

2018-04-12 Thread Mark Brown
On Mon, Apr 02, 2018 at 04:26:49PM +0200, Robert Jarzmik wrote:
> As the pxa architecture switched towards the dmaengine slave map, the
> old compatibility mechanism to acquire the dma requestor line number and
> priority are not needed anymore.

Acked-by: Mark Brown 

If there's no dependency I'm happy to take this for 4.18.


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


[PATCH 03/17] media: atomisp: fix __user annotations

2018-04-12 Thread Mauro Carvalho Chehab
There are lots of troubles with atomisp __user annotations. Fix them.

drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c:357:49: warning: 
incorrect type in argument 2 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c:357:49:expected 
void *userptr
drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c:357:49:got void 
[noderef] *user_ptr
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:3302:43: warning: 
incorrect type in argument 2 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:3302:43:expected 
void const [noderef] *from
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:3302:43:got void 
const *from
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:4070:58: warning: 
incorrect type in argument 2 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:4070:58:expected 
void const *from
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:4070:58:got 
unsigned short [noderef] *
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:4082:58: warning: 
incorrect type in argument 2 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:4082:58:expected 
void const *from
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:4082:58:got 
unsigned short [noderef] *
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:6179:62: warning: 
incorrect type in argument 2 (different address spaces)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:6179:62:expected 
void const [noderef] *from
drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c:6179:62:got 
unsigned short [usertype] *

Signed-off-by: Mauro Carvalho Chehab 
---
 .../media/atomisp/pci/atomisp2/atomisp_acc.c   |  8 
 .../media/atomisp/pci/atomisp2/atomisp_cmd.c   |  9 +
 .../media/atomisp/pci/atomisp2/atomisp_compat.h|  2 +-
 .../atomisp/pci/atomisp2/atomisp_compat_css20.c|  2 +-
 .../media/atomisp/pci/atomisp2/atomisp_ioctl.c |  2 +-
 .../memory_access/memory_access.h  |  2 +-
 .../pci/atomisp2/css2400/ia_css_frame_public.h |  2 +-
 .../pci/atomisp2/css2400/ia_css_memory_access.c|  4 ++--
 .../pci/atomisp2/css2400/runtime/frame/src/frame.c |  2 +-
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   |  2 +-
 .../media/atomisp/pci/atomisp2/hmm/hmm_bo.c|  4 ++--
 .../atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.c | 22 --
 .../atomisp/pci/atomisp2/hrt/hive_isp_css_mm_hrt.h | 11 ++-
 .../media/atomisp/pci/atomisp2/include/hmm/hmm.h   |  2 +-
 .../atomisp/pci/atomisp2/include/hmm/hmm_bo.h  |  2 +-
 15 files changed, 40 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c
index a6638edee360..7ebcebd80b77 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_acc.c
@@ -353,10 +353,10 @@ int atomisp_acc_map(struct atomisp_sub_device *asd, 
struct atomisp_acc_map *map)
}
 
pgnr = DIV_ROUND_UP(map->length, PAGE_SIZE);
-   cssptr = hrt_isp_css_mm_alloc_user_ptr(
-   map->length, map->user_ptr,
-   pgnr, HRT_USR_PTR,
-   (map->flags & ATOMISP_MAP_FLAG_CACHED));
+   cssptr = hrt_isp_css_mm_alloc_user_ptr(map->length,
+  map->user_ptr,
+  pgnr, HRT_USR_PTR,
+  (map->flags & 
ATOMISP_MAP_FLAG_CACHED));
} else {
/* Allocate private buffer. */
if (map->flags & ATOMISP_MAP_FLAG_CACHED)
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
index fa6ea506f8b1..874165654850 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_cmd.c
@@ -3299,7 +3299,7 @@ static unsigned int long copy_from_compatible(void *to, 
const void *from,
  unsigned long n, bool from_user)
 {
if (from_user)
-   return copy_from_user(to, from, n);
+   return copy_from_user(to, (void __user *)from, n);
else
memcpy(to, from, n);
return 0;
@@ -4067,7 +4067,7 @@ int atomisp_cp_morph_table(struct atomisp_sub_device *asd,
 
for (i = 0; i < CSS_MORPH_TABLE_NUM_PLANES; i++) {
if (copy_from_compatible(morph_table->coordinates_x[i],
-   source_morph_table->coordinates_x[i],
+   (__force void *)source_morph_table->coordinates_x[i],
 #ifndef ISP2401
   

[PATCH 02/17] media: staging: atomisp: don't declare the same vars as both private and public

2018-04-12 Thread Mauro Carvalho Chehab
The mmu_private.h header is included at mmu.c, with duplicates the
already existing definitions at mmu_public.h.

Fix this by removing the erroneous header file.

Solve those issues:


drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h:24:26:
 warning: function 'mmu_reg_store' with external linkage has definition

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h:35:30:
 warning: function 'mmu_reg_load' with external linkage has definition

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h:24:26:
 warning: function 'mmu_reg_store' with external linkage has definition

drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h:35:30:
 warning: function 'mmu_reg_load' with external linkage has definition

Signed-off-by: Mauro Carvalho Chehab 
---
 .../css2400/hive_isp_css_common/host/mmu.c |  4 --
 .../css2400/hive_isp_css_common/host/mmu_private.h | 44 --
 .../css2400/hive_isp_css_include/host/mmu_public.h |  4 +-
 .../css2400/hive_isp_css_include/mmu_device.h  |  8 
 4 files changed, 2 insertions(+), 58 deletions(-)
 delete mode 100644 
drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c
index a28b67eb66ea..1a1719d3e745 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu.c
@@ -15,10 +15,6 @@
 /* The name "mmu.h is already taken" */
 #include "mmu_device.h"
 
-#ifndef __INLINE_MMU__
-#include "mmu_private.h"
-#endif /* __INLINE_MMU__ */
-
 void mmu_set_page_table_base_index(
const mmu_ID_t  ID,
const hrt_data  base_index)
diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h
deleted file mode 100644
index 7377666f6eb7..
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_common/host/mmu_private.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Support for Intel Camera Imaging ISP subsystem.
- * Copyright (c) 2010-2015, Intel Corporation.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- */
-
-#ifndef __MMU_PRIVATE_H_INCLUDED__
-#define __MMU_PRIVATE_H_INCLUDED__
-
-#include "mmu_public.h"
-
-#include "device_access.h"
-
-#include "assert_support.h"
-
-STORAGE_CLASS_MMU_H void mmu_reg_store(
-   const mmu_ID_t  ID,
-   const unsigned int  reg,
-   const hrt_data  value)
-{
-   assert(ID < N_MMU_ID);
-   assert(MMU_BASE[ID] != (hrt_address)-1);
-   ia_css_device_store_uint32(MMU_BASE[ID] + reg*sizeof(hrt_data), value);
-   return;
-}
-
-STORAGE_CLASS_MMU_H hrt_data mmu_reg_load(
-   const mmu_ID_t  ID,
-   const unsigned int  reg)
-{
-   assert(ID < N_MMU_ID);
-   assert(MMU_BASE[ID] != (hrt_address)-1);
-   return ia_css_device_load_uint32(MMU_BASE[ID] + reg*sizeof(hrt_data));
-}
-
-#endif /* __MMU_PRIVATE_H_INCLUDED__ */
diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h
index 0a13eda73607..637e136c4fc5 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/mmu_public.h
@@ -62,7 +62,7 @@ extern void mmu_invalidate_cache_all(void);
 
  \return none, MMU[ID].ctrl[reg] = value
  */
-STORAGE_CLASS_MMU_H void mmu_reg_store(
+extern void mmu_reg_store(
const mmu_ID_t  ID,
const unsigned int  reg,
const hrt_data  value);
@@ -75,7 +75,7 @@ STORAGE_CLASS_MMU_H void mmu_reg_store(
 
  \return MMU[ID].ctrl[reg]
  */
-STORAGE_CLASS_MMU_H hrt_data mmu_reg_load(
+extern hrt_data mmu_reg_load(
const mmu_ID_t  ID,
const unsigned int  reg);
 
diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mmu_device.h
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/mmu_device.h
index 

[PATCH 13/17] media: atomisp: compat32: fix __user annotations

2018-04-12 Thread Mauro Carvalho Chehab
The __user annotations at the compat32 code is not right:

   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:81:18: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:81:18:   
 expected void *base
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:81:18:   
 got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:232:23: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:232:23:  
  expected unsigned int [usertype] *xcoords_y
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:232:23:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:233:23: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:233:23:  
  expected unsigned int [usertype] *ycoords_y
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:233:23:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:234:24: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:234:24:  
  expected unsigned int [usertype] *xcoords_uv
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:234:24:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:235:24: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:235:24:  
  expected unsigned int [usertype] *ycoords_uv
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:235:24:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:296:29: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:296:29:  
  expected unsigned int [usertype] *effective_width
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:296:29:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:360:29: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:360:29:  
  expected unsigned int [usertype] *effective_width
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:360:29:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:437:19: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:437:19:  
  expected struct v4l2_framebuffer *frame
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:437:19:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:481:29: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:481:29:  
  expected unsigned short *calb_grp_values
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:481:29:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:701:39: 
warning: cast removes address space of expression
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:704:21: 
warning: incorrect type in argument 1 (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:704:21:  
  expected void const volatile [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:704:21:  
  got unsigned int [usertype] *src
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:737:43: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:737:43:  
  expected struct atomisp_shading_table *shading_table
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:737:43:  
  got void [noderef] *
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:742:44: 
warning: incorrect type in argument 1 (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:742:44:  
  expected void [noderef] *to
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:742:44:  
  got struct atomisp_shading_table *shading_table
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:755:41: 
warning: incorrect type in assignment (different address spaces)
   drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:755:41:  
  expected struct atomisp_morph_table *morph_table
   

[PATCH 04/17] media: staging: atomisp: fix string comparation logic

2018-04-12 Thread Mauro Carvalho Chehab
it makes no sense to use strncmp() with a size with is
bigger than the string we're comparing with.

Fix those warnings:

drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c:776 
atomisp_open() error: strncmp() '"ATOMISP ISP ACC"' too small (16 vs 32)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c:913 
atomisp_release() error: strncmp() '"ATOMISP ISP ACC"' too small (16 vs 32)
drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c:2751 
atomisp_vidioc_default() error: strncmp() '"ATOMISP ISP ACC"' too small (16 vs 
32)

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c  | 6 ++
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
index 709137f25700..693b905547e4 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_fops.c
@@ -773,8 +773,7 @@ static int atomisp_open(struct file *file)
 
rt_mutex_lock(>mutex);
 
-   acc_node = !strncmp(vdev->name, "ATOMISP ISP ACC",
-   sizeof(vdev->name));
+   acc_node = !strcmp(vdev->name, "ATOMISP ISP ACC");
if (acc_node) {
acc_pipe = atomisp_to_acc_pipe(vdev);
asd = acc_pipe->asd;
@@ -910,8 +909,7 @@ static int atomisp_release(struct file *file)
rt_mutex_lock(>mutex);
 
dev_dbg(isp->dev, "release device %s\n", vdev->name);
-   acc_node = !strncmp(vdev->name, "ATOMISP ISP ACC",
-   sizeof(vdev->name));
+   acc_node = !strcmp(vdev->name, "ATOMISP ISP ACC");
if (acc_node) {
acc_pipe = atomisp_to_acc_pipe(vdev);
asd = acc_pipe->asd;
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
index 6e7231243891..8c67aea67b6b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_ioctl.c
@@ -2748,8 +2748,7 @@ static long atomisp_vidioc_default(struct file *file, 
void *fh,
bool acc_node;
int err;
 
-   acc_node = !strncmp(vdev->name, "ATOMISP ISP ACC",
-   sizeof(vdev->name));
+   acc_node = !strcmp(vdev->name, "ATOMISP ISP ACC");
if (acc_node)
asd = atomisp_to_acc_pipe(vdev)->asd;
else
-- 
2.14.3

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


[PATCH 11/17] media: atomisp: compat32: use get_user() before referencing user data

2018-04-12 Thread Mauro Carvalho Chehab
The logic at get_atomisp_parameters32() is broken, as pointed by
smatch:


drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:737:21: 
warning: dereference of noderef expression

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:744:60: 
warning: dereference of noderef expression

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:763:21: 
warning: dereference of noderef expression

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:770:60: 
warning: dereference of noderef expression

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:788:21: 
warning: dereference of noderef expression

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:795:60: 
warning: dereference of noderef expression

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:812:21: 
warning: dereference of noderef expression

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:819:60: 
warning: dereference of noderef expression

It tries to access userspace data directly, without calling
get_user(). That should generate OOPS. Thankfully, the right
logic is already there (although commented out).

Signed-off-by: Mauro Carvalho Chehab 
---
 .../atomisp/pci/atomisp2/atomisp_compat_ioctl32.c  | 38 --
 1 file changed, 38 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c
index 44c21813a06e..d7c0ef1f9584 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c
@@ -691,10 +691,8 @@ static int get_atomisp_parameters32(struct 
atomisp_parameters *kp,
sizeof(compat_uptr_t);
unsigned int size, offset = 0;
void  __user *user_ptr;
-#ifdef ISP2401
unsigned int stp, mtp, dcp, dscp = 0;
 
-#endif
if (!access_ok(VERIFY_READ, up, sizeof(struct atomisp_parameters32)))
return -EFAULT;
 
@@ -707,15 +705,11 @@ static int get_atomisp_parameters32(struct 
atomisp_parameters *kp,
n--;
}
if (get_user(kp->isp_config_id, >isp_config_id) ||
-#ifndef ISP2401
-   get_user(kp->per_frame_setting, >per_frame_setting))
-#else
get_user(kp->per_frame_setting, >per_frame_setting) ||
get_user(stp, >shading_table) ||
get_user(mtp, >morph_table) ||
get_user(dcp, >dvs2_coefs) ||
get_user(dscp, >dvs_6axis_config))
-#endif
return -EFAULT;
 
{
@@ -733,18 +727,10 @@ static int get_atomisp_parameters32(struct 
atomisp_parameters *kp,
user_ptr = compat_alloc_user_space(size);
 
/* handle shading table */
-#ifndef ISP2401
-   if (up->shading_table != 0) {
-#else
if (stp != 0) {
-#endif
if (get_atomisp_shading_table32(_table,
(struct atomisp_shading_table32 __user *)
-#ifndef ISP2401
-   (uintptr_t)up->shading_table))
-#else
(uintptr_t)stp))
-#endif
return -EFAULT;
 
kp->shading_table = user_ptr + offset;
@@ -759,18 +745,10 @@ static int get_atomisp_parameters32(struct 
atomisp_parameters *kp,
}
 
/* handle morph table */
-#ifndef ISP2401
-   if (up->morph_table != 0) {
-#else
if (mtp != 0) {
-#endif
if (get_atomisp_morph_table32(_table,
(struct atomisp_morph_table32 __user *)
-#ifndef ISP2401
-   (uintptr_t)up->morph_table))
-#else
(uintptr_t)mtp))
-#endif
return -EFAULT;
 
kp->morph_table = user_ptr + offset;
@@ -784,18 +762,10 @@ static int get_atomisp_parameters32(struct 
atomisp_parameters *kp,
}
 
/* handle dvs2 coefficients */
-#ifndef ISP2401
-   if (up->dvs2_coefs != 0) {
-#else
if (dcp != 0) {
-#endif
if (get_atomisp_dis_coefficients32(_coefs,
(struct atomisp_dis_coefficients32 __user *)
-#ifndef ISP2401
-   (uintptr_t)up->dvs2_coefs))
-#else
(uintptr_t)dcp))
-#endif
return -EFAULT;
 
kp->dvs2_coefs = user_ptr + offset;
@@ -808,18 +778,10 @@ static int get_atomisp_parameters32(struct 
atomisp_parameters *kp,
 

[PATCH 14/17] media: atomisp: get rid of a warning

2018-04-12 Thread Mauro Carvalho Chehab
On smatch, this warning is trigged:

drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c:324 
__bo_take_off_handling() error: we previously assumed 'bo->prev' could be null 
(see line 314)

Because it can't properly analize the truth table for the above
function. So, add an explicit check for the final condition there.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c 
b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
index c888f9c809f9..a6620d2c9f50 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm_bo.c
@@ -319,7 +319,7 @@ static void __bo_take_off_handling(struct hmm_buffer_object 
*bo)
 *  to take off this bo, we just set take the "prev/next" pointers
 *  to NULL, the free rbtree stays unchaged
 */
-   } else {
+   } else if (bo->prev != NULL && bo->next != NULL) {
bo->next->prev = bo->prev;
bo->prev->next = bo->next;
bo->next = NULL;
-- 
2.14.3

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


[PATCH 12/17] media: staging: atomisp: add missing include

2018-04-12 Thread Mauro Carvalho Chehab
There are two functions used externally:

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:866:6: 
warning: symbol 'atomisp_do_compat_ioctl' was not declared. Should it be static?

drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c:1110:6: 
warning: symbol 'atomisp_compat_ioctl32' was not declared. Should it be static?

whose include header is missing. Add it.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c 
b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c
index d7c0ef1f9584..15546b1f843d 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_compat_ioctl32.c
@@ -21,6 +21,7 @@
 
 #include "atomisp_internal.h"
 #include "atomisp_compat.h"
+#include "atomisp_ioctl.h"
 #include "atomisp_compat_ioctl32.h"
 
 static int get_atomisp_histogram32(struct atomisp_histogram *kp,
@@ -863,8 +864,8 @@ static long native_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
return ret;
 }
 
-long atomisp_do_compat_ioctl(struct file *file,
-   unsigned int cmd, unsigned long arg)
+static long atomisp_do_compat_ioctl(struct file *file,
+   unsigned int cmd, unsigned long arg)
 {
union {
struct atomisp_histogram his;
-- 
2.14.3

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


[PATCH 01/17] media: staging: atomisp: fix number conversion

2018-04-12 Thread Mauro Carvalho Chehab
smatch says that there's an issue with number
conversion:

   drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c:4154 
sh_css_params_write_to_ddr_internal() warn: '((-(1 << ((14 - 1)' 4294959104 
can't fit into 32767 'converted_macc_table.data[idx]'
   drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c:4157 
sh_css_params_write_to_ddr_internal() warn: '((-(1 << ((14 - 1)' 4294959104 
can't fit into 32767 'converted_macc_table.data[idx + 1]'
   drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c:4160 
sh_css_params_write_to_ddr_internal() warn: '((-(1 << ((14 - 1)' 4294959104 
can't fit into 32767 'converted_macc_table.data[idx + 2]'
   drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_params.c:4163 
sh_css_params_write_to_ddr_internal() warn: '((-(1 << ((14 - 1)' 4294959104 
can't fit into 32767 'converted_macc_table.data[idx + 3]'
   
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.c:168
 ia_css_eed1_8_vmem_encode() warn: assigning (-8192) to unsigned variable 
'to->e_dew_enh_a[0][base + j]'

That's probably because min() and max() definition used there
are really poor ones. So, replace by the in-kernel macro.

Signed-off-by: Mauro Carvalho Chehab 
---
 .../css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.c  | 16 
 .../media/atomisp/pci/atomisp2/css2400/sh_css_frac.h |  2 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.c
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.c
index 47bb5042381b..8f2178bf9e68 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.c
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/eed1_8/ia_css_eed1_8.host.c
@@ -160,17 +160,25 @@ ia_css_eed1_8_vmem_encode(
base = shuffle_block * i;
 
for (j = 0; j < IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS; j++) {
-   to->e_dew_enh_x[0][base + j] = 
min(max(from->dew_enhance_seg_x[j], 0), 8191);
-   to->e_dew_enh_y[0][base + j] = 
min(max(from->dew_enhance_seg_y[j], -8192), 8191);
+   to->e_dew_enh_x[0][base + j] = min_t(int, max_t(int,
+   
from->dew_enhance_seg_x[j], 0),
+   8191);
+   to->e_dew_enh_y[0][base + j] = min_t(int, max_t(int,
+   
from->dew_enhance_seg_y[j], -8192),
+   8191);
}
 
for (j = 0; j < (IA_CSS_NUMBER_OF_DEW_ENHANCE_SEGMENTS - 1); 
j++) {
-   to->e_dew_enh_a[0][base + j] = 
min(max(from->dew_enhance_seg_slope[j], -8192), 8191);
+   to->e_dew_enh_a[0][base + j] = min_t(int, max_t(int,
+   
from->dew_enhance_seg_slope[j],
+   -8192), 
8191);
/* Convert dew_enhance_seg_exp to flag:
 * 0 -> 0
 * 1...13 -> 1
 */
-   to->e_dew_enh_f[0][base + j] = 
(min(max(from->dew_enhance_seg_exp[j], 0), 13) > 0);
+   to->e_dew_enh_f[0][base + j] = (min_t(int, max_t(int,
+
from->dew_enhance_seg_exp[j],
+0), 
13) > 0);
}
 
/* Hard-coded to 0, in order to be able to handle out of
diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_frac.h 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_frac.h
index 1d1771d71f3c..90a63b3921e6 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_frac.h
+++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_frac.h
@@ -30,7 +30,7 @@
 
 /* a:fraction bits for 16bit precision, b:fraction bits for ISP precision */
 #define sDIGIT_FITTING(v, a, b) \
-   min(maxv)>>sSHIFT) >> max(sFRACTION_BITS_FITTING(a)-(b), 0)), \
+   min_t(int, max_t(int, (((v)>>sSHIFT) >> 
max(sFRACTION_BITS_FITTING(a)-(b), 0)), \
  sISP_VAL_MIN), sISP_VAL_MAX)
 #define uDIGIT_FITTING(v, a, b) \
min((unsigned)max((unsigned)(((v)>>uSHIFT) \
-- 
2.14.3

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


[PATCH 08/17] atomisp: remove an impossible condition

2018-04-12 Thread Mauro Carvalho Chehab
Changeset dc9f65cf9aea ("media: staging: atomisp: avoid a warning if 32
bits build") was meant to solve an impossible condition when building
with 32 bits. It turns that this impossible condition also happens wit
64 bits:

drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c:698 
gmin_get_config_var() warn: impossible condition '(*out_len > (~0)) => 
(0-u64max > u64max)'

After a further analysis, this condition will always be false as, on
all architectures, size_t doesn't have more bits than unsigned long.

Also, the only two archs that really matter are x86 and x86_64, as this
driver doesn't build on other archs (as it depends on X86-specific UEFI
support).

So, just drop the useless code.

Fixes: dc9f65cf9aea ("media: staging: atomisp: avoid a warning if 32 bits 
build")
Signed-off-by: Mauro Carvalho Chehab 
---
 .../media/atomisp/platform/intel-mid/atomisp_gmin_platform.c| 6 --
 1 file changed, 6 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c 
b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
index 3283c1b05d6a..70c34de98707 100644
--- a/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c
@@ -693,12 +693,6 @@ static int gmin_get_config_var(struct device *dev, const 
char *var,
for (i = 0; i < sizeof(var8) && var8[i]; i++)
var16[i] = var8[i];
 
-#ifdef CONFIG_64BIT
-   /* To avoid owerflows when calling the efivar API */
-   if (*out_len > ULONG_MAX)
-   return -EINVAL;
-#endif
-
/* Not sure this API usage is kosher; efivar_entry_get()'s
 * implementation simply uses VariableName and VendorGuid from
 * the struct and ignores the rest, but it seems like there
-- 
2.14.3

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


Re: [PATCH][next] staging: ks7010: fix null pointer dereference on priv on error exit

2018-04-12 Thread Colin Ian King
On 12/04/18 16:12, Dan Carpenter wrote:
> This isn't right.  It introduces a leak.

Yup, and I see Gustavo is working on a correct fix, I'll leave that to him.
> 
> regards,
> dan carpenter
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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


Re: [PATCH v7] Revert "PCI: hv: Use device serial number as PCI domain"

2018-04-12 Thread Sridhar Pitchai
>> I am still not happy with this patch.
>> 
>> -  You do not explain at all the dependency on commit 0c195567a8f6 and
>>you should because that's fundamental, if that patch is not present
>>this revert breaks the kernel as per previous discussions[1].
>> -  You are sending this patch to all stable kernels that contain the
>>commit you are fixing - some that may not contain the commit above
>>(that was merged in v4.14), you are breaking those kernels, if not
>>explain me why please

>If there's a dependency on 0c195567a8f6, I totally agree that
>needs to be cleared up.  I was assuming that turned out to be
>irrelevant.
That is right. There is no dependency on 0c195567a8f6. We just need
to revert 4a9b0933bdfc.

Thanks
Sridhar Pitchai
 

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


Re: [PATCH][next] staging: ks7010: fix null pointer dereference on priv on error exit

2018-04-12 Thread Dan Carpenter
This isn't right.  It introduces a leak.

regards,
dan carpenter

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


Re: [PATCH] staging: ks7010_sdio: fix NULL pointer dereference and memory leak

2018-04-12 Thread Dan Carpenter
I added Colin to the Cc list.

On Thu, Apr 12, 2018 at 09:30:09AM -0500, Gustavo A. R. Silva wrote:
> priv is being dereferenced when it is still null, hence there is an
> explicit null pointer dereference at line 935: free_netdev(priv->net_dev)
> 
> Also, memory allocated for netdev at line 854:
> netdev = alloc_etherdev(sizeof(*priv));
> is not being free'd, hence there is a memory leak.
> 
> Fix this by null checking priv before dererefencing it and free netdev
> before return.
> 
> Addresses-Coverity-ID: 1467844 ("Explicit null dereferenced")
> Signed-off-by: Gustavo A. R. Silva 
> ---
>  drivers/staging/ks7010/ks7010_sdio.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
> b/drivers/staging/ks7010/ks7010_sdio.c
> index b8f55a1..f5d4c62 100644
> --- a/drivers/staging/ks7010/ks7010_sdio.c
> +++ b/drivers/staging/ks7010/ks7010_sdio.c
> @@ -932,8 +932,12 @@ static int ks7010_sdio_probe(struct sdio_func *func,
>   return 0;
>  
>   err_free_netdev:
> - free_netdev(priv->net_dev);
> - card->priv = NULL;
> + if (priv) {
> + free_netdev(priv->net_dev);
> + card->priv = NULL;

This isn't required because the next thing we do to card is kfree(card).

> + } else {
> + free_netdev(netdev);
> + }


That's too complicated.  Just do:

err_free_netdev:
free_netdev(net_dev);

err_release_irq:
...

Please send a v2 patch.

regards,
dan carpenter


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


[PATCH][next] staging: ks7010: fix null pointer dereference on priv on error exit

2018-04-12 Thread Colin King
From: Colin Ian King 

In the case where the call to dev_alloc_name fails the current exit
path is via err_free_netdev and this calls free_netdev on a null priv
pointer, hence causing a null pointer dereference.  Fix this by instead
exiting via err_release_irq.

Detected by CoverityScan, CID#1467844 ("Explitic null dereferenced")

Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote 
extra-repository")
Signed-off-by: Colin Ian King 
---
 drivers/staging/ks7010/ks7010_sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index b8f55a11ee1c..cb0e11d79e32 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -895,7 +895,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
netdev_err(priv->net_dev,
   "ks7010: firmware load failed !! return code = %d\n",
   ret);
-   goto err_free_netdev;
+   goto err_release_irq;
}
 
/* interrupt setting */
-- 
2.17.0

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


[PATCH] staging: ks7010_sdio: fix NULL pointer dereference and memory leak

2018-04-12 Thread Gustavo A. R. Silva
priv is being dereferenced when it is still null, hence there is an
explicit null pointer dereference at line 935: free_netdev(priv->net_dev)

Also, memory allocated for netdev at line 854:
netdev = alloc_etherdev(sizeof(*priv));
is not being free'd, hence there is a memory leak.

Fix this by null checking priv before dererefencing it and free netdev
before return.

Addresses-Coverity-ID: 1467844 ("Explicit null dereferenced")
Signed-off-by: Gustavo A. R. Silva 
---
 drivers/staging/ks7010/ks7010_sdio.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index b8f55a1..f5d4c62 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -932,8 +932,12 @@ static int ks7010_sdio_probe(struct sdio_func *func,
return 0;
 
  err_free_netdev:
-   free_netdev(priv->net_dev);
-   card->priv = NULL;
+   if (priv) {
+   free_netdev(priv->net_dev);
+   card->priv = NULL;
+   } else {
+   free_netdev(netdev);
+   }
  err_release_irq:
sdio_claim_host(func);
sdio_release_irq(func);
-- 
2.7.4

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


Re: [PATCH v7] Revert "PCI: hv: Use device serial number as PCI domain"

2018-04-12 Thread Bjorn Helgaas
On Thu, Apr 12, 2018 at 10:17:42AM +0100, Lorenzo Pieralisi wrote:
> On Thu, Apr 12, 2018 at 02:44:42AM +, Sridhar Pitchai wrote:
> > When Linux runs as a guest VM in Hyper-V and Hyper-V adds the virtual PCI
> > bus to the guest, Hyper-V always provides unique PCI domain.
> > 
> > commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain")
> > overrode unique domain with the serial number of the first device added to
> > the virtual PCI bus.
> > 
> > The reason for that patch was to have a consistent and short name for the
> > device, but Hyper-V doesn't provide unique serial numbers. Using non-unique
> > serial numbers as domain IDs leads to duplicate device addresses, which
> > causes PCI bus registration to fail.
> > 
> > Revert commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI
> > domain") so we can reliably support multiple devices being assigned to
> > a guest.
> > 
> > Fixes: 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain")
> > Signed-off-by: Sridhar Pitchai 
> > Cc: sta...@vger.kernel.org
> 
> I am still not happy with this patch.
> 
> -  You do not explain at all the dependency on commit 0c195567a8f6 and
>you should because that's fundamental, if that patch is not present
>this revert breaks the kernel as per previous discussions[1].
> -  You are sending this patch to all stable kernels that contain the
>commit you are fixing - some that may not contain the commit above
>(that was merged in v4.14), you are breaking those kernels, if not
>explain me why please

If there's a dependency on 0c195567a8f6, I totally agree that
needs to be cleared up.  I was assuming that turned out to be
irrelevant.

> [1] https://marc.info/?l=linux-pci=152158684221212=2
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v7] Revert "PCI: hv: Use device serial number as PCI domain"

2018-04-12 Thread Lorenzo Pieralisi
On Thu, Apr 12, 2018 at 02:44:42AM +, Sridhar Pitchai wrote:
> When Linux runs as a guest VM in Hyper-V and Hyper-V adds the virtual PCI
> bus to the guest, Hyper-V always provides unique PCI domain.
> 
> commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain")
> overrode unique domain with the serial number of the first device added to
> the virtual PCI bus.
> 
> The reason for that patch was to have a consistent and short name for the
> device, but Hyper-V doesn't provide unique serial numbers. Using non-unique
> serial numbers as domain IDs leads to duplicate device addresses, which
> causes PCI bus registration to fail.
> 
> Revert commit 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI
> domain") so we can reliably support multiple devices being assigned to
> a guest.
> 
> Fixes: 4a9b0933bdfc ("PCI: hv: Use device serial number as PCI domain")
> Signed-off-by: Sridhar Pitchai 
> Cc: sta...@vger.kernel.org

I am still not happy with this patch.

-  You do not explain at all the dependency on commit 0c195567a8f6 and
   you should because that's fundamental, if that patch is not present
   this revert breaks the kernel as per previous discussions[1].
-  You are sending this patch to all stable kernels that contain the
   commit you are fixing - some that may not contain the commit above
   (that was merged in v4.14), you are breaking those kernels, if not
   explain me why please

You must mark the stable kernels you want this revert to be applied to
eg:

Cc:  # v4.14+

and for kernels that do not contain the 0c195567a8f6 commit you have to
add the dependency. Please read the documentation Greg provided you in
relation to stable kernel rules.

Use:

git tag --contains

to detect in what kernel version the given commits are present.

[1] https://marc.info/?l=linux-pci=152158684221212=2

> Reviewed-by: Bjorn Helgaas 
> 
> ---
> Changes in v7:
> * fix the commit comment. [Bjorn Helgaas]
> ---
>  drivers/pci/host/pci-hyperv.c | 11 ---
>  1 file changed, 11 deletions(-)
> 
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> index 2faf38eab785..ac67e56e451a 100644
> --- a/drivers/pci/host/pci-hyperv.c
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -1518,17 +1518,6 @@ static struct hv_pci_dev *new_pcichild_device(struct 
> hv_pcibus_device *hbus,
>   get_pcichild(hpdev, hv_pcidev_ref_childlist);
>   spin_lock_irqsave(>device_list_lock, flags);
>  
> - /*
> -  * When a device is being added to the bus, we set the PCI domain
> -  * number to be the device serial number, which is non-zero and
> -  * unique on the same VM.  The serial numbers start with 1, and
> -  * increase by 1 for each device.  So device names including this
> -  * can have shorter names than based on the bus instance UUID.
> -  * Only the first device serial number is used for domain, so the
> -  * domain number will not change after the first device is added.
> -  */
> - if (list_empty(>children))
> - hbus->sysdata.domain = desc->ser;
>   list_add_tail(>list_entry, >children);
>   spin_unlock_irqrestore(>device_list_lock, flags);
>   return hpdev;
> -- 
> 2.14.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: wilc1000: fix NULL pointer exception in host_int_parse_assoc_resp_info()

2018-04-12 Thread Ajay Singh
Commit fe014d4e6b55 (staging: wilc1000: free memory allocated for general info
message from firmware) introduced a bug by using wrong source address in
kmemdup(). 'conn_info.req_ies' is used for source address in kempdup()
instead of 'hif_drv->usr_conn_req.ies'.

This commit fixes the NULL pointer dereference issue in
host_int_parse_assoc_resp_info() by using the correct source address in
kmemdup().

Fixes: fe014d4e6b55 (staging: wilc1000: free memory allocated for
general info message from firmware)
Signed-off-by: Ajay Singh 
---
 drivers/staging/wilc1000/host_interface.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 316d73c..302e3cb 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1387,7 +1387,7 @@ static inline void host_int_parse_assoc_resp_info(struct 
wilc_vif *vif,
}
 
if (hif_drv->usr_conn_req.ies) {
-   conn_info.req_ies = kmemdup(conn_info.req_ies,
+   conn_info.req_ies = kmemdup(hif_drv->usr_conn_req.ies,
hif_drv->usr_conn_req.ies_len,
GFP_KERNEL);
if (conn_info.req_ies)
-- 
2.7.4

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


Re: [PATCH v2] staging: wilc1000: Remove unnecessary braces {} around single statement block

2018-04-12 Thread Claudiu Beznea


On 12.04.2018 10:59, Eyal Ilsar wrote:
> Remove unnecessary braces {} around an 'if' statement block with a single 
> statement. Issue found by checkpatch.
> 
> Signed-off-by: Eyal Ilsar 

Reviewed-by: Claudiu Beznea 

> ---
> Added an empty line before the 'Signed-off-by' line and a space between the
> name and e-mail address within that line.
> 
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> index 205304c..325afe1 100644
> --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> @@ -284,9 +284,8 @@ static void remove_network_from_shadow(struct timer_list 
> *unused)
>   }
>   }
>  
> - if (last_scanned_cnt != 0) {
> + if (last_scanned_cnt != 0)
>   mod_timer(, jiffies + msecs_to_jiffies(AGING_TIME));
> - }
>  }
>  
>  static void clear_duringIP(struct timer_list *unused)
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: wilc1000: Remove unnecessary braces {} around single statement block

2018-04-12 Thread Eyal Ilsar
Remove unnecessary braces {} around an 'if' statement block with a single 
statement. Issue found by checkpatch.

Signed-off-by: Eyal Ilsar 
---
Added an empty line before the 'Signed-off-by' line and a space between the
name and e-mail address within that line.

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

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 205304c..325afe1 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -284,9 +284,8 @@ static void remove_network_from_shadow(struct timer_list 
*unused)
}
}
 
-   if (last_scanned_cnt != 0) {
+   if (last_scanned_cnt != 0)
mod_timer(, jiffies + msecs_to_jiffies(AGING_TIME));
-   }
 }
 
 static void clear_duringIP(struct timer_list *unused)
-- 
2.7.4

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


Re: [PATCH] staging: wilc1000: Remove unnecessary braces {} around single statement block

2018-04-12 Thread Claudiu Beznea


On 10.04.2018 17:49, Eyal Ilsar wrote:
> Remove unnecessary braces {} around an 'if' statement block with a single 
> statement. Issue found by checkpatch.

You should add an empty line before "Signed-off" line as stated in [1]. I
would also add a space b/w your name and your email in Signed-off line as
is exemplified in [2].

[1]
https://www.kernel.org/doc/html/latest/process/submitting-patches.html#the-canonical-patch-format
[2] https://www.kernel.org/doc/html/latest/process/sub
mitting-patches.html#developer-s-certificate-of-origin-1-1

> Signed-off-by: Eyal Ilsar
> ---
> This is part of my take on the Eudyptula challenge
> 
>  drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
> b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> index 205304c..325afe1 100644
> --- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> +++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
> @@ -284,9 +284,8 @@ static void remove_network_from_shadow(struct timer_list 
> *unused)
>   }
>   }
>  
> - if (last_scanned_cnt != 0) {
> + if (last_scanned_cnt != 0)
>   mod_timer(, jiffies + msecs_to_jiffies(AGING_TIME));
> - }
>  }
>  
>  static void clear_duringIP(struct timer_list *unused)
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel