[PATCH] staging: media: atomisp: Remove inclusion of non-existing directories

2018-02-22 Thread Corentin Labbe
This patch fix the following build warnings:
  CC [M]  drivers/staging/media/atomisp/pci/atomisp2/atomisp_drvfs.o
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/:
 No such file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/plane_io_ls/:
 No such file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/io_ls/yuv420_io_ls/:
 No such file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/:
 No such file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/:
 No such file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/s3a_stat_ls/: No 
such file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/scale/: No such 
file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/scale/scale_1.0/:
 No such file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls: No such 
file or directory [-Wmissing-include-dirs]
cc1: warning: 
drivers/staging/media/atomisp/pci/atomisp2/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/:
 No such file or directory [-Wmissing-include-dirs]
by removing the inclusion of such directories

Signed-off-by: Corentin Labbe 
---
 drivers/staging/media/atomisp/pci/atomisp2/Makefile | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/Makefile 
b/drivers/staging/media/atomisp/pci/atomisp2/Makefile
index ac3805345f20..83f816faba1b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/Makefile
+++ b/drivers/staging/media/atomisp/pci/atomisp2/Makefile
@@ -215,7 +215,6 @@ INCLUDES += \
-I$(atomisp)/css2400/isp/kernels/aa/aa_2/ \
-I$(atomisp)/css2400/isp/kernels/anr/anr_1.0/ \
-I$(atomisp)/css2400/isp/kernels/anr/anr_2/ \
-   -I$(atomisp)/css2400/isp/kernels/bayer_ls/bayer_ls_1.0/ \
-I$(atomisp)/css2400/isp/kernels/bh/bh_2/ \
-I$(atomisp)/css2400/isp/kernels/bnlm/ \
-I$(atomisp)/css2400/isp/kernels/bnr/ \
@@ -258,14 +257,10 @@ INCLUDES += \
-I$(atomisp)/css2400/isp/kernels/io_ls/ \
-I$(atomisp)/css2400/isp/kernels/io_ls/bayer_io_ls/ \
-I$(atomisp)/css2400/isp/kernels/io_ls/common/ \
-   -I$(atomisp)/css2400/isp/kernels/io_ls/plane_io_ls/ \
-   -I$(atomisp)/css2400/isp/kernels/io_ls/yuv420_io_ls/ \
-I$(atomisp)/css2400/isp/kernels/io_ls/yuv444_io_ls/ \
-I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/ \
-I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/bayer_io_ls/ \
-I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/common/ \
-   -I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/plane_io_ls/ \
-   -I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/yuv420_io_ls/ \
-I$(atomisp)/css2400/isp/kernels/ipu2_io_ls/yuv444_io_ls/ \
-I$(atomisp)/css2400/isp/kernels/iterator/ \
-I$(atomisp)/css2400/isp/kernels/iterator/iterator_1.0/ \
@@ -289,9 +284,6 @@ INCLUDES += \
-I$(atomisp)/css2400/isp/kernels/ref/ref_1.0/ \
-I$(atomisp)/css2400/isp/kernels/s3a/ \
-I$(atomisp)/css2400/isp/kernels/s3a/s3a_1.0/ \
-   -I$(atomisp)/css2400/isp/kernels/s3a_stat_ls/ \
-   -I$(atomisp)/css2400/isp/kernels/scale/ \
-   -I$(atomisp)/css2400/isp/kernels/scale/scale_1.0/ \
-I$(atomisp)/css2400/isp/kernels/sc/ \
-I$(atomisp)/css2400/isp/kernels/sc/sc_1.0/ \
-I$(atomisp)/css2400/isp/kernels/sdis/ \
@@ -315,8 +307,6 @@ INCLUDES += \
-I$(atomisp)/css2400/isp/kernels/ynr/ \
-I$(atomisp)/css2400/isp/kernels/ynr/ynr_1.0/ \
-I$(atomisp)/css2400/isp/kernels/ynr/ynr_2/ \
-   -I$(atomisp)/css2400/isp/kernels/yuv_ls \
-   -I$(atomisp)/css2400/isp/kernels/yuv_ls/yuv_ls_1.0/ \
-I$(atomisp)/css2400/isp/modes/interface/ \
-I$(atomisp)/css2400/runtime/binary/interface/ \
-I$(atomisp)/css2400/runtime/bufq/interface/ \
-- 
2.16.1

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


Re: [PATCH 1/4] staging: wilc1000: remove use of 'happened' variable in wilc_spi_read_int()

2018-02-22 Thread Ajay Singh
Hi Dan,

On Thu, 22 Feb 2018 10:20:58 +0300
Dan Carpenter  wrote:

> On Wed, Feb 21, 2018 at 09:42:09PM +0530, Ajay Singh wrote:
> > Modified wilc_spi_read_int() by removing unnecessary use of "happened"
> > variable.
> > 
> > Signed-off-by: Ajay Singh 
> > ---
> >  drivers/staging/wilc1000/wilc_spi.c | 8 +++-
> >  1 file changed, 3 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/staging/wilc1000/wilc_spi.c 
> > b/drivers/staging/wilc1000/wilc_spi.c
> > index 6b392c9..131d2b7 100644
> > --- a/drivers/staging/wilc1000/wilc_spi.c
> > +++ b/drivers/staging/wilc1000/wilc_spi.c
> > @@ -936,7 +936,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
> > *int_status)
> > int ret;
> > u32 tmp;
> > u32 byte_cnt;
> > -   int happened, j;
> > +   int j;
> > u32 unknown_mask;
> > u32 irq_flags;
> > int k = IRG_FLAGS_OFFSET + 5;
> > @@ -956,8 +956,6 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
> > *int_status)
> >  
> > j = 0;
> > do {
> > -   happened = 0;
> > -
> > wilc_spi_read_reg(wilc, 0x1a90, &irq_flags);
> > tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
> >  
> > @@ -972,11 +970,11 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
> > *int_status)
> > dev_err(&spi->dev,
> > "Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
> > j, tmp, unknown_mask);
> > -   happened = 1;
> > +   break;  
> 
> This is flipped around.  happened means don't break, but you've changed
> it to be the opposite.

You are right. Thanks for pointing it out. It's was a mistake. I will
change 'break' to 'continue' and while(1) to while(0) and resubmit the
patch.


Regards,
Ajay

> 
> regards,
> dan carpenter
> 
> > }
> >  
> > j++;
> > -   } while (happened);
> > +   } while (1);
> >
> 


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


Re: [PATCH v2 4/9] staging: android: ion: Avoid NULL point in error path

2018-02-22 Thread Yisheng Xie
Hi Greg,

Sorry for late responds for I was on vacation.

On 2018/2/17 0:27, Greg KH wrote:
> On Mon, Feb 12, 2018 at 06:43:09PM +0800, Yisheng Xie wrote:
>> If we failed to create debugfs for ion at ion_device_create, the
>> debug_root of ion_device will be NULL, and then when try to create debug
>> file for shrinker of heap it will be create on the top of debugfs. If we
>> also failed to create this the debug file, it call dentry_path to found
>> the path of debug_root, then a NULL point will occur.
>>
>> Fix this by avoiding call dentry_path, but show the debug name only when
>> failed to create debug file for shrinker.
>>
>> Acked-by: Laura Abbott 
>> Signed-off-by: Yisheng Xie 
>> ---
>>  drivers/staging/android/ion/ion.c | 10 +++---
>>  1 file changed, 3 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/staging/android/ion/ion.c 
>> b/drivers/staging/android/ion/ion.c
>> index 57e0d80..4b69372 100644
>> --- a/drivers/staging/android/ion/ion.c
>> +++ b/drivers/staging/android/ion/ion.c
>> @@ -564,13 +564,9 @@ void ion_device_add_heap(struct ion_heap *heap)
>>  debug_file = debugfs_create_file(debug_name,
>>   0644, dev->debug_root, heap,
>>   &debug_shrink_fops);
>> -if (!debug_file) {
>> -char buf[256], *path;
>> -
>> -path = dentry_path(dev->debug_root, buf, 256);
>> -pr_err("Failed to create heap shrinker debugfs at 
>> %s/%s\n",
>> -   path, debug_name);
>> -}
>> +if (!debug_file)
>> +pr_err("Failed to create ion heap shrinker debugfs at 
>> %s\n",
>> +   debug_name);
> 
> Really we can just remove this, there's no need to check the return
> value of this debugfs call at all, it doesn't matter.

Right, and I found that you have already patched this patch into next, should I 
send
another version for the two patches your commented, or just send fix patches to 
fold?

Thanks
Yisheng
> 
> thanks,
> 
> greg k-h
> 
> .
> 

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


Re: [PATCH 1/4] staging: wilc1000: remove use of 'happened' variable in wilc_spi_read_int()

2018-02-22 Thread Dan Carpenter
On Thu, Feb 22, 2018 at 02:09:01PM +0530, Ajay Singh wrote:
> Hi Dan,
> 
> On Thu, 22 Feb 2018 10:20:58 +0300
> Dan Carpenter  wrote:
> 
> > On Wed, Feb 21, 2018 at 09:42:09PM +0530, Ajay Singh wrote:
> > > Modified wilc_spi_read_int() by removing unnecessary use of "happened"
> > > variable.
> > > 
> > > Signed-off-by: Ajay Singh 
> > > ---
> > >  drivers/staging/wilc1000/wilc_spi.c | 8 +++-
> > >  1 file changed, 3 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/staging/wilc1000/wilc_spi.c 
> > > b/drivers/staging/wilc1000/wilc_spi.c
> > > index 6b392c9..131d2b7 100644
> > > --- a/drivers/staging/wilc1000/wilc_spi.c
> > > +++ b/drivers/staging/wilc1000/wilc_spi.c
> > > @@ -936,7 +936,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
> > > *int_status)
> > >   int ret;
> > >   u32 tmp;
> > >   u32 byte_cnt;
> > > - int happened, j;
> > > + int j;
> > >   u32 unknown_mask;
> > >   u32 irq_flags;
> > >   int k = IRG_FLAGS_OFFSET + 5;
> > > @@ -956,8 +956,6 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
> > > *int_status)
> > >  
> > >   j = 0;
> > >   do {
> > > - happened = 0;
> > > -
> > >   wilc_spi_read_reg(wilc, 0x1a90, &irq_flags);
> > >   tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
> > >  
> > > @@ -972,11 +970,11 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
> > > *int_status)
> > >   dev_err(&spi->dev,
> > >   "Unexpected interrupt(2):j=%d,tmp=%x,mask=%x\n",
> > >   j, tmp, unknown_mask);
> > > - happened = 1;
> > > + break;  
> > 
> > This is flipped around.  happened means don't break, but you've changed
> > it to be the opposite.
> 
> You are right. Thanks for pointing it out. It's was a mistake. I will
> change 'break' to 'continue' and while(1) to while(0) and resubmit the
> patch.
> 

Don't be in a hurry to resend.  I always wait over night before
resending so that I'm not stressed when I review it.  What you are
proposing still sounds wrong because the j++ is essential.  Anyway, I
can't really review your v2 patch until you send it.

regards,
dan carpenter

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


Re: [PATCH v2 4/9] staging: android: ion: Avoid NULL point in error path

2018-02-22 Thread Greg KH
On Thu, Feb 22, 2018 at 04:59:27PM +0800, Yisheng Xie wrote:
> Hi Greg,
> 
> Sorry for late responds for I was on vacation.
> 
> On 2018/2/17 0:27, Greg KH wrote:
> > On Mon, Feb 12, 2018 at 06:43:09PM +0800, Yisheng Xie wrote:
> >> If we failed to create debugfs for ion at ion_device_create, the
> >> debug_root of ion_device will be NULL, and then when try to create debug
> >> file for shrinker of heap it will be create on the top of debugfs. If we
> >> also failed to create this the debug file, it call dentry_path to found
> >> the path of debug_root, then a NULL point will occur.
> >>
> >> Fix this by avoiding call dentry_path, but show the debug name only when
> >> failed to create debug file for shrinker.
> >>
> >> Acked-by: Laura Abbott 
> >> Signed-off-by: Yisheng Xie 
> >> ---
> >>  drivers/staging/android/ion/ion.c | 10 +++---
> >>  1 file changed, 3 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/drivers/staging/android/ion/ion.c 
> >> b/drivers/staging/android/ion/ion.c
> >> index 57e0d80..4b69372 100644
> >> --- a/drivers/staging/android/ion/ion.c
> >> +++ b/drivers/staging/android/ion/ion.c
> >> @@ -564,13 +564,9 @@ void ion_device_add_heap(struct ion_heap *heap)
> >>debug_file = debugfs_create_file(debug_name,
> >> 0644, dev->debug_root, heap,
> >> &debug_shrink_fops);
> >> -  if (!debug_file) {
> >> -  char buf[256], *path;
> >> -
> >> -  path = dentry_path(dev->debug_root, buf, 256);
> >> -  pr_err("Failed to create heap shrinker debugfs at 
> >> %s/%s\n",
> >> - path, debug_name);
> >> -  }
> >> +  if (!debug_file)
> >> +  pr_err("Failed to create ion heap shrinker debugfs at 
> >> %s\n",
> >> + debug_name);
> > 
> > Really we can just remove this, there's no need to check the return
> > value of this debugfs call at all, it doesn't matter.
> 
> Right, and I found that you have already patched this patch into next, should 
> I send
> another version for the two patches your commented, or just send fix patches 
> to fold?

Just send add-on patches, I can't "fold" anything as the commit is
already in the tree.

thanks,

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


[PATCH] staging: lustre: selftest: freeing an error pointer

2018-02-22 Thread Dan Carpenter
We should just return directly if memdup_user() fails. The current code
tries to free "param" which is an error pointer so it will Oops.

Fixes: 2baddf262e98 ("staging: lustre: use memdup_user to allocate memory and 
copy from user")
Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c 
b/drivers/staging/lustre/lnet/selftest/conctl.c
index 3c919a536e91..51497cf9a832 100644
--- a/drivers/staging/lustre/lnet/selftest/conctl.c
+++ b/drivers/staging/lustre/lnet/selftest/conctl.c
@@ -650,10 +650,8 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
if (args->lstio_tes_param) {
param = memdup_user(args->lstio_tes_param,
args->lstio_tes_param_len);
-   if (IS_ERR(param)) {
-   rc = PTR_ERR(param);
-   goto out;
-   }
+   if (IS_ERR(param))
+   return PTR_ERR(param);
}
 
rc = -EFAULT;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/4] staging: wilc1000: modified wilc_spi_read_int() by using GENMASK macro

2018-02-22 Thread Claudiu Beznea
Hi Dan,

On 22.02.2018 09:37, Dan Carpenter wrote:
> On Wed, Feb 21, 2018 at 09:42:10PM +0530, Ajay Singh wrote:
>> Use existing macro GENMASK to get the bitmask value. Moved the code to
>> get the bitmask value outside the loop, as its only required one time.
>>
>> Signed-off-by: Ajay Singh 
>> ---
>>  drivers/staging/wilc1000/wilc_spi.c | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/wilc1000/wilc_spi.c 
>> b/drivers/staging/wilc1000/wilc_spi.c
>> index 131d2b7..c63f534 100644
>> --- a/drivers/staging/wilc1000/wilc_spi.c
>> +++ b/drivers/staging/wilc1000/wilc_spi.c
>> @@ -955,6 +955,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
>> *int_status)
>>  tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK;
>>  
>>  j = 0;
>> +unknown_mask = GENMASK(g_spi.nint - 1, 0);
>>  do {
>>  wilc_spi_read_reg(wilc, 0x1a90, &irq_flags);
>>  tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
>> @@ -964,8 +965,6 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
>> *int_status)
>>  tmp |= (((irq_flags >> 0) & 0x7) << k);
>>  }
>>  
>> -unknown_mask = ~((1ul << g_spi.nint) - 1);
>> -
> 
> This isn't right at all...  Say g_spi.nint is zero, then we're doing
> GENMASK(-1, 0) which seems like it should be undefined.  If g_spi.nint
> is 1 then "GENMASK(1 - 1, 0)" is 0x1 but "~((1 < 1) - 1)" is ~0x1.
> 

Even in this driver g_spi.nint is always constant and equal with NUM_INT_EXT
(which is 3), it seems that enabling interrupts before initializing g_spi.nint
may lead to the state where g_spi.nint = 0, as Dan pointed.

int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
{
// ...
if (wl->gpio >= 0 && init_irq(dev)) {
ret = -EIO;
goto _fail_locks_;
}

// ...
ret = linux_wlan_start_firmware(dev); -> calls
linux_wlan_start_firmware which in turn calls wilc->hif_func->hif_sync_ext(wilc,
NUM_INT_EXT);


}

Thank you,
Claudiu Beznea

> I'm done reviewing this patch series...  You need to be more careful.
> Create a small test program to test your patches.  As a reviewer,
> creating test programs is how I review your patches.
> 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include "/home/dcarpenter/progs/smatch/devel/check_debug.h"
> #include "kernel.h"
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> 
> #define BITS_PER_LONG 64
> #define GENMASK(h, l) \
> (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h
> 
> int main(void)
> {
> int i;
> u32 mask1, mask2;
> 
> for (i = 0; i < 32; i++) {
> mask1 = ~((1ul << i) - 1);
> mask2 = GENMASK(i - 1, 0);
> if (mask1 == mask2)
> continue;
> printf("ONE 0x%x %d\n", mask1, i);
> printf("TWO 0x%x\n", mask2);
> }
> return 0;
> }
> 
> regards,
> dan carpenter
> 
> 
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/4] staging: wilc1000: modified wilc_spi_read_int() by using GENMASK macro

2018-02-22 Thread Claudiu Beznea


On 22.02.2018 11:23, Claudiu Beznea wrote:
> Hi Dan,
Sorry, I intended to be address this to Ajay,
> 
> On 22.02.2018 09:37, Dan Carpenter wrote:
>> On Wed, Feb 21, 2018 at 09:42:10PM +0530, Ajay Singh wrote:
>>> Use existing macro GENMASK to get the bitmask value. Moved the code to
>>> get the bitmask value outside the loop, as its only required one time.
>>>
>>> Signed-off-by: Ajay Singh 
>>> ---
>>>  drivers/staging/wilc1000/wilc_spi.c | 3 +--
>>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/staging/wilc1000/wilc_spi.c 
>>> b/drivers/staging/wilc1000/wilc_spi.c
>>> index 131d2b7..c63f534 100644
>>> --- a/drivers/staging/wilc1000/wilc_spi.c
>>> +++ b/drivers/staging/wilc1000/wilc_spi.c
>>> @@ -955,6 +955,7 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
>>> *int_status)
>>> tmp = (byte_cnt >> 2) & IRQ_DMA_WD_CNT_MASK;
>>>  
>>> j = 0;
>>> +   unknown_mask = GENMASK(g_spi.nint - 1, 0);
>>> do {
>>> wilc_spi_read_reg(wilc, 0x1a90, &irq_flags);
>>> tmp |= ((irq_flags >> 27) << IRG_FLAGS_OFFSET);
>>> @@ -964,8 +965,6 @@ static int wilc_spi_read_int(struct wilc *wilc, u32 
>>> *int_status)
>>> tmp |= (((irq_flags >> 0) & 0x7) << k);
>>> }
>>>  
>>> -   unknown_mask = ~((1ul << g_spi.nint) - 1);
>>> -
>>
>> This isn't right at all...  Say g_spi.nint is zero, then we're doing
>> GENMASK(-1, 0) which seems like it should be undefined.  If g_spi.nint
>> is 1 then "GENMASK(1 - 1, 0)" is 0x1 but "~((1 < 1) - 1)" is ~0x1.
>>
> 
> Even in this driver g_spi.nint is always constant and equal with NUM_INT_EXT
> (which is 3), it seems that enabling interrupts before initializing g_spi.nint
> may lead to the state where g_spi.nint = 0, as Dan pointed.
> 
> int wilc1000_wlan_init(struct net_device *dev, struct wilc_vif *vif)
> {
>   // ...
> if (wl->gpio >= 0 && init_irq(dev)) {
> ret = -EIO;
> goto _fail_locks_;
> }
> 
>   // ...
> ret = linux_wlan_start_firmware(dev); -> calls
> linux_wlan_start_firmware which in turn calls 
> wilc->hif_func->hif_sync_ext(wilc,
> NUM_INT_EXT);
> 
>   
> }
> 
> Thank you,
> Claudiu Beznea
> 
>> I'm done reviewing this patch series...  You need to be more careful.
>> Create a small test program to test your patches.  As a reviewer,
>> creating test programs is how I review your patches.
>>
>> #include 
>> #include 
>> #include 
>> #include 
>> #include 
>> #include 
>> #include 
>> #include "/home/dcarpenter/progs/smatch/devel/check_debug.h"
>> #include "kernel.h"
>> #include 
>> #include 
>> #include 
>> #include 
>> #include 
>> #include 
>>
>> #define BITS_PER_LONG 64
>> #define GENMASK(h, l) \
>> (((~0UL) - (1UL << (l)) + 1) & (~0UL >> (BITS_PER_LONG - 1 - (h
>>
>> int main(void)
>> {
>> int i;
>> u32 mask1, mask2;
>>
>> for (i = 0; i < 32; i++) {
>> mask1 = ~((1ul << i) - 1);
>> mask2 = GENMASK(i - 1, 0);
>> if (mask1 == mask2)
>> continue;
>> printf("ONE 0x%x %d\n", mask1, i);
>> printf("TWO 0x%x\n", mask2);
>> }
>> return 0;
>> }
>>
>> regards,
>> dan carpenter
>>
>>
>>
>> ___
>> devel mailing list
>> de...@linuxdriverproject.org
>> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
>>
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH -next 2/2] staging: android: ion: Remove check of idev->debug_root

2018-02-22 Thread Yisheng Xie
We will go on initial idev if failed to create debug_root, and it does
not matter to check the return value of this debugfs call, just remove it.

Signed-off-by: Yisheng Xie 
---
 drivers/staging/android/ion/ion.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 0606d50..e74db79 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -585,9 +585,6 @@ static int ion_device_create(void)
}
 
idev->debug_root = debugfs_create_dir("ion", NULL);
-   if (!idev->debug_root)
-   pr_err("ion: failed to create debugfs root directory.\n");
-
idev->buffers = RB_ROOT;
mutex_init(&idev->buffer_lock);
init_rwsem(&idev->lock);
-- 
1.7.12.4

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


[PATCH -next 1/2] staging: android: ion: Remove check of debug_file

2018-02-22 Thread Yisheng Xie
There's no need to check the return value of debug_file for it is just a
debugfs and we will go on the following process if we failed to create
debug_file. So just remove it.

Signed-off-by: Yisheng Xie 
---
 drivers/staging/android/ion/ion.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 74d9a4e..0606d50 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -522,7 +522,6 @@ static int debug_shrink_get(void *data, u64 *val)
 
 void ion_device_add_heap(struct ion_heap *heap)
 {
-   struct dentry *debug_file;
struct ion_device *dev = internal_dev;
int ret;
 
@@ -556,12 +555,8 @@ void ion_device_add_heap(struct ion_heap *heap)
char debug_name[64];
 
snprintf(debug_name, 64, "%s_shrink", heap->name);
-   debug_file = debugfs_create_file(debug_name,
-0644, dev->debug_root, heap,
-&debug_shrink_fops);
-   if (!debug_file)
-   pr_err("Failed to create ion heap shrinker debugfs at 
%s\n",
-  debug_name);
+   debugfs_create_file(debug_name, 0644, dev->debug_root,
+   heap, &debug_shrink_fops);
}
 
dev->heap_cnt++;
-- 
1.7.12.4

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


[GIT PULL] Staging/IIO fixes for 4.16-rc3

2018-02-22 Thread Greg KH
The following changes since commit 7928b2cbe55b2a410a0f5c1f154610059c57b1b2:

  Linux 4.16-rc1 (2018-02-11 15:04:29 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ 
tags/staging-4.16-rc2

for you to fetch changes up to c6754712e05317923e3f67ac01d45c7d5ec6f79f:

  Merge tag 'iio-fixes-for-4.16a' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus 
(2018-02-20 10:03:22 +0100)


Staging/IIO fixes for 4.16-rc2

Here are a small number of staging and iio driver fixes for 4.16-rc2.

The IIO fixes are all for reported things, and the android driver fixes
also resolve some reported problems.  The remaining fsl-mc Kconfig
change resolves a build testing error that Arnd reported.

All of these have been in linux-next with no reported issues.

Signed-off-by: Greg Kroah-Hartman 


Alexandru Ardelean (2):
  staging: iio: adc: ad7192: fix external frequency setting
  staging: iio: ad5933: switch buffer mode to software

Andreas Klinger (1):
  iio: srf08: fix link error "devm_iio_triggered_buffer_setup" undefined

Arnd Bergmann (1):
  staging: fsl-mc: fix build testing on x86

Ben Hutchings (1):
  staging: android: ashmem: Fix a race condition in pin ioctls

Christophe JAILLET (1):
  iio: adc: aspeed: Fix error handling path

Fabrice Gasnier (1):
  iio: adc: stm32: fix stm32h7_adc_enable error handling

Greg Kroah-Hartman (1):
  Merge tag 'iio-fixes-for-4.16a' of git://git.kernel.org/.../jic23/iio 
into staging-linus

Lars-Peter Clausen (1):
  iio: adis_lib: Initialize trigger before requesting interrupt

Liam Mark (1):
  staging: android: ion: Zero CMA allocated memory

Stefan Windfeldt-Prytz (1):
  iio: buffer: check if a buffer has been set up when poll is called

 drivers/iio/adc/aspeed_adc.c|  7 ---
 drivers/iio/adc/stm32-adc.c |  7 ---
 drivers/iio/imu/adis_trigger.c  |  7 ---
 drivers/iio/industrialio-buffer.c   |  2 +-
 drivers/iio/proximity/Kconfig   |  2 ++
 drivers/staging/android/ashmem.c| 19 +
 drivers/staging/android/ion/ion_cma_heap.c  | 17 
 drivers/staging/fsl-mc/bus/Kconfig  |  2 +-
 drivers/staging/iio/adc/ad7192.c| 27 +
 drivers/staging/iio/impedance-analyzer/ad5933.c |  4 +---
 10 files changed, 64 insertions(+), 30 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: gdm724x: hci: Changed camel-case to snake-case.

2018-02-22 Thread Greg KH
On Wed, Feb 21, 2018 at 01:45:58PM +0300, Dan Carpenter wrote:
> On Wed, Feb 21, 2018 at 02:39:28AM -0800, Quytelda Kahja wrote:
> > Changed a variable name from camel to snake case to fix a coding style
> > issue.
> > 
> > Signed-off-by: Quytelda Kahja 
> > ---
> >  drivers/staging/gdm724x/hci_packet.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/gdm724x/hci_packet.h 
> > b/drivers/staging/gdm724x/hci_packet.h
> > index 22ce8b9477b6..f8837c7103ac 100644
> > --- a/drivers/staging/gdm724x/hci_packet.h
> > +++ b/drivers/staging/gdm724x/hci_packet.h
> > @@ -50,7 +50,7 @@ struct tlv {
> >  struct sdu_header {
> > __dev16 cmd_evt;
> > __dev16 len;
> > -   __dev32 dftEpsId;
> > +   __dev32 dft_eps_ID;
> 
> I bet this is a part of the user space ABI or there is a specific reason
> for the name to match the spec or something so it can't be changed...

This structure is not even used anywhere :(

Quytelda, can you just remove all unused structure definitions from this
driver?  That would be a much better patch here instead of changing a
structure field that no one uses.

thanks,

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


Re: [PATCH v2 1/3] staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler

2018-02-22 Thread Greg KH
On Wed, Feb 21, 2018 at 02:43:14PM -0800, Rohit Athavale wrote:
> This commit adds driver support for the pre-release Xilinx M2M Video
> Scaler IP. There are three parts to this driver :
> 
>  - The Hardware/IP layer that reads and writes register of the IP
>contained in the scaler_hw_xm2m.c
>  - The set of ioctls that applications would need to know contained
>in ioctl_xm2mvsc.h
>  - The char driver that consumes the IP layer in xm2m_vscale.c
> 
> Signed-off-by: Rohit Athavale 
> ---

I need an ack from the linux-media maintainers before I can consider
this for staging, as this really looks like an "odd" video driver...

thanks,

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


Re: [PATCH 1/2] Staging: gdm724x: Simplify the struct gdm_endian to a variable.

2018-02-22 Thread Greg KH
On Wed, Feb 21, 2018 at 05:12:36AM -0800, Quytelda Kahja wrote:
> Since the testing for host endianness and in-driver conversion were
> removed in 77e8a50149a2, the gdm_endian struct contains only one member,
> and can therefore be simplified to a single u8 variable.
> 
> Signed-off-by: Quytelda Kahja 

This patch series does not apply to my tree :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v6 0/2] staging: fsl-mc: Move bus driver out of staging

2018-02-22 Thread Greg KH
On Mon, Feb 05, 2018 at 08:07:41AM -0600, Bogdan Purcareata wrote:
> Previous submission: https://lkml.org/lkml/2018/1/26/215
> 
> Split the code into moving out the core bus infrastructure separate from
> the irqchip glue code. Add a Kconfig dependency on ARM_GIC_V3_ITS.
> Integrate the documentation with the kernel build system.
> 
> This patchset only handles moving the fsl-mc bus core out of staging.
> The remaining objects (DPBP, DPCON) and drivers (dpio, dpaa2-eth) will
> be moved out in subsequent patches.

Now applied, nice work everyone.

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


Re: [PATCH 0/4] staging: wilc1000: modify functions by making use of GENMASK macro

2018-02-22 Thread Ajay Singh
Please ignore this patch series, I will work on review comments and submit
another version later.
 
Regards,
Ajay
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: rtl8192e: rtllib_crypt_tkip.c: Use __func__ instead of function name and proper code ident for else statement

2018-02-22 Thread Debopriyo Ghosh
From: Debopriyo 

This is a patch to the rtllib_crypt_tkip.c file that fixes 2 issues found
by the checkpatch.pl tool
1.Use of __func__ instead of function name
2.proper code identation for else statement

Signed-off-by: Debopriyo Ghosh 
---
 drivers/staging/rtl8192e/rtllib_crypt_tkip.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c 
b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
index ae103b0..e462c1e 100644
--- a/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
+++ b/drivers/staging/rtl8192e/rtllib_crypt_tkip.c
@@ -314,7 +314,7 @@ static int rtllib_tkip_encrypt(struct sk_buff *skb, int 
hdr_len, void *priv)
tkip_mixing_phase2(rc4key, tkey->key, tkey->tx_ttak,
   tkey->tx_iv16);
} else
-   tkey->tx_phase1_done = 1;
+   tkey->tx_phase1_done = 1;
 
 
len = skb->len - hdr_len;
@@ -512,7 +512,7 @@ static int michael_mic(struct crypto_ahash *tfm_michael, u8 
*key, u8 *hdr,
int err;
 
if (tfm_michael == NULL) {
-   pr_warn("michael_mic: tfm_michael == NULL\n");
+   pr_warn("%s: tfm_michael == NULL\n", __func__);
return -1;
}
sg_init_table(sg, 2);
-- 
2.7.4

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


[PATCH 1/3] staging: lustre: lov: use correct env in lov_io_data_version_end()

2018-02-22 Thread NeilBrown
lov - the logical object volume manager - is responsible for
striping data across multiple volumes.

So when it is given a request, it creates one or more
sub-requests, one for each target volume.  Each sub_io
request has a sub_env environment which it operates in.

When lov_io_data_version_end() calls lov_io_end_wrapper() to
wait for and close off a sub_io, it passes the wrong
environment.

This causes an LINVRNT() to fail in cl2osc_io(), and may
cause other problems.

This patch changes the call to use ->sub_env, much like
other code in the same file.

Fixes: f0cf21ab ("staging: lustre: clio: add CIT_DATA_VERSION and remove 
IOC_LOV_GETINFO")
Signed-off-by: NeilBrown 
---
 drivers/staging/lustre/lustre/lov/lov_io.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c 
b/drivers/staging/lustre/lustre/lov/lov_io.c
index c0dbf6cd53b4..b823f8a21856 100644
--- a/drivers/staging/lustre/lustre/lov/lov_io.c
+++ b/drivers/staging/lustre/lustre/lov/lov_io.c
@@ -483,7 +483,7 @@ lov_io_data_version_end(const struct lu_env *env, const 
struct cl_io_slice *ios)
struct lov_io_sub *sub;
 
list_for_each_entry(sub, &lio->lis_active, sub_linkage) {
-   lov_io_end_wrapper(env, sub->sub_io);
+   lov_io_end_wrapper(sub->sub_env, sub->sub_io);
 
parent->u.ci_data_version.dv_data_version +=
sub->sub_io->u.ci_data_version.dv_data_version;


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


[PATCH 3/3] staging: lustre: lnet/selftest: don't ignore status from lstcon_test_add

2018-02-22 Thread NeilBrown
If lstcon_test_add sets 'ret' (passed by reference) to 1,
then lst_test_add_ioctl() ignores the return value.
This isn't justified - the return value must be zero for 'ret'
to be meaningful.

Signed-off-by: NeilBrown 
---
 drivers/staging/lustre/lnet/selftest/conctl.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c 
b/drivers/staging/lustre/lnet/selftest/conctl.c
index 51497cf9a832..a2d8092bdeb7 100644
--- a/drivers/staging/lustre/lnet/selftest/conctl.c
+++ b/drivers/staging/lustre/lnet/selftest/conctl.c
@@ -670,7 +670,7 @@ static int lst_test_add_ioctl(struct lstio_test_args *args)
 args->lstio_tes_param_len,
 &ret, args->lstio_tes_resultp);
 
-   if (ret)
+   if (!rc && ret)
rc = (copy_to_user(args->lstio_tes_retp, &ret,
   sizeof(ret))) ? -EFAULT : 0;
 out:


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


[PATCH 0/3] Three lustre bugfixes

2018-02-22 Thread NeilBrown
First two patches fix bugs that have been prevented the test suite
from finished for me - now it completes with about 10% of tests
failing.

Third patch fixes a tiny bug I noticed while reviewing another recent
patch to the same file.

Thanks,
NeilBrown

---

NeilBrown (3):
  staging: lustre: lov: use correct env in lov_io_data_version_end()
  staging: lustre: lmv: correctly iput lmo_root
  staging: lustre: lnet/selftest: don't ignore status from lstcon_test_add


 drivers/staging/lustre/lnet/selftest/conctl.c |2 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c   |2 +-
 drivers/staging/lustre/lustre/lov/lov_io.c|2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--
Signature

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


[PATCH 2/3] staging: lustre: lmv: correctly iput lmo_root

2018-02-22 Thread NeilBrown
Commit 8f18c8a48b73 ("staging: lustre: lmv: separate master object
with master stripe") changed how lmo_root inodes were managed,
particularly when LMV_HASH_FLAG_MIGRATION is not set.
Previously lsm_md_oinfo[0].lmo_root was always a borrowed
inode reference and didn't need to by iput().
Since the change, that special case only applies when
LMV_HASH_FLAG_MIGRATION is set

In the upstream (lustre-release) version of this patch [Commit
60e07b972114 ("LU-4690 lod: separate master object with master
stripe")] the for loop in the lmv_unpack_md() was changed to count
from 0 and to ignore entry 0 if LMV_HASH_FLAG_MIGRATION is set.
In the patch that got applied to Linux, that change was missing,
so lsm_md_oinfo[0].lmo_root is never iput().
This results in a "VFS: Busy inodes" warning at unmount.

Fixes: 8f18c8a48b73 ("staging: lustre: lmv: separate master object with master 
stripe")
Signed-off-by: NeilBrown 
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 179651531862..e8a9b9902c37 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -2695,7 +2695,7 @@ static int lmv_unpackmd(struct obd_export *exp, struct 
lmv_stripe_md **lsmp,
if (lsm && !lmm) {
int i;
 
-   for (i = 1; i < lsm->lsm_md_stripe_count; i++) {
+   for (i = 0; i < lsm->lsm_md_stripe_count; i++) {
/*
 * For migrating inode, the master stripe and master
 * object will be the same, so do not need iput, see


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


Re: [PATCH v2 0/3] Initial driver support for Xilinx M2M Video Scaler

2018-02-22 Thread Nicolas Dufresne
Le mercredi 21 février 2018 à 14:43 -0800, Rohit Athavale a écrit :
> This patch series has three commits :
>  - Driver support for the Xilinx M2M Video Scaler IP
>  - TODO document
>  - DT binding doc
> 
> Changes in HW register map is expected as the IP undergoes changes.
> This is a first attempt at the driver as an early prototype.
> 
> This is a M2M Video Scaler IP that uses polyphases filters to perform
> video scaling. The driver will be used by an application like a
> gstreamer plugin.

I'm hoping you know all this already, but just in case, rebasing your
driver on videobuf2-v4l2.h interface would be automatically supported
by GStreamer, and likely a better proposal for upstreaming.

There few drivers already that could be use as an inspiration.

./drivers/media/platform/vim2m.c: Which demonstrate the API
./drivers/media/platform/exynos4-is/: Exynos4 imaging functions
./drivers/media/platform/exynos-gsc/: Exynos4 scaler (and more)
./drivers/media/platform/mtk-mdp/mtk_mdp_m2m.c: MediaTek CSC/Scale
./drivers/media/platform/s5p-g2d/g2d.c: A 2D blitter iirc ?
. . .

I don't know them all, I have developped the GStreamer code with the
Exynos4/5 platform, but also had success report on IMX6 (not upstream
yet apparently). With the framework, you'll gain DMABuf with very
little code.

> 
> Change Log:
> 
> v2 
>  - Cc'ing linux-media mailing list as suggested by Dan Carpenter.
>Dan wanted to see if someone from linux-media can review the 
>driver interface in xm2m_vscale.c to see if it makes sense.
>  - Another question would be the right place to keep the driver,
>in drivers/staging/media or drivers/staging/ 
>  - Dropped empty mmap_open, mmap_close ops.
>  - Removed incorrect DMA_SHARED_BUFFER select from Kconfig
> v1 - Initial version
> 
> 
> Rohit Athavale (3):
>   staging: xm2mvscale: Driver support for Xilinx M2M Video Scaler
>   staging: xm2mvscale: Add TODO for the driver
>   Documentation: devicetree: bindings: Add DT binding doc for xm2mvsc
> driver
> 
>  drivers/staging/Kconfig|   2 +
>  drivers/staging/Makefile   |   1 +
>  .../devicetree/bindings/xm2mvscaler.txt|  25 +
>  drivers/staging/xm2mvscale/Kconfig |  11 +
>  drivers/staging/xm2mvscale/Makefile|   3 +
>  drivers/staging/xm2mvscale/TODO|  18 +
>  drivers/staging/xm2mvscale/ioctl_xm2mvsc.h | 134 +++
>  drivers/staging/xm2mvscale/scaler_hw_xm2m.c| 945
> +
>  drivers/staging/xm2mvscale/scaler_hw_xm2m.h| 152 
>  drivers/staging/xm2mvscale/xm2m_vscale.c   | 768
> +
>  drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h  | 204 +
>  11 files changed, 2263 insertions(+)
>  create mode 100644
> drivers/staging/xm2mvscale/Documentation/devicetree/bindings/xm2mvsca
> ler.txt
>  create mode 100644 drivers/staging/xm2mvscale/Kconfig
>  create mode 100644 drivers/staging/xm2mvscale/Makefile
>  create mode 100644 drivers/staging/xm2mvscale/TODO
>  create mode 100644 drivers/staging/xm2mvscale/ioctl_xm2mvsc.h
>  create mode 100644 drivers/staging/xm2mvscale/scaler_hw_xm2m.c
>  create mode 100644 drivers/staging/xm2mvscale/scaler_hw_xm2m.h
>  create mode 100644 drivers/staging/xm2mvscale/xm2m_vscale.c
>  create mode 100644 drivers/staging/xm2mvscale/xvm2mvsc_hw_regs.h
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] Staging: gdm724x: Simplify the struct gdm_endian to a variable.

2018-02-22 Thread Quytelda Kahja
Sorry, it depends on the several patches I submitted earlier in that
email thread, since they were in response to several suggestions for
earlier patches.  I will resend all of the patches in that thread as a
consecutive patch series in response to this email to minimize
confusion.

Thank you,
Quytelda Kahja

On Thu, Feb 22, 2018 at 6:02 AM, Greg KH  wrote:
> On Wed, Feb 21, 2018 at 05:12:36AM -0800, Quytelda Kahja wrote:
>> Since the testing for host endianness and in-driver conversion were
>> removed in 77e8a50149a2, the gdm_endian struct contains only one member,
>> and can therefore be simplified to a single u8 variable.
>>
>> Signed-off-by: Quytelda Kahja 
>
> This patch series does not apply to my tree :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/4] Staging: gdm724x: LTE: Fix trailing open parentheses.

2018-02-22 Thread Quytelda Kahja
Fix lines with a trailing open parenthesis, which is a coding style issue.

Signed-off-by: Quytelda Kahja 
---
 drivers/staging/gdm724x/gdm_lte.c | 44 +++
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index a6608637035a..8d492d6d6a12 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -185,6 +185,7 @@ static __sum16 icmp6_checksum(struct ipv6hdr *ipv6, u16 
*ptr, int len)
unsigned short *w = ptr;
__wsum sum = 0;
int i;
+   u16 pa;
 
union {
struct {
@@ -204,9 +205,10 @@ static __sum16 icmp6_checksum(struct ipv6hdr *ipv6, u16 
*ptr, int len)
pseudo_header.ph.ph_nxt = ipv6->nexthdr;
 
w = (u16 *)&pseudo_header;
-   for (i = 0; i < ARRAY_SIZE(pseudo_header.pa); i++)
-   sum = csum_add(sum, csum_unfold(
-   (__force __sum16)pseudo_header.pa[i]));
+   for (i = 0; i < ARRAY_SIZE(pseudo_header.pa); i++) {
+   pa = pseudo_header.pa[i];
+   sum = csum_add(sum, csum_unfold((__force __sum16)pa));
+   }
 
w = ptr;
while (len > 1) {
@@ -509,8 +511,9 @@ static struct net_device_stats *gdm_lte_stats(struct 
net_device *dev)
 
 static int gdm_lte_event_send(struct net_device *dev, char *buf, int len)
 {
-   struct nic *nic = netdev_priv(dev);
+   struct phy_dev *phy_dev = ((struct nic *)netdev_priv(dev))->phy_dev;
struct hci_packet *hci = (struct hci_packet *)buf;
+   int length;
int idx;
int ret;
 
@@ -518,11 +521,9 @@ static int gdm_lte_event_send(struct net_device *dev, char 
*buf, int len)
if (ret != 1)
return -EINVAL;
 
-   return netlink_send(lte_event.sock, idx, 0, buf,
-   gdm_dev16_to_cpu(
-   nic->phy_dev->get_endian(
-   nic->phy_dev->priv_dev), hci->len)
-   + HCI_HEADER_SIZE);
+   length = gdm_dev16_to_cpu(phy_dev->get_endian(phy_dev->priv_dev),
+ hci->len) + HCI_HEADER_SIZE;
+   return netlink_send(lte_event.sock, idx, 0, buf, length);
 }
 
 static void gdm_lte_event_rcv(struct net_device *dev, u16 type,
@@ -731,15 +732,13 @@ static void gdm_lte_pdn_table(struct net_device *dev, 
char *buf, int len)
struct hci_pdn_table_ind *pdn_table = (struct hci_pdn_table_ind *)buf;
 
if (pdn_table->activate) {
+   struct gdm_endian *ed;
+
nic->pdn_table.activate = pdn_table->activate;
-   nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(
-   nic->phy_dev->get_endian(
-   nic->phy_dev->priv_dev),
-   pdn_table->dft_eps_id);
-   nic->pdn_table.nic_type = gdm_dev32_to_cpu(
-   nic->phy_dev->get_endian(
-   nic->phy_dev->priv_dev),
-   pdn_table->nic_type);
+
+   ed = nic->phy_dev->get_endian(nic->phy_dev->priv_dev);
+   nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(ed, 
pdn_table->dft_eps_id);
+   nic->pdn_table.nic_type = gdm_dev32_to_cpu(ed, 
pdn_table->nic_type);
 
netdev_info(dev, "pdn activated, nic_type=0x%x\n",
nic->pdn_table.nic_type);
@@ -897,12 +896,11 @@ int register_lte_device(struct phy_dev *phy_dev,
nic->phy_dev = phy_dev;
nic->nic_id = index;
 
-   form_mac_address(
-   net->dev_addr,
-   nic->src_mac_addr,
-   nic->dest_mac_addr,
-   mac_address,
-   index);
+   form_mac_address(net->dev_addr,
+nic->src_mac_addr,
+nic->dest_mac_addr,
+mac_address,
+index);
 
SET_NETDEV_DEV(net, dev);
SET_NETDEV_DEVTYPE(net, &wwan_type);
-- 
2.16.2

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


[PATCH 3/4] Staging: gdm724x: Simplify the struct gdm_endian to a variable.

2018-02-22 Thread Quytelda Kahja
Since the testing for host endianness and in-driver conversion were
removed in 77e8a50149a2, the gdm_endian struct contains only one member,
and can therefore be simplified to a single u8 variable.

Signed-off-by: Quytelda Kahja 
---
 drivers/staging/gdm724x/gdm_endian.c | 24 
 drivers/staging/gdm724x/gdm_endian.h | 13 -
 drivers/staging/gdm724x/gdm_lte.c|  7 +++
 drivers/staging/gdm724x/gdm_lte.h|  2 +-
 drivers/staging/gdm724x/gdm_usb.c| 30 +++---
 drivers/staging/gdm724x/gdm_usb.h|  2 +-
 6 files changed, 32 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_endian.c 
b/drivers/staging/gdm724x/gdm_endian.c
index d0b43e20ec06..4200391b1a97 100644
--- a/drivers/staging/gdm724x/gdm_endian.c
+++ b/drivers/staging/gdm724x/gdm_endian.c
@@ -14,41 +14,33 @@
 #include 
 #include "gdm_endian.h"
 
-void gdm_set_endian(struct gdm_endian *ed, u8 dev_endian)
+__dev16 gdm_cpu_to_dev16(u8 dev_ed, u16 x)
 {
-   if (dev_endian == ENDIANNESS_BIG)
-   ed->dev_ed = ENDIANNESS_BIG;
-   else
-   ed->dev_ed = ENDIANNESS_LITTLE;
-}
-
-__dev16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
-{
-   if (ed->dev_ed == ENDIANNESS_LITTLE)
+   if (dev_ed == ENDIANNESS_LITTLE)
return (__force __dev16)cpu_to_le16(x);
else
return (__force __dev16)cpu_to_be16(x);
 }
 
-u16 gdm_dev16_to_cpu(struct gdm_endian *ed, __dev16 x)
+u16 gdm_dev16_to_cpu(u8 dev_ed, __dev16 x)
 {
-   if (ed->dev_ed == ENDIANNESS_LITTLE)
+   if (dev_ed == ENDIANNESS_LITTLE)
return le16_to_cpu((__force __le16)x);
else
return be16_to_cpu((__force __be16)x);
 }
 
-__dev32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x)
+__dev32 gdm_cpu_to_dev32(u8 dev_ed, u32 x)
 {
-   if (ed->dev_ed == ENDIANNESS_LITTLE)
+   if (dev_ed == ENDIANNESS_LITTLE)
return (__force __dev32)cpu_to_le32(x);
else
return (__force __dev32)cpu_to_be32(x);
 }
 
-u32 gdm_dev32_to_cpu(struct gdm_endian *ed, __dev32 x)
+u32 gdm_dev32_to_cpu(u8 dev_ed, __dev32 x)
 {
-   if (ed->dev_ed == ENDIANNESS_LITTLE)
+   if (dev_ed == ENDIANNESS_LITTLE)
return le32_to_cpu((__force __le32)x);
else
return be32_to_cpu((__force __be32)x);
diff --git a/drivers/staging/gdm724x/gdm_endian.h 
b/drivers/staging/gdm724x/gdm_endian.h
index a785f30bb369..e58d29f868ba 100644
--- a/drivers/staging/gdm724x/gdm_endian.h
+++ b/drivers/staging/gdm724x/gdm_endian.h
@@ -32,14 +32,9 @@ enum {
ENDIANNESS_MAX
 };
 
-struct gdm_endian {
-   u8 dev_ed;
-};
-
-void gdm_set_endian(struct gdm_endian *ed, u8 dev_endian);
-__dev16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x);
-u16 gdm_dev16_to_cpu(struct gdm_endian *ed, __dev16 x);
-__dev32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x);
-u32 gdm_dev32_to_cpu(struct gdm_endian *ed, __dev32 x);
+__dev16 gdm_cpu_to_dev16(u8 dev_ed, u16 x);
+u16 gdm_dev16_to_cpu(u8 dev_ed, __dev16 x);
+__dev32 gdm_cpu_to_dev32(u8 dev_ed, u32 x);
+u32 gdm_dev32_to_cpu(u8 dev_ed, __dev32 x);
 
 #endif /*__GDM_ENDIAN_H__*/
diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 8d492d6d6a12..92cb9d115fe3 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -685,7 +685,7 @@ static void gdm_lte_multi_sdu_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
struct net_device *dev;
struct multi_sdu *multi_sdu = (struct multi_sdu *)buf;
struct sdu *sdu = NULL;
-   struct gdm_endian *endian = phy_dev->get_endian(phy_dev->priv_dev);
+   u8 endian = phy_dev->get_endian(phy_dev->priv_dev);
u8 *data = (u8 *)multi_sdu->data;
u16 i = 0;
u16 num_packet;
@@ -730,10 +730,9 @@ static void gdm_lte_pdn_table(struct net_device *dev, char 
*buf, int len)
 {
struct nic *nic = netdev_priv(dev);
struct hci_pdn_table_ind *pdn_table = (struct hci_pdn_table_ind *)buf;
+   u8 ed;
 
if (pdn_table->activate) {
-   struct gdm_endian *ed;
-
nic->pdn_table.activate = pdn_table->activate;
 
ed = nic->phy_dev->get_endian(nic->phy_dev->priv_dev);
@@ -752,9 +751,9 @@ static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, 
char *buf, int len)
 {
struct hci_packet *hci = (struct hci_packet *)buf;
struct hci_pdn_table_ind *pdn_table = (struct hci_pdn_table_ind *)buf;
-   struct gdm_endian *endian = phy_dev->get_endian(phy_dev->priv_dev);
struct sdu *sdu;
struct net_device *dev;
+   u8 endian = phy_dev->get_endian(phy_dev->priv_dev);
int ret = 0;
u16 cmd_evt;
u32 nic_type;
diff --git a/drivers/staging/gdm724x/gdm_lte.h 
b/drivers/staging/gdm724x/gdm_lte.h
index 3ecaff1a40cb..bad0855e4721 100644
--- a/drivers/staging/gdm724x/gdm_lte.h
+++ b/drivers/staging/gdm724x/gdm_lt

[PATCH 2/4] Staging: gdm724x: hci: Changed camel-case to snake-case.

2018-02-22 Thread Quytelda Kahja
Changed a variable name from camel to snake case to fix a coding style
issue.

Signed-off-by: Quytelda Kahja 
---
 drivers/staging/gdm724x/hci_packet.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gdm724x/hci_packet.h 
b/drivers/staging/gdm724x/hci_packet.h
index 22ce8b9477b6..f8837c7103ac 100644
--- a/drivers/staging/gdm724x/hci_packet.h
+++ b/drivers/staging/gdm724x/hci_packet.h
@@ -50,7 +50,7 @@ struct tlv {
 struct sdu_header {
__dev16 cmd_evt;
__dev16 len;
-   __dev32 dftEpsId;
+   __dev32 dft_eps_ID;
__dev32 bearer_ID;
__dev32 nic_type;
 } __packed;
-- 
2.16.2

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


[PATCH 4/4] Staging: gdm724x: LTE: Refactor gdm_lte_pdn_table().

2018-02-22 Thread Quytelda Kahja
Mostly this change just reverses the primary conditional so most of
the code can be pulled back a tab, which fixes some code style
warnings.

Signed-off-by: Quytelda Kahja 
---
 drivers/staging/gdm724x/gdm_lte.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 92cb9d115fe3..4f3c518304f2 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -730,21 +730,21 @@ static void gdm_lte_pdn_table(struct net_device *dev, 
char *buf, int len)
 {
struct nic *nic = netdev_priv(dev);
struct hci_pdn_table_ind *pdn_table = (struct hci_pdn_table_ind *)buf;
-   u8 ed;
+   u8 ed = nic->phy_dev->get_endian(nic->phy_dev->priv_dev);
 
-   if (pdn_table->activate) {
-   nic->pdn_table.activate = pdn_table->activate;
-
-   ed = nic->phy_dev->get_endian(nic->phy_dev->priv_dev);
-   nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(ed, 
pdn_table->dft_eps_id);
-   nic->pdn_table.nic_type = gdm_dev32_to_cpu(ed, 
pdn_table->nic_type);
-
-   netdev_info(dev, "pdn activated, nic_type=0x%x\n",
-   nic->pdn_table.nic_type);
-   } else {
+   if (!pdn_table->activate) {
memset(&nic->pdn_table, 0x00, sizeof(struct pdn_table));
netdev_info(dev, "pdn deactivated\n");
+
+   return;
}
+
+   nic->pdn_table.activate = pdn_table->activate;
+   nic->pdn_table.dft_eps_id = gdm_dev32_to_cpu(ed, pdn_table->dft_eps_id);
+   nic->pdn_table.nic_type = gdm_dev32_to_cpu(ed, pdn_table->nic_type);
+
+   netdev_info(dev, "pdn activated, nic_type=0x%x\n",
+   nic->pdn_table.nic_type);
 }
 
 static int gdm_lte_receive_pkt(struct phy_dev *phy_dev, char *buf, int len)
-- 
2.16.2

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