Re: [PATCH] staging: gdm724x: Fix sparse warnings

2017-02-14 Thread javier

El 14/02/17 a las 10:24, maomao xu escribió:

drivers/staging/gdm724x/gdm_lte.c:311:39: warning: incorrect type in assignment 
(different base types)
drivers/staging/gdm724x/gdm_lte.c:311:39:expected restricted __sum16 
[addressable] [assigned] [usertype] icmp6_cksum
drivers/staging/gdm724x/gdm_lte.c:311:39:got int

Signed-off-by: maomao xu 

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index a3e046c..ddec6d0 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -308,7 +308,7 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 
nic_type)
memcpy(icmp_na + sizeof(struct icmp6hdr), &na,
   sizeof(struct neighbour_advertisement));

-   icmp6_out.icmp6_cksum = icmp6_checksum(&ipv6_out,
+   icmp6_out.icmp6_cksum = (__force 
__sum16)icmp6_checksum(&ipv6_out,
(u16 *)icmp_na, sizeof(icmp_na));
} else {
return -1;



This is not correct. You should use the kernel checksum functions in 
icmp6_checksum. I have a patch ready to be submitted.

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


Re: [PATCH] Staging: i4l: Correct coding style errors

2017-01-09 Thread javier

El 03/01/17 a las 16:20, Greg KH escribió:

On Thu, Dec 22, 2016 at 11:32:16PM +0100, Javier Rodriguez wrote:

Some lines with more than 80 characters has been corrected.

Also, some printk() functions has been changed with their proper
print functions suggested by checkpatch.pl script as well as some
open braces has been aligned properly.

Finally, two strings has been merged into unique string.


When you have to list the different things you did in a patch, it's a
huge sign that you need to break this up into multiple patches.

Please do that here and resend.

thanks,

greg k-h



Thanks for your response.

However, I've seen a problem, the file that has been affected by my 
patch no longer exists in linux-next master branch. So, I'm going to 
abandon this change and I'll upload other patch for a different file.


Thanks,

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


[PATCH] staging: gdm724x: modify icmp6_checksum for returning a correct data type.

2017-02-14 Thread Javier Rodriguez
The icmp6_checksum was returning an invalid data type as the expected type
is __sum16. For returning such data type, icmp6_checksum, now, is using
the kernel functions for computing the checksum.

Here, the sparse message:

drivers/staging/gdm724x/gdm_lte.c:311:39: warning: incorrect type in assignment 
(different base types)
drivers/staging/gdm724x/gdm_lte.c:311:39:expected restricted __sum16 
[addressable] [assigned] [usertype] icmp6_cksum
drivers/staging/gdm724x/gdm_lte.c:311:39:got int

Signed-off-by: Javier Rodriguez 
---
 drivers/staging/gdm724x/gdm_lte.c | 15 ++-
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index 6792a1d..b6e59e6 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -178,10 +178,10 @@ static int gdm_lte_emulate_arp(struct sk_buff *skb_in, 
u32 nic_type)
return 0;
 }
 
-static int icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len)
+static __sum16 icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len)
 {
unsigned short *w = ptr;
-   int sum = 0;
+   __wsum sum = 0;
int i;
 
union {
@@ -203,19 +203,16 @@ static int icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, 
int len)
 
w = (u16 *)&pseudo_header;
for (i = 0; i < ARRAY_SIZE(pseudo_header.pa); i++)
-   sum += pseudo_header.pa[i];
+   sum = csum_add(sum, csum_unfold(
+   (__force __sum16)pseudo_header.pa[i]));
 
w = ptr;
while (len > 1) {
-   sum += *w++;
+   sum = csum_add(sum, csum_unfold((__force __sum16)*w++));
len -= 2;
}
 
-   sum = (sum >> 16) + (sum & 0x);
-   sum += (sum >> 16);
-   sum = ~sum & 0x;
-
-   return sum;
+   return csum_fold(sum);
 }
 
 static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type)
-- 
1.9.1

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


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

2018-06-13 Thread Javier Martinez
Fixed style line length warning detected by checkpatch.pl in the file
ssv_dnp.c.

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

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

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


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

2018-06-13 Thread Javier Martinez
Fixed style line length warning detected by checkpatch.pl in the file
ssv_dnp.c.

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

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

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


[PATCH] Staging: octeon-usb: octeon-hcd.c: style fix line length warning

2018-06-13 Thread Javier Martinez
Checkpatch.pl issued a warning in the top of the commment within
octeon-hcd.c. This is a simple style fix for that.

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

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index cded30f145aa..768b0148f3d5 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -1,5 +1,5 @@
 /*
- * This file is subject to the terms and conditions of the GNU General Public
+ * This file is subject to the terms and conditions of the GPL
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
-- 
2.17.1

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


[PATCH] Staging: octeon-usb: octeon-hcd.c: Remove boiler plate and add SPDX

2018-06-13 Thread Javier Martinez
Removed massive boiler plate text at top of the file and instead
replaced it with a simple SPDX license identifier.

Signed-off-by: Javier Martinez 
---
 drivers/staging/octeon-usb/octeon-hcd.c | 47 ++---
 1 file changed, 2 insertions(+), 45 deletions(-)

diff --git a/drivers/staging/octeon-usb/octeon-hcd.c 
b/drivers/staging/octeon-usb/octeon-hcd.c
index cded30f145aa..df61e8321140 100644
--- a/drivers/staging/octeon-usb/octeon-hcd.c
+++ b/drivers/staging/octeon-usb/octeon-hcd.c
@@ -1,48 +1,5 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2008 Cavium Networks
- *
- * Some parts of the code were originally released under BSD license:
- *
- * Copyright (c) 2003-2010 Cavium Networks (supp...@cavium.com). All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *   * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- *   * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- *
- *   * Neither the name of Cavium Networks nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * This Software, including technical data, may be subject to U.S. export
- * control laws, including the U.S. Export Administration Act and its 
associated
- * regulations, and may be subject to export or import regulations in other
- * countries.
- *
- * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
- * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS 
OR
- * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT 
TO
- * THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION
- * OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM
- * SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE,
- * MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF
- * VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR
- * CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK ARISING OUT OF USE OR
- * PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
- */
+// SPDX-License-Identifier: GNU GPL
+
 
 #include 
 #include 
-- 
2.17.1

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


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

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

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

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

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


[PATCH] Staging: i4l: Correct coding style errors

2016-12-22 Thread Javier Rodriguez
Some lines with more than 80 characters has been corrected.

Also, some printk() functions has been changed with their proper
print functions suggested by checkpatch.pl script as well as some
open braces has been aligned properly.

Finally, two strings has been merged into unique string.

Signed-off-by: Javier Rodriguez 
---
 drivers/staging/i4l/pcbit/module.c | 40 --
 1 file changed, 17 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/i4l/pcbit/module.c 
b/drivers/staging/i4l/pcbit/module.c
index 0a59bd0..c4450fc 100644
--- a/drivers/staging/i4l/pcbit/module.c
+++ b/drivers/staging/i4l/pcbit/module.c
@@ -25,8 +25,8 @@
 static int mem[MAX_PCBIT_CARDS];
 static int irq[MAX_PCBIT_CARDS];
 
-module_param_array(mem, int, NULL, 0);
-module_param_array(irq, int, NULL, 0);
+module_param_array(mem, int, NULL, 0x0);
+module_param_array(irq, int, NULL, 0x0);
 
 static int num_boards;
 struct pcbit_dev *dev_pcbit[MAX_PCBIT_CARDS];
@@ -37,27 +37,25 @@ static int __init pcbit_init(void)
 
num_boards = 0;
 
-   printk(KERN_NOTICE
-  "PCBIT-D device driver v 0.5-fjpc0 19991204 - "
-  "Copyright (C) 1996 Universidade de Lisboa\n");
+   pr_notice("PCBIT-D device driver v 0.5-fjpc0 19991204 - Copyright (C) 
1996 Universidade de Lisboa\n");
 
-   if (mem[0] || irq[0])
-   {
-   for (board = 0; board < MAX_PCBIT_CARDS && mem[board] && 
irq[board]; board++)
-   {
+   if (mem[0] || irq[0]) {
+   for (board = 0;
+board < MAX_PCBIT_CARDS && mem[board] && irq[board];
+board++) {
if (!mem[board])
mem[board] = 0xD;
if (!irq[board])
irq[board] = 5;
 
-   if (pcbit_init_dev(board, mem[board], irq[board]) == 0)
+   if (pcbit_init_dev(board,
+  mem[board],
+  irq[board]) == 0) {
num_boards++;
 
-   else
-   {
-   printk(KERN_WARNING
-  "pcbit_init failed for dev %d",
-  board + 1);
+   } else {
+   pr_warn("pcbit_init failed for dev %d",
+   board + 1);
return -EIO;
}
}
@@ -65,10 +63,8 @@ static int __init pcbit_init(void)
 
/* Hardcoded default settings detection */
 
-   if (!num_boards)
-   {
-   printk(KERN_INFO
-  "Trying to detect board using default settings\n");
+   if (!num_boards) {
+   pr_info("Trying to detect board using default settings\n");
if (pcbit_init_dev(0, 0xD, 5) == 0)
num_boards++;
else
@@ -84,8 +80,7 @@ static void __exit pcbit_exit(void)
 
for (board = 0; board < num_boards; board++)
pcbit_terminate(board);
-   printk(KERN_NOTICE
-  "PCBIT-D module unloaded\n");
+   pr_notice("PCBIT-D module unloaded\n");
 #endif
 }
 
@@ -103,7 +98,6 @@ static int __init pcbit_setup(char *line)
j = 1;
 
while (argc && (i < MAX_PCBIT_CARDS)) {
-
if (argc) {
mem[i]  = ints[j];
j++; argc--;
@@ -116,7 +110,7 @@ static int __init pcbit_setup(char *line)
 
i++;
}
-   return (1);
+   return 1;
 }
 __setup("pcbit=", pcbit_setup);
 #endif
-- 
1.9.1

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


[PATCH] staging: rtl8192u: Correct coding style issues.

2017-01-10 Thread Javier Rodriguez
Add character '*' in all lines of the block comments.
Also remove one unnecessary line.

Signed-off-by: Javier Rodriguez 
---
 drivers/staging/rtl8192u/r8180_93cx6.h | 27 +--
 1 file changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h 
b/drivers/staging/rtl8192u/r8180_93cx6.h
index 9cf7f58..643d465 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.h
+++ b/drivers/staging/rtl8192u/r8180_93cx6.h
@@ -1,17 +1,17 @@
 /*
-   This is part of rtl8187 OpenSource driver
-   Copyright (C) Andrea Merello 2004-2005  
-   Released under the terms of GPL (General Public Licence)
-
-   Parts of this driver are based on the GPL part of the
-   official realtek driver
-   Parts of this driver are based on the rtl8180 driver skeleton
-   from Patric Schenke & Andres Salomon
-   Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
-   We want to thank the Authors of such projects and the Ndiswrapper
-   project Authors.
-*/
+ * This is part of rtl8187 OpenSource driver
+ * Copyright (C) Andrea Merello 2004-2005  
+ * Released under the terms of GPL (General Public Licence)
+ *
+ * Parts of this driver are based on the GPL part of the
+ * official realtek driver
+ * Parts of this driver are based on the rtl8180 driver skeleton
+ * from Patric Schenke & Andres Salomon
+ * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
+ *
+ * We want to thank the Authors of such projects and the Ndiswrapper
+ * project Authors.
+ */
 
 /*This files contains card eeprom (93c46 or 93c56) programming routines*/
 /*memory is addressed by WORDS*/
@@ -39,5 +39,4 @@
 #define EPROM_TXPW2 0x1b
 #define EPROM_TXPW1 0x3d
 
-
 int eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */
-- 
1.9.1

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


[PATCH 1/2] staging: rtl8192u: Add character '*' in all lines of the block comments.

2017-01-11 Thread Javier Rodriguez
Correct code style error. Add a character in every line of the
comment block.

Signed-off-by: Javier Rodriguez 
---
 drivers/staging/rtl8192u/r8180_93cx6.h | 26 +-
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h 
b/drivers/staging/rtl8192u/r8180_93cx6.h
index 9cf7f58..8e48b24 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.h
+++ b/drivers/staging/rtl8192u/r8180_93cx6.h
@@ -1,17 +1,17 @@
 /*
-   This is part of rtl8187 OpenSource driver
-   Copyright (C) Andrea Merello 2004-2005  
-   Released under the terms of GPL (General Public Licence)
-
-   Parts of this driver are based on the GPL part of the
-   official realtek driver
-   Parts of this driver are based on the rtl8180 driver skeleton
-   from Patric Schenke & Andres Salomon
-   Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
-
-   We want to thank the Authors of such projects and the Ndiswrapper
-   project Authors.
-*/
+ * This is part of rtl8187 OpenSource driver
+ * Copyright (C) Andrea Merello 2004-2005  
+ * Released under the terms of GPL (General Public Licence)
+ *
+ * Parts of this driver are based on the GPL part of the
+ * official realtek driver
+ * Parts of this driver are based on the rtl8180 driver skeleton
+ * from Patric Schenke & Andres Salomon
+ * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver
+ *
+ * We want to thank the Authors of such projects and the Ndiswrapper
+ * project Authors.
+ */
 
 /*This files contains card eeprom (93c46 or 93c56) programming routines*/
 /*memory is addressed by WORDS*/
-- 
1.9.1

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


[PATCH 2/2] staging: rtl8192u: Removed multiple white lines.

2017-01-11 Thread Javier Rodriguez
Remove one unnecessary white line.

Signed-off-by: Javier Rodriguez 
---
 drivers/staging/rtl8192u/r8180_93cx6.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h 
b/drivers/staging/rtl8192u/r8180_93cx6.h
index 8e48b24..643d465 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.h
+++ b/drivers/staging/rtl8192u/r8180_93cx6.h
@@ -39,5 +39,4 @@
 #define EPROM_TXPW2 0x1b
 #define EPROM_TXPW1 0x3d
 
-
 int eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */
-- 
1.9.1

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


[PATCH] staging: gdm724x: fix sparse warnings in file gdm_lte.c

2017-01-31 Thread Javier Rodriguez
drivers/staging/gdm724x/gdm_lte.c:201:33: warning: incorrect type in assignment 
(different base types)
drivers/staging/gdm724x/gdm_lte.c:201:33:expected unsigned int [unsigned] 
[addressable] [usertype] ph_len
drivers/staging/gdm724x/gdm_lte.c:201:33:got restricted __be16 [usertype] 
payload_len
drivers/staging/gdm724x/gdm_lte.c:311:39: warning: incorrect type in assignment 
(different base types)
drivers/staging/gdm724x/gdm_lte.c:311:39:expected restricted __sum16 
[addressable] [assigned] [usertype] icmp6_cksum
drivers/staging/gdm724x/gdm_lte.c:311:39:got int

Signed-off-by: Javier Rodriguez 
---
 drivers/staging/gdm724x/gdm_lte.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index a182757..86b2b4f 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -198,7 +198,7 @@ static int icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, 
int len)
memset(&pseudo_header, 0, sizeof(pseudo_header));
memcpy(&pseudo_header.ph.ph_src, &ipv6->saddr.in6_u.u6_addr8, 16);
memcpy(&pseudo_header.ph.ph_dst, &ipv6->daddr.in6_u.u6_addr8, 16);
-   pseudo_header.ph.ph_len = ipv6->payload_len;
+   pseudo_header.ph.ph_len = be16_to_cpu(ipv6->payload_len);
pseudo_header.ph.ph_nxt = ipv6->nexthdr;
 
w = (u16 *)&pseudo_header;
@@ -308,7 +308,7 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 
nic_type)
memcpy(icmp_na + sizeof(struct icmp6hdr), &na,
   sizeof(struct neighbour_advertisement));
 
-   icmp6_out.icmp6_cksum = icmp6_checksum(&ipv6_out,
+   icmp6_out.icmp6_cksum = (__force __sum16) 
icmp6_checksum(&ipv6_out,
(u16 *)icmp_na, sizeof(icmp_na));
} else {
return -1;
-- 
1.9.1

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


[PATCH] staging: gdm724x: fix incorrect type in assignment

2017-02-06 Thread Javier Rodriguez
Fix sparse warning issue.

drivers/staging/gdm724x/gdm_lte.c:201:33: warning: incorrect type in assignment 
(different base types)
drivers/staging/gdm724x/gdm_lte.c:201:33:expected unsigned int [unsigned] 
[addressable] [usertype] ph_len
drivers/staging/gdm724x/gdm_lte.c:201:33:got restricted __be16 [usertype] 
payload_len

Signed-off-by: Javier Rodriguez 
---
 drivers/staging/gdm724x/gdm_lte.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/gdm724x/gdm_lte.c 
b/drivers/staging/gdm724x/gdm_lte.c
index a182757..6792a1d 100644
--- a/drivers/staging/gdm724x/gdm_lte.c
+++ b/drivers/staging/gdm724x/gdm_lte.c
@@ -198,7 +198,7 @@ static int icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, 
int len)
memset(&pseudo_header, 0, sizeof(pseudo_header));
memcpy(&pseudo_header.ph.ph_src, &ipv6->saddr.in6_u.u6_addr8, 16);
memcpy(&pseudo_header.ph.ph_dst, &ipv6->daddr.in6_u.u6_addr8, 16);
-   pseudo_header.ph.ph_len = ipv6->payload_len;
+   pseudo_header.ph.ph_len = be16_to_cpu(ipv6->payload_len);
pseudo_header.ph.ph_nxt = ipv6->nexthdr;
 
w = (u16 *)&pseudo_header;
-- 
1.9.1

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


Re: [PATCH] drivers: sm7xxfb: Mark function as static in sm7xxfb.c

2013-12-21 Thread Javier Muñoz
On 12/21/2013 11:14 AM, Rashika Kheria wrote:
> Mark function smtcfb_setmode() as static in sm7xxfb.c because it is not
> used outside this file.
> 
> This eliminates the following warning in sm7xxfb.c:
> drivers/staging/sm7xxfb/sm7xxfb.c:588:6: warning: no previous prototype for 
> ‘smtcfb_setmode’ [-Wmissing-prototypes]
> 
> Signed-off-by: Rashika Kheria 

Acked-by: Javier M. Mellid 

> ---
>  drivers/staging/sm7xxfb/sm7xxfb.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c 
> b/drivers/staging/sm7xxfb/sm7xxfb.c
> index ba199ff..f08b216 100644
> --- a/drivers/staging/sm7xxfb/sm7xxfb.c
> +++ b/drivers/staging/sm7xxfb/sm7xxfb.c
> @@ -585,7 +585,7 @@ static void smtc_set_timing(struct smtcfb_info *sfb)
>   }
>  }
>  
> -void smtcfb_setmode(struct smtcfb_info *sfb)
> +static void smtcfb_setmode(struct smtcfb_info *sfb)
>  {
>   switch (sfb->fb.var.bits_per_pixel) {
>   case 32:
> 

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


[PATCH] media: staging/imx: Allow driver to build if COMPILE_TEST is enabled

2019-02-19 Thread Javier Martinez Canillas
The driver has runtime but no build time dependency with IMX_IPUV3_CORE,
so can be built for testing purposes if COMPILE_TEST option is enabled.

This is useful to have more build coverage and make sure that the driver
is not affected by changes that could cause build regressions.

Signed-off-by: Javier Martinez Canillas 

---

 drivers/staging/media/imx/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/imx/Kconfig 
b/drivers/staging/media/imx/Kconfig
index 36b276ea2ec..5045e24c470 100644
--- a/drivers/staging/media/imx/Kconfig
+++ b/drivers/staging/media/imx/Kconfig
@@ -1,7 +1,7 @@
 config VIDEO_IMX_MEDIA
tristate "i.MX5/6 V4L2 media core driver"
depends on ARCH_MXC || COMPILE_TEST
-   depends on MEDIA_CONTROLLER && VIDEO_V4L2 && IMX_IPUV3_CORE
+   depends on MEDIA_CONTROLLER && VIDEO_V4L2 && (IMX_IPUV3_CORE || 
COMPILE_TEST)
depends on VIDEO_V4L2_SUBDEV_API
depends on HAS_DMA
select VIDEOBUF2_DMA_CONTIG
-- 
2.20.1

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


Re: [PATCH] FBTFT: fbtft-bus: Fix code style problems

2019-03-11 Thread DANTE JAVIER PAZ
Hello Sam, thank you very much for your comments,
As I told Dan (my email did not reach the mailing list) this is my
first attempt to contribute,
So I'm learning a lot from your advice and corrections.

I will look for TODO lists to see if there are more useful
contributions to make, all suggestions are also welcome.

Thanks again for the patience of all of you.
Best,
Dante


El lun., 11 mar. 2019 a las 13:25, Sam Ravnborg () escribió:
>
> Hi Dante
>
> Thanks for the patch.
> On Sat, Mar 09, 2019 at 06:48:52PM -0300, Dante Paz wrote:
> > From: Dante Paz 
> >
> > Style and coding function issues were corrected, by avoiding macro 
> > functions with a conflicting coding style.
> > Signed-off-by: Dante Paz 
>
> But it raised a few comments.
>
> The staging/fbtft is a dumping of a set of drivers that
> in the end will be migrated to DRM.
> And there is not much gained trying to do coding style changes to these
> drivers.
> So please conmsider finding a drver where this is more relevant.
>
> Furthermore that patch presented is hard to review as it contains
> too much changes in one go.
> As a rule of thumb include only one type of change per patch.
> This is worth to keep in mind for future submissions.
>
> It it then also good to present the trivial changes first(*), and the
> less trivial changes later.
>
> (*) Like whitespace to tabs, spellign errors etc.
>
> Sam



-- 
-- 
Dr. Dante Javier Paz
Instituto de Astronomía, Teórica y Experimental, IATE
Observatorio Astronómico de Córdoba

Tel: (54) 351-5353776 ext 75643
Web: www.iate.oac.uncor.edu


Laprida 854
X5000BGR - Córdoba
ARGENTINA
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC] [media] imx: assume MEDIA_ENT_F_ATV_DECODER entities output video on pad 1

2017-04-05 Thread Javier Martinez Canillas
Hello Philipp,

On Wed, Apr 5, 2017 at 5:34 AM, Philipp Zabel  wrote:
> On Wed, 2017-04-05 at 09:21 +0100, Russell King - ARM Linux wrote:

[snip]

> I think the output part is accurate, as the audio pad is an artifact of
> an unrelated change. I'm not so sure about the VBI pad, but I think that
> shouldn't exist either. The input pad, on the other hand, not having any
> of graph representation in the device tree seems a bit strange. There

Agreed, there should be a OF graph representation (and also a MC
representation) of the input PADs.

The tvp5150 driver currently has hardcoded as input TVP5150_COMPOSITE1
(AIP1B), so it won't work for a board that has the composite connector
wired to TVP5150_COMPOSITE0 (AIP1A) neither will work for S-Video
(AIP1A + AIP1B).

> was a custom binding for the inputs, that got quickly reverted:
> https://patchwork.kernel.org/patch/8395521/
>

Yes, that was my first attempt to have input connector support for
tvp5150. The patches were merged without a detailed review of the DT
bindings and latter were found to be wrong. Instead of having a driver
specific DT binding, a generic binding that could be used by any
device should be defined.

The latest proposal was [0] but that was also found to be inadequate.
After a lot of discussion on #v4l, the best approach we could come
with was something like like [1]. But I was busy with other stuff and
never found time to do the driver changes.

By the way, only the DT bindings portion from the first approach got
reverted but the patch reverting the driver changes never made to
mainline. Could you please test if [2] doesn't cause any issues to you
so the left over can be finally removed?

> regards
> Philipp
>

[0]: https://lkml.org/lkml/2016/4/12/983
[1]: https://hastebin.com/kadagidino.diff
[2]: https://patchwork.kernel.org/patch/9472623/

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


[PATCH] staging: typec: fusb302: Fix module autoload

2017-05-03 Thread Javier Martinez Canillas
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the OF and I2C device ID table entries as module aliases, using the
MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias
alias:  of:N*T*Cfcs,fusb302C*
alias:  of:N*T*Cfcs,fusb302
alias:  i2c:typec_fusb302

Signed-off-by: Javier Martinez Canillas 
---

 drivers/staging/typec/fusb302/fusb302.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/typec/fusb302/fusb302.c 
b/drivers/staging/typec/fusb302/fusb302.c
index 2cee9a952c9b..aa460f93a293 100644
--- a/drivers/staging/typec/fusb302/fusb302.c
+++ b/drivers/staging/typec/fusb302/fusb302.c
@@ -1787,11 +1787,13 @@ static const struct of_device_id fusb302_dt_match[] = {
{.compatible = "fcs,fusb302"},
{},
 };
+MODULE_DEVICE_TABLE(of, fusb302_dt_match);
 
 static const struct i2c_device_id fusb302_i2c_device_id[] = {
{"typec_fusb302", 0},
{},
 };
+MODULE_DEVICE_TABLE(i2c, fusb302_i2c_device_id);
 
 static const struct dev_pm_ops fusb302_pm_ops = {
.suspend = fusb302_pm_suspend,
-- 
2.9.3

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


Re: [PATCH 1/5] [media] staging: omap4iss: separate links creation from entities init

2015-12-07 Thread Javier Martinez Canillas
Hello Laurent,

On 12/06/2015 12:10 AM, Laurent Pinchart wrote:
> Hi Javier,
> 
> Thank you for the patch.
>

Thanks for your feedback.
 
> On Thursday 03 September 2015 18:00:32 Javier Martinez Canillas wrote:
>> The omap4iss driver initializes the entities and creates the pads links
>> before the entities are registered with the media device. This does not
>> work now that object IDs are used to create links so the media_device
>> has to be set.
>>
>> Split out the pads links creation from the entity initialization so are
>> made after the entities registration.
>>
>> Signed-off-by: Javier Martinez Canillas 
>> ---
>>
>>  drivers/staging/media/omap4iss/iss.c | 101 +++-
>>  drivers/staging/media/omap4iss/iss_csi2.c|  35 +++---
>>  drivers/staging/media/omap4iss/iss_csi2.h|   1 +
>>  drivers/staging/media/omap4iss/iss_ipipeif.c |  29 
>>  drivers/staging/media/omap4iss/iss_ipipeif.h |   1 +
>>  drivers/staging/media/omap4iss/iss_resizer.c |  29 
>>  drivers/staging/media/omap4iss/iss_resizer.h |   1 +
>>  7 files changed, 132 insertions(+), 65 deletions(-)
>>
>> diff --git a/drivers/staging/media/omap4iss/iss.c
>> b/drivers/staging/media/omap4iss/iss.c index 44b88ff3ba83..076ddd412201
>> 100644
>> --- a/drivers/staging/media/omap4iss/iss.c
>> +++ b/drivers/staging/media/omap4iss/iss.c
>> @@ -1272,6 +1272,68 @@ done:
>>  return ret;
>>  }
>>
>> +/*
>> + * iss_create_pads_links() - Pads links creation for the subdevices
> 
> Could you please s/pads_links/links/ and s/pads links/links/ ?
>

Yes, as mentioned in the other thread, I'll do that for all the
drivers that only create pad links.
 
> Apart from that,
> 
> Acked-by: Laurent Pinchart 
>

Thanks!

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v8 02/55] [media] staging: omap4iss: get entity ID using media_entity_id()

2015-12-07 Thread Javier Martinez Canillas
Hello Laurent,

On 12/06/2015 12:18 AM, Laurent Pinchart wrote:
> Hi Javier,
> 
> Thank you for the patch.
> 
> On Sunday 30 August 2015 00:06:13 Mauro Carvalho Chehab wrote:
>> From: Javier Martinez Canillas 
>>
>> Assessing media_entity ID should now use media_entity_id() macro to
> 
> Did you mean "accessing" ?
>

Sigh, yet another typo error that seems to be due copy and paste.
 
>> obtain the entity ID, as a next patch will remove the .id field from
>> struct media_entity .
>>
>> So, get rid of it, otherwise the omap4iss driver will fail to build.
>>
>> Signed-off-by: Javier Martinez Canillas 
>> Acked-by: Hans Verkuil 
>> Signed-off-by: Mauro Carvalho Chehab 
> 
> With the typo fixed,
> 
> Acked-by: Laurent Pinchart 
>

Thanks.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [media] media: rename media unregister function

2016-03-18 Thread Javier Martinez Canillas
Hello Shuah,

On 03/18/2016 11:01 AM, Shuah Khan wrote:
> On 03/18/2016 07:05 AM, Mauro Carvalho Chehab wrote:
>> Now that media_device_unregister() also does a cleanup, rename it
>> to media_device_unregister_cleanup().
>>
>> Signed-off-by: Mauro Carvalho Chehab 
> 
> I think adding cleanup is redundant. media_device_unregister()
> would imply that there has to be some cleanup releasing resources.
> I wouldn't make this change.
>

Problem is that there is a media_device_init() and media_device_register(),
so having both unregister and cleanup in this function will make very clear
that a single function is the counter part of the previous two operations.
 
> thanks,
> -- Shuah
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [media] media: rename media unregister function

2016-03-19 Thread Javier Martinez Canillas
Hello Mauro,

On 03/18/2016 10:05 AM, Mauro Carvalho Chehab wrote:
> Now that media_device_unregister() also does a cleanup, rename it
> to media_device_unregister_cleanup().
>

I believe there should be a Suggested-by Sakari Ailus tag here.
 
> Signed-off-by: Mauro Carvalho Chehab 

The patch looks good and I agree that makes things more clear.

Reviewed-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 13/24] platform: add video-multiplexer subdevice driver

2017-01-24 Thread Javier Martinez Canillas
Hello Steve,

On Fri, Jan 6, 2017 at 11:11 PM, Steve Longerbeam  wrote:
> From: Philipp Zabel 

[snip]

>
> +config VIDEO_MULTIPLEXER
> +   tristate "Video Multiplexer"
> +   depends on VIDEO_V4L2_SUBDEV_API && MEDIA_CONTROLLER

The driver can be build as a module...

> +
> +static const struct of_device_id vidsw_dt_ids[] = {
> +   { .compatible = "video-multiplexer", },
> +   { /* sentinel */ }
> +};
> +

... so you need a MODULE_DEVICE_TABLE(of, vidsw_dt_ids) here or
otherwise module autoloading won't work.

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


[PATCH] staging: octeon: Use IS_ENABLED() instead of checking for built-in or module

2016-07-14 Thread Javier Martinez Canillas
The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either
built-in or as a module, use that macro instead of open coding the same.

Signed-off-by: Javier Martinez Canillas 
---

 drivers/staging/octeon/ethernet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon/ethernet.c 
b/drivers/staging/octeon/ethernet.c
index e9cd5f242921..c0c62143ffc8 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -238,7 +238,7 @@ static int cvm_oct_common_change_mtu(struct net_device 
*dev, int new_mtu)
struct octeon_ethernet *priv = netdev_priv(dev);
int interface = INTERFACE(priv->port);
int index = INDEX(priv->port);
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+#if IS_ENABLED(CONFIG_VLAN_8021Q)
int vlan_bytes = 4;
 #else
int vlan_bytes = 0;
-- 
2.5.5

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


Re: [PATCH] staging: octeon: Use IS_ENABLED() instead of checking for built-in or module

2016-08-25 Thread Javier Martinez Canillas
Hello Greg,

On 08/21/2016 12:02 PM, Greg Kroah-Hartman wrote:
> On Thu, Jul 14, 2016 at 01:06:09PM -0400, Javier Martinez Canillas wrote:
>> The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either
>> built-in or as a module, use that macro instead of open coding the same.
>>
>> Signed-off-by: Javier Martinez Canillas 
>> Acked-by: David Daney 
>> ---
>>
>>  drivers/staging/octeon/ethernet.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/octeon/ethernet.c 
>> b/drivers/staging/octeon/ethernet.c
>> index e9cd5f242921..c0c62143ffc8 100644
>> --- a/drivers/staging/octeon/ethernet.c
>> +++ b/drivers/staging/octeon/ethernet.c
>> @@ -238,7 +238,7 @@ static int cvm_oct_common_change_mtu(struct net_device 
>> *dev, int new_mtu)
>>  struct octeon_ethernet *priv = netdev_priv(dev);
>>  int interface = INTERFACE(priv->port);
>>  int index = INDEX(priv->port);
>> -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
>> +#if IS_ENABLED(CONFIG_VLAN_8021Q)
>>  int vlan_bytes = 4;
>>  #else
>>  int vlan_bytes = 0;
> 
> Fails to apply to the tree :(
> 

Ok, it used to apply when the patch was posted so I guess that something
changed in the code. I'll post a new one rebased on top of latest head.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[RESEND PATCH] staging: octeon: Use IS_ENABLED() instead of checking for built-in or module

2016-08-25 Thread Javier Martinez Canillas
The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either
built-in or as a module, use that macro instead of open coding the same.

Using the macro makes the code more readable by helping abstract away some
of the Kconfig built-in and module enable details.

Signed-off-by: Javier Martinez Canillas 
Acked-by: David Daney 

---

Changes since first post:
- Added David Daney Acked-by tag.
- Rebased on top of latest master.

 drivers/staging/octeon/ethernet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon/ethernet.c 
b/drivers/staging/octeon/ethernet.c
index 2eb97317f631..a473f034b01a 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -237,7 +237,7 @@ static int cvm_oct_common_change_mtu(struct net_device 
*dev, int new_mtu)
 {
struct octeon_ethernet *priv = netdev_priv(dev);
int interface = INTERFACE(priv->port);
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+#if IS_ENABLED(CONFIG_VLAN_8021Q)
int vlan_bytes = 4;
 #else
int vlan_bytes = 0;
-- 
2.5.5

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


Re: [RESEND PATCH] staging: octeon: Use IS_ENABLED() instead of checking for built-in or module

2016-08-25 Thread Javier Martinez Canillas
Hello David,

On 08/25/2016 12:01 PM, David Daney wrote:
> On 08/25/2016 06:55 AM, Javier Martinez Canillas wrote:
>> The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either
>> built-in or as a module, use that macro instead of open coding the same.
>>
>> Using the macro makes the code more readable by helping abstract away some
>> of the Kconfig built-in and module enable details.
>>
>> Signed-off-by: Javier Martinez Canillas 
>> Acked-by: David Daney 
>>
>> ---
>>
>> Changes since first post:
>> - Added David Daney Acked-by tag.
>> - Rebased on top of latest master.
>>
> 
> You changed something about the patch.  In this case the Subject is not 
> "RESEND", but rather "v2".  Incorrect Subject lines like this can lead to the 
> patch being inadvertently ignored.
>

Yes, in fact I thought about adding a v2 suffix instead of RESEND but since
I didn't change the patch content (besides merge conflicts resolution), I
preferred to add the latter.

I can re-spin the patch if that's an issue.

> David Daney
> 
 
Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: octeon: Use IS_ENABLED() instead of checking for built-in or module

2016-09-01 Thread Javier Martinez Canillas
The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either
built-in or as a module, use that macro instead of open coding the same.

Using the macro makes the code more readable by helping abstract away some
of the Kconfig built-in and module enable details.

Signed-off-by: Javier Martinez Canillas 
Acked-by: David Daney 

---

Changes in v2:
- Added David Daney Acked-by tag.
- Rebased on top of latest master.

 drivers/staging/octeon/ethernet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon/ethernet.c 
b/drivers/staging/octeon/ethernet.c
index 2eb97317f631..a473f034b01a 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -237,7 +237,7 @@ static int cvm_oct_common_change_mtu(struct net_device 
*dev, int new_mtu)
 {
struct octeon_ethernet *priv = netdev_priv(dev);
int interface = INTERFACE(priv->port);
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+#if IS_ENABLED(CONFIG_VLAN_8021Q)
int vlan_bytes = 4;
 #else
int vlan_bytes = 0;
-- 
2.7.4

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


Re: [RESEND PATCH] staging: octeon: Use IS_ENABLED() instead of checking for built-in or module

2016-09-01 Thread Javier Martinez Canillas
On 09/01/2016 05:32 PM, Greg Kroah-Hartman wrote:
> On Thu, Aug 25, 2016 at 06:56:07PM -0400, Javier Martinez Canillas wrote:
>> Hello David,
>>
>> On 08/25/2016 12:01 PM, David Daney wrote:
>>> On 08/25/2016 06:55 AM, Javier Martinez Canillas wrote:
>>>> The IS_ENABLED() macro checks if a Kconfig symbol has been enabled either
>>>> built-in or as a module, use that macro instead of open coding the same.
>>>>
>>>> Using the macro makes the code more readable by helping abstract away some
>>>> of the Kconfig built-in and module enable details.
>>>>
>>>> Signed-off-by: Javier Martinez Canillas 
>>>> Acked-by: David Daney 
>>>>
>>>> ---
>>>>
>>>> Changes since first post:
>>>> - Added David Daney Acked-by tag.
>>>> - Rebased on top of latest master.
>>>>
>>>
>>> You changed something about the patch.  In this case the Subject is not 
>>> "RESEND", but rather "v2".  Incorrect Subject lines like this can lead to 
>>> the patch being inadvertently ignored.
>>>
>>
>> Yes, in fact I thought about adding a v2 suffix instead of RESEND but since
>> I didn't change the patch content (besides merge conflicts resolution), I
>> preferred to add the latter.
>>
>> I can re-spin the patch if that's an issue.
> 
> Please do.
>

Done.
 
> thanks,
> 
> greg k-h
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/5] [media] Fix module autoload for media platform drivers

2016-10-17 Thread Javier Martinez Canillas
Hello Mauro,

I noticed that module autoload won't be working in a bunch of media
platform drivers because the module alias information is not filled
in the modules. This patch series contains the fixes for them.

Best regards,
Javier


Javier Martinez Canillas (5):
  [media] v4l: vsp1: Fix module autoload for OF registration
  [media] v4l: rcar-fcp: Fix module autoload for OF registration
  [media] rc: meson-ir: Fix module autoload
  [media] s5p-cec: Fix module autoload
  [media] st-cec: Fix module autoload

 drivers/media/platform/rcar-fcp.c   | 1 +
 drivers/media/platform/vsp1/vsp1_drv.c  | 1 +
 drivers/media/rc/meson-ir.c | 1 +
 drivers/staging/media/s5p-cec/s5p_cec.c | 1 +
 drivers/staging/media/st-cec/stih-cec.c | 1 +
 5 files changed, 5 insertions(+)

-- 
2.7.4

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


[PATCH 4/5] [media] s5p-cec: Fix module autoload

2016-10-17 Thread Javier Martinez Canillas
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/media/s5p-cec/s5p-cec.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/media/s5p-cec/s5p-cec.ko | grep alias
alias:  of:N*T*Csamsung,s5p-cecC*
alias:  of:N*T*Csamsung,s5p-cec

Signed-off-by: Javier Martinez Canillas 
---

 drivers/staging/media/s5p-cec/s5p_cec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/s5p-cec/s5p_cec.c 
b/drivers/staging/media/s5p-cec/s5p_cec.c
index 1780a08b73c9..4e41f72dbfaa 100644
--- a/drivers/staging/media/s5p-cec/s5p_cec.c
+++ b/drivers/staging/media/s5p-cec/s5p_cec.c
@@ -263,6 +263,7 @@ static const struct of_device_id s5p_cec_match[] = {
},
{},
 };
+MODULE_DEVICE_TABLE(of, s5p_cec_match);
 
 static struct platform_driver s5p_cec_pdrv = {
.probe  = s5p_cec_probe,
-- 
2.7.4

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


[PATCH 5/5] [media] st-cec: Fix module autoload

2016-10-17 Thread Javier Martinez Canillas
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/media//st-cec/stih-cec.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/media//st-cec/stih-cec.ko | grep alias
alias:  of:N*T*Cst,stih-cecC*
alias:  of:N*T*Cst,stih-cec

Signed-off-by: Javier Martinez Canillas 

---

 drivers/staging/media/st-cec/stih-cec.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/media/st-cec/stih-cec.c 
b/drivers/staging/media/st-cec/stih-cec.c
index 214344866a6b..19d3ff30c8f8 100644
--- a/drivers/staging/media/st-cec/stih-cec.c
+++ b/drivers/staging/media/st-cec/stih-cec.c
@@ -363,6 +363,7 @@ static const struct of_device_id stih_cec_match[] = {
},
{},
 };
+MODULE_DEVICE_TABLE(of, stih_cec_match);
 
 static struct platform_driver stih_cec_pdrv = {
.probe  = stih_cec_probe,
-- 
2.7.4

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


[PATCH] staging: fbtft: Fix module autoload

2016-10-17 Thread Javier Martinez Canillas
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/staging/fbtft/flexfb.ko | grep alias
$

After this patch:

$ modinfo drivers/staging/fbtft/flexfb.ko | grep alias
alias:  platform:flexpfb

Signed-off-by: Javier Martinez Canillas 
---

 drivers/staging/fbtft/flexfb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index 2dc5f9b6b47e..ded10718712b 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -830,6 +830,7 @@ static const struct platform_device_id 
flexfb_platform_ids[] = {
{ "flexpfb", 0 },
{ },
 };
+MODULE_DEVICE_TABLE(platform, flexfb_platform_ids);
 
 static struct platform_driver flexfb_platform_driver = {
.driver = {
-- 
2.7.4

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


[PATCH 0/4] [media] Media entity cleanups and build fixes

2015-08-19 Thread Javier Martinez Canillas
Hello,

This series contains a couple of build fixes and cleanups for the
Media Controller framework. The goal of the series is to get rid of
the struct media_entity .parent member since now that a media_gobj is
embedded into entities, the media_gobj .mdev member can be used to
store a pointer to the parent struct media_device.

So the .parent field becomes redundant and can be removed after all
the users are converted to use entity .graph_obj.mdev instead.

Patches 1/4 and 2/4 are build fixes I found while build testing if no
regressions were introduced by the conversion. Patch 3/4 converts
all the drivers and the MC core to use .mdev instead of .parent and
finally patch 4/4 removes the .parent field since now is unused.

The series depend on Mauro's "[PATCH v6 0/8] MC preparation patches
series" [0].

The transformation were automated using a coccinelle semantic patch
and the drivers were build tested using allyesconfig and x-building
the ARM Exynos and OMAP defconfigs + the needed media config options.

Best regards,
Javier

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


Javier Martinez Canillas (4):
  [media] staging: omap4iss: get entity ID using media_entity_id()
  [media] omap3isp: get entity ID using media_entity_id()
  [media] media: use entity.graph_obj.mdev instead of .parent
  [media] media: remove media entity .parent field

 drivers/media/media-device.c   |  8 ++---
 drivers/media/media-entity.c   | 34 --
 drivers/media/platform/exynos4-is/fimc-isp-video.c |  6 ++--
 drivers/media/platform/exynos4-is/fimc-lite.c  |  8 ++---
 drivers/media/platform/exynos4-is/media-dev.c  |  2 +-
 drivers/media/platform/exynos4-is/media-dev.h  |  8 ++---
 drivers/media/platform/omap3isp/isp.c  | 11 ---
 drivers/media/platform/omap3isp/ispccdc.c  |  2 +-
 drivers/media/platform/omap3isp/ispvideo.c | 10 ---
 drivers/media/platform/vsp1/vsp1_video.c   |  2 +-
 drivers/media/platform/xilinx/xilinx-dma.c |  2 +-
 drivers/staging/media/davinci_vpfe/vpfe_video.c|  6 ++--
 drivers/staging/media/omap4iss/iss.c   |  6 ++--
 drivers/staging/media/omap4iss/iss_video.c |  4 +--
 include/media/media-entity.h   |  1 -
 15 files changed, 58 insertions(+), 52 deletions(-)

-- 
2.4.3

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


[PATCH 1/4] [media] staging: omap4iss: get entity ID using media_entity_id()

2015-08-19 Thread Javier Martinez Canillas
The struct media_entity does not have an .id field anymore since
now the entity ID is stored in the embedded struct media_gobj.

This caused the omap4iss driver fail to build. Fix by using the
media_entity_id() macro to obtain the entity ID.

Signed-off-by: Javier Martinez Canillas 
---

 drivers/staging/media/omap4iss/iss.c   | 2 +-
 drivers/staging/media/omap4iss/iss_video.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/omap4iss/iss.c 
b/drivers/staging/media/omap4iss/iss.c
index f32ab7b98ae2..7226553ceb2f 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -607,7 +607,7 @@ static int iss_pipeline_disable(struct iss_pipeline *pipe,
 * crashed. Mark it as such, the ISS will be reset when
 * applications will release it.
 */
-   iss->crashed |= 1U << subdev->entity.id;
+   iss->crashed |= 1U << media_entity_id(&subdev->entity);
failure = -ETIMEDOUT;
}
}
diff --git a/drivers/staging/media/omap4iss/iss_video.c 
b/drivers/staging/media/omap4iss/iss_video.c
index bae67742706f..25e9e7a6b99d 100644
--- a/drivers/staging/media/omap4iss/iss_video.c
+++ b/drivers/staging/media/omap4iss/iss_video.c
@@ -784,7 +784,7 @@ iss_video_streamon(struct file *file, void *fh, enum 
v4l2_buf_type type)
entity = &video->video.entity;
media_entity_graph_walk_start(&graph, entity);
while ((entity = media_entity_graph_walk_next(&graph)))
-   pipe->entities |= 1 << entity->id;
+   pipe->entities |= 1 << media_entity_id(entity);
 
/* Verify that the currently configured format matches the output of
 * the connected subdev.
-- 
2.4.3

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


[PATCH 3/4] [media] media: use entity.graph_obj.mdev instead of .parent

2015-08-19 Thread Javier Martinez Canillas
The struct media_entity has a .parent field that stores a pointer
to the parent struct media_device. But recently a media_gobj was
embedded into the entities and since struct media_gojb already has
a pointer to a struct media_device in the .mdev field, the .parent
field becomes redundant and can be removed.

This patch replaces all the usage of .parent by .graph_obj.mdev so
that field will become unused and can be removed on a later patch.

No functional changes.

The transformation was made using the following coccinelle spatch:

@@
struct media_entity *me;
@@

- me->parent
+ me->graph_obj.mdev

@@
struct media_entity *link;
@@

- link->source->entity->parent
+ link->source->entity->graph_obj.mdev

@@
struct exynos_video_entity *ve;
@@

- ve->vdev.entity.parent
+ ve->vdev.entity.graph_obj.mdev

Suggested-by: Mauro Carvalho Chehab 
Signed-off-by: Javier Martinez Canillas 
---

 drivers/media/media-device.c   |  8 ++---
 drivers/media/media-entity.c   | 34 --
 drivers/media/platform/exynos4-is/fimc-isp-video.c |  6 ++--
 drivers/media/platform/exynos4-is/fimc-lite.c  |  8 ++---
 drivers/media/platform/exynos4-is/media-dev.c  |  2 +-
 drivers/media/platform/exynos4-is/media-dev.h  |  8 ++---
 drivers/media/platform/omap3isp/isp.c  |  4 +--
 drivers/media/platform/omap3isp/ispvideo.c |  2 +-
 drivers/media/platform/vsp1/vsp1_video.c   |  2 +-
 drivers/media/platform/xilinx/xilinx-dma.c |  2 +-
 drivers/staging/media/davinci_vpfe/vpfe_video.c|  6 ++--
 drivers/staging/media/omap4iss/iss.c   |  4 +--
 drivers/staging/media/omap4iss/iss_video.c |  2 +-
 13 files changed, 45 insertions(+), 43 deletions(-)

diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index 0f3844470147..138b18416460 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -435,8 +435,8 @@ int __must_check media_device_register_entity(struct 
media_device *mdev,
int i;
 
/* Warn if we apparently re-register an entity */
-   WARN_ON(entity->parent != NULL);
-   entity->parent = mdev;
+   WARN_ON(entity->graph_obj.mdev != NULL);
+   entity->graph_obj.mdev = mdev;
 
spin_lock(&mdev->lock);
/* Initialize media_gobj embedded at the entity */
@@ -471,7 +471,7 @@ EXPORT_SYMBOL_GPL(media_device_register_entity);
 void media_device_unregister_entity(struct media_entity *entity)
 {
int i;
-   struct media_device *mdev = entity->parent;
+   struct media_device *mdev = entity->graph_obj.mdev;
 
if (mdev == NULL)
return;
@@ -484,7 +484,7 @@ void media_device_unregister_entity(struct media_entity 
*entity)
media_gobj_remove(&entity->graph_obj);
list_del(&entity->list);
spin_unlock(&mdev->lock);
-   entity->parent = NULL;
+   entity->graph_obj.mdev = NULL;
 }
 EXPORT_SYMBOL_GPL(media_device_unregister_entity);
 
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index 35e52cd1fc5a..a23c93369a04 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -332,7 +332,7 @@ EXPORT_SYMBOL_GPL(media_entity_graph_walk_next);
 __must_check int media_entity_pipeline_start(struct media_entity *entity,
 struct media_pipeline *pipe)
 {
-   struct media_device *mdev = entity->parent;
+   struct media_device *mdev = entity->graph_obj.mdev;
struct media_entity_graph graph;
struct media_entity *entity_err = entity;
int ret;
@@ -387,7 +387,7 @@ __must_check int media_entity_pipeline_start(struct 
media_entity *entity,
 
ret = entity->ops->link_validate(link);
if (ret < 0 && ret != -ENOIOCTLCMD) {
-   dev_dbg(entity->parent->dev,
+   dev_dbg(entity->graph_obj.mdev->dev,
"link validation failed for \"%s\":%u 
-> \"%s\":%u, error %d\n",
link->source->entity->name,
link->source->index,
@@ -401,7 +401,7 @@ __must_check int media_entity_pipeline_start(struct 
media_entity *entity,
 
if (!bitmap_full(active, entity->num_pads)) {
ret = -EPIPE;
-   dev_dbg(entity->parent->dev,
+   dev_dbg(entity->graph_obj.mdev->dev,
"\"%s\":%u must be connected by an enabled 
link\n",
entity->name,
(unsigned)find_first_zero_bit(
@@ -454,7 +454,7 @@ EXPORT_SYMBOL_GPL(media_entity_pipeline_s

[PATCH 06/18] staging: mt29f_spinand: Export OF module alias information

2015-08-20 Thread Javier Martinez Canillas
The SPI core always reports the MODALIAS uevent as "spi:"
regardless of the mechanism that was used to register the device
(i.e: OF or board code) and the table that is used later to match
the driver with the device (i.e: SPI id table or OF match table).

So drivers needs to export the SPI id table and this be built into
the module or udev won't have the necessary information to autoload
the needed driver module when the device is added.

But this means that OF-only drivers needs to have both OF and SPI id
tables that have to be kept in sync and also the dev node compatible
manufacturer prefix is stripped when reporting the MODALIAS. Which can
lead to issues if two vendors use the same SPI device name for example.

To avoid the above, the SPI core behavior may be changed in the future
to not require an SPI device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table even when
is unused now to prevent breaking module loading when the core changes.

Signed-off-by: Javier Martinez Canillas 
---

 drivers/staging/mt29f_spinand/mt29f_spinand.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/mt29f_spinand/mt29f_spinand.c 
b/drivers/staging/mt29f_spinand/mt29f_spinand.c
index ad30ce4206ef..1aa449e5fecf 100644
--- a/drivers/staging/mt29f_spinand/mt29f_spinand.c
+++ b/drivers/staging/mt29f_spinand/mt29f_spinand.c
@@ -941,6 +941,7 @@ static const struct of_device_id spinand_dt[] = {
{ .compatible = "spinand,mt29f", },
{}
 };
+MODULE_DEVICE_TABLE(of, spinand_dt);
 
 /*
  * Device name structure description
-- 
2.4.3

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


[PATCH 02/18] staging: iio: hmc5843: Export missing SPI module alias information

2015-08-20 Thread Javier Martinez Canillas
The SPI core always reports the MODALIAS uevent as "spi:"
regardless of the mechanism that was used to register the device
(i.e: OF or board code) and the table that is used later to match
the driver with the device (i.e: SPI id table or OF match table).

So drivers needs to export the SPI id table and this be built into
the module or udev won't have the necessary information to autoload
the needed driver module when the device is added.

Signed-off-by: Javier Martinez Canillas 
---

 drivers/staging/iio/magnetometer/hmc5843_spi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/iio/magnetometer/hmc5843_spi.c 
b/drivers/staging/iio/magnetometer/hmc5843_spi.c
index 8e658f736e1f..4dfb372d2fec 100644
--- a/drivers/staging/iio/magnetometer/hmc5843_spi.c
+++ b/drivers/staging/iio/magnetometer/hmc5843_spi.c
@@ -81,6 +81,7 @@ static const struct spi_device_id hmc5843_id[] = {
{ "hmc5983", HMC5983_ID },
{ }
 };
+MODULE_DEVICE_TABLE(spi, hmc5843_id);
 
 static struct spi_driver hmc5843_driver = {
.driver = {
-- 
2.4.3

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


[PATCH 00/18] Export SPI and OF module aliases in missing drivers

2015-08-20 Thread Javier Martinez Canillas
Hello,

Short version:

This patch series is the SPI equivalent of the I2C one posted before [0].

This series add the missing MODULE_DEVICE_TABLE() for OF and SPI tables
to export that information so modules have the correct aliases built-in
and autoloading works correctly.

Longer version:

The SPI core always reports the MODALIAS uevent as "spi:"
regardless of the mechanism that was used to register the device (i.e:
OF or board code) and the table that is used later to match the driver
with the device (i.e: SPI id table or OF match table).

But this means that OF-only drivers needs to have both OF and SPI id
tables that have to be kept in sync and also the device node's compatible
manufacturer prefix is stripped when reporting the MODALIAS. Which can
lead to issues if two vendors use the same SPI device name for example.

Also, there are many SPI drivers whose module auto-loading is not working
because of this fact that the SPI core always reports the MODALIAS as
spi: and many developers didn't expect this since is not how
other subsystems behave.

I've identified SPI drivers with 3 types of different issues:

a) Those that have an spi_table but are not exported. The match works
   if the driver is built-in but since the ID table is not exported,
   module auto-load won't work.

b) Those that have a of_table but are not exported. This is currently
   not an issue since even when the of_table is used to match the dev
   with the driver, an OF modalias is not reported by the SPI core.
   But if the SPI core is changed to report the MODALIAS of the form
   of:N*T*C as it's made by other subsystems, then module auto-load
   will break for these drivers.

c) Those that don't have an of_table but should since are OF drivers
   with DT bindings doc for them. Since the SPI core does not report
   a OF modalias and since spi_match_device() fallbacks to match the
   device part of the compatible string with the SPI device ID table,
   many OF drivers don't have an of_table to match. After all having
   a SPI device ID table is mandatory so it works without a of_table.

So, in order to not make mandatory to have a SPI device ID table, all
these three kind of issues have to be addressed. This series does that.

I split the changes so the patches in this series are independent and
can be picked individually by subsystem maintainers.

Patches #1 and #2 solves a), patches #3 to #8 solves b) and patches

Patch #18 changes the logic of spi_uevent() to report an OF modalias if
the device was registered using OF. But this patch is included in the
series only as an RFC for illustration purposes since changing that
without first applying all the other patches in this series, will break
module autoloading for the drivers of devices registered using OF but
that lacks an of_match_table. I'll repost patch #18 once all the patches
in this series have landed.

[0]: https://lkml.org/lkml/2015/7/30/519

Best regards,
Javier


Javier Martinez Canillas (18):
  iio: Export SPI module alias information in missing drivers
  staging: iio: hmc5843: Export missing SPI module alias information
  mtd: dataflash: Export OF module alias information
  OMAPDSS: panel-sony-acx565akm: Export OF module alias information
  mmc: mmc_spi: Export OF module alias information
  staging: mt29f_spinand: Export OF module alias information
  net: ks8851: Export OF module alias information
  [media] s5c73m3: Export OF module alias information
  mfd: cros_ec: spi: Add OF match table
  iio: dac: ad7303: Add OF match table
  iio: adc: max1027: Set struct spi_driver .of_match_table
  mfd: stmpe: Add OF match table
  iio: adc: mcp320x: Set struct spi_driver .of_match_table
  iio: as3935: Add OF match table
  iio: adc128s052: Add OF match table
  iio: frequency: adf4350: Add OF match table
  NFC: trf7970a: Add OF match table
  spi: (RFC, don't apply) report OF style modalias when probing using DT

 drivers/iio/adc/max1027.c   |  1 +
 drivers/iio/adc/mcp320x.c   |  1 +
 drivers/iio/adc/ti-adc128s052.c |  8 
 drivers/iio/amplifiers/ad8366.c |  1 +
 drivers/iio/dac/ad7303.c|  7 +++
 drivers/iio/frequency/adf4350.c |  9 +
 drivers/iio/proximity/as3935.c  |  7 +++
 drivers/media/i2c/s5c73m3/s5c73m3-spi.c |  1 +
 drivers/mfd/cros_ec_spi.c   |  7 +++
 drivers/mfd/stmpe-spi.c | 13 +
 drivers/mmc/host/mmc_spi.c  |  1 +
 drivers/mtd/devices/mtd_dataflash.c |  1 +
 drivers/net/ethernet/micrel/ks8851.c|  1 +
 drivers/nfc/trf7970a.c  |  7 +++
 drivers/spi/spi.c  

Re: [PATCH 0/4] [media] Media entity cleanups and build fixes

2015-08-20 Thread Javier Martinez Canillas
Hello Hans,

On 08/20/2015 02:41 PM, Hans Verkuil wrote:
> On 08/19/15 17:35, Javier Martinez Canillas wrote:
>> Hello,
>>
>> This series contains a couple of build fixes and cleanups for the
>> Media Controller framework. The goal of the series is to get rid of
>> the struct media_entity .parent member since now that a media_gobj is
>> embedded into entities, the media_gobj .mdev member can be used to
>> store a pointer to the parent struct media_device.
>>
>> So the .parent field becomes redundant and can be removed after all
>> the users are converted to use entity .graph_obj.mdev instead.
>>
>> Patches 1/4 and 2/4 are build fixes I found while build testing if no
>> regressions were introduced by the conversion. Patch 3/4 converts
>> all the drivers and the MC core to use .mdev instead of .parent and
>> finally patch 4/4 removes the .parent field since now is unused.
> 
> Regarding patches 1 and 2: these should of course be merged with Mauro's
> patches that make this particular change (patch 3/8), otherwise it would
> break git bisect.
> 
> Anyway,
> 
> Acked-by: Hans Verkuil  for the changes in patch

Thanks a lot for the acks.

> 1 and 2, as long as they are added to Mauro's patch 3/8.
>

Indeed, I completely agree that these should be squashed with
Mauro's patch to maintain git bisect-ability.
 
> Regards,
> 
>   Hans
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/18] Export SPI and OF module aliases in missing drivers

2015-08-20 Thread Javier Martinez Canillas
Hello Brian,

On 08/20/2015 11:11 PM, Brian Norris wrote:
> On Thu, Aug 20, 2015 at 09:07:13AM +0200, Javier Martinez Canillas wrote:
>> Patches #1 and #2 solves a), patches #3 to #8 solves b) and patches
> 
> ^^^ I'm dying to know how this sentence ends :)
>

Sigh, I did some last minute restructuring of the cover letter and
seems I missed a sentence. I meant to said:

"and patches #9 to #17 solves c)."
 
>> Patch #18 changes the logic of spi_uevent() to report an OF modalias if
>> the device was registered using OF. But this patch is included in the
>> series only as an RFC for illustration purposes since changing that
>> without first applying all the other patches in this series, will break
>> module autoloading for the drivers of devices registered using OF but
>> that lacks an of_match_table. I'll repost patch #18 once all the patches
>> in this series have landed.
> 
> On a more productive note, the patches I've looked at look good to me.
> The missing aliases are a problem enough that should be fixed (i.e.,
> part (b)). I'll leave the SPI framework changes to others to comment on.
>

Great, thanks a lot for your feedback.
 
> Brian
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/4] [media] staging: omap4iss: get entity ID using media_entity_id()

2015-08-20 Thread Javier Martinez Canillas
Hello Laurent,

On 08/20/2015 08:37 PM, Laurent Pinchart wrote:
> Hi Javier,
> 
> Thank you for the patch.
> 
> On Wednesday 19 August 2015 17:35:19 Javier Martinez Canillas wrote:
>> The struct media_entity does not have an .id field anymore since
>> now the entity ID is stored in the embedded struct media_gobj.
>>
>> This caused the omap4iss driver fail to build. Fix by using the
>> media_entity_id() macro to obtain the entity ID.
>>
>> Signed-off-by: Javier Martinez Canillas 
> 
> This looks fine to me. The patch needs to be moved between Mauro's 1/8 and 
> 2/8 
> patches to avoid breaking bisection with patch 3/8. I'd squash this patch and 
> 2/4 into a single "media: Use media_entity_id() in drivers" patch.
> 

Yes, Hans and Mauro already mentioned it and I completely agree that
should be squashed with Mauro's patch to maintain git bisect-ability.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/4] [media] staging: omap4iss: get entity ID using media_entity_id()

2015-08-20 Thread Javier Martinez Canillas
Hello Laurent,

On 08/21/2015 02:15 AM, Laurent Pinchart wrote:
> Hi Javier,
> 
> On Friday 21 August 2015 02:14:05 Javier Martinez Canillas wrote:
>> On 08/20/2015 08:37 PM, Laurent Pinchart wrote:
>>> On Wednesday 19 August 2015 17:35:19 Javier Martinez Canillas wrote:
>>>> The struct media_entity does not have an .id field anymore since
>>>> now the entity ID is stored in the embedded struct media_gobj.
>>>>
>>>> This caused the omap4iss driver fail to build. Fix by using the
>>>> media_entity_id() macro to obtain the entity ID.
>>>>
>>>> Signed-off-by: Javier Martinez Canillas 
>>>
>>> This looks fine to me. The patch needs to be moved between Mauro's 1/8 and
>>> 2/8 patches to avoid breaking bisection with patch 3/8. I'd squash this
>>> patch and 2/4 into a single "media: Use media_entity_id() in drivers"
>>> patch.
>>
>> Yes, Hans and Mauro already mentioned it and I completely agree that
>> should be squashed with Mauro's patch to maintain git bisect-ability.
> 
> I wouldn't squash patches 1/4 and 2/4 into Mauro's 3/8 patch as Hans 
> proposed, 
> but instead squashing them together into a single patch and move the result 
> as 
> 1.5/8 in Mauro's series.
> 

I see. I don't mind either option tbh, I'm OK with whatever works better.

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: ste_rmi4: Remove unnecessary MODULE_ALIAS()

2015-08-30 Thread Javier Martinez Canillas
The driver has a I2C device id table that is used to create the modaliases
which already contains "synaptics_rmi4_ts". So the alias is not needed.

Signed-off-by: Javier Martinez Canillas 

---

 drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c 
b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
index 1f9ba8beb061..824d460911ec 100644
--- a/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
+++ b/drivers/staging/ste_rmi4/synaptics_i2c_rmi4.c
@@ -1138,4 +1138,3 @@ module_i2c_driver(synaptics_rmi4_driver);
 MODULE_LICENSE("GPL v2");
 MODULE_AUTHOR("naveen.gaddip...@stericsson.com, js...@stericsson.com");
 MODULE_DESCRIPTION("synaptics rmi4 i2c touch Driver");
-MODULE_ALIAS("i2c:synaptics_rmi4_ts");
-- 
2.4.3

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


Re: [PATCH 02/18] staging: iio: hmc5843: Export missing SPI module alias information

2015-08-31 Thread Javier Martinez Canillas
Hello Jonathan,

On 08/22/2015 07:59 PM, Jonathan Cameron wrote:
> On 20/08/15 08:07, Javier Martinez Canillas wrote:
>> The SPI core always reports the MODALIAS uevent as "spi:"
>> regardless of the mechanism that was used to register the device
>> (i.e: OF or board code) and the table that is used later to match
>> the driver with the device (i.e: SPI id table or OF match table).
>>
>> So drivers needs to export the SPI id table and this be built into
>> the module or udev won't have the necessary information to autoload
>> the needed driver module when the device is added.
>>
>> Signed-off-by: Javier Martinez Canillas 
> Applied to the togreg branch of iio.git.
> 
> This is too late for the upcoming merge window so it will be queued up for
> the next one.
>

IMHO this patch and "[PATCH 01/18] iio: Export SPI module alias
information in missing drivers" [0] are fixing broken module
autoloading which are bugs so are material for the 4.3 -rc cycle.
 
> Thanks,
> 
> Jonathan

[0]: https://lkml.org/lkml/2015/8/20/111

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/5] [media] staging: omap4iss: separate links creation from entities init

2015-09-03 Thread Javier Martinez Canillas
The omap4iss driver initializes the entities and creates the pads links
before the entities are registered with the media device. This does not
work now that object IDs are used to create links so the media_device
has to be set.

Split out the pads links creation from the entity initialization so are
made after the entities registration.

Signed-off-by: Javier Martinez Canillas 
---

 drivers/staging/media/omap4iss/iss.c | 101 ++-
 drivers/staging/media/omap4iss/iss_csi2.c|  35 +++---
 drivers/staging/media/omap4iss/iss_csi2.h|   1 +
 drivers/staging/media/omap4iss/iss_ipipeif.c |  29 
 drivers/staging/media/omap4iss/iss_ipipeif.h |   1 +
 drivers/staging/media/omap4iss/iss_resizer.c |  29 
 drivers/staging/media/omap4iss/iss_resizer.h |   1 +
 7 files changed, 132 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/media/omap4iss/iss.c 
b/drivers/staging/media/omap4iss/iss.c
index 44b88ff3ba83..076ddd412201 100644
--- a/drivers/staging/media/omap4iss/iss.c
+++ b/drivers/staging/media/omap4iss/iss.c
@@ -1272,6 +1272,68 @@ done:
return ret;
 }
 
+/*
+ * iss_create_pads_links() - Pads links creation for the subdevices
+ * @iss : Pointer to ISS device
+ *
+ * return negative error code or zero on success
+ */
+static int iss_create_pads_links(struct iss_device *iss)
+{
+   int ret;
+
+   ret = omap4iss_csi2_create_pads_links(iss);
+   if (ret < 0) {
+   dev_err(iss->dev, "CSI2 pads links creation failed\n");
+   return ret;
+   }
+
+   ret = omap4iss_ipipeif_create_pads_links(iss);
+   if (ret < 0) {
+   dev_err(iss->dev, "ISP IPIPEIF pads links creation failed\n");
+   return ret;
+   }
+
+   ret = omap4iss_resizer_create_pads_links(iss);
+   if (ret < 0) {
+   dev_err(iss->dev, "ISP RESIZER pads links creation failed\n");
+   return ret;
+   }
+
+   /* Connect the submodules. */
+   ret = media_create_pad_link(
+   &iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
+   &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
+   if (ret < 0)
+   return ret;
+
+   ret = media_create_pad_link(
+   &iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
+   &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
+   if (ret < 0)
+   return ret;
+
+   ret = media_create_pad_link(
+   &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
+   &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
+   if (ret < 0)
+   return ret;
+
+   ret = media_create_pad_link(
+   &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
+   &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
+   if (ret < 0)
+   return ret;
+
+   ret = media_create_pad_link(
+   &iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
+   &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
+   if (ret < 0)
+   return ret;
+
+   return 0;
+};
+
 static void iss_cleanup_modules(struct iss_device *iss)
 {
omap4iss_csi2_cleanup(iss);
@@ -1314,41 +1376,8 @@ static int iss_initialize_modules(struct iss_device *iss)
goto error_resizer;
}
 
-   /* Connect the submodules. */
-   ret = media_create_pad_link(
-   &iss->csi2a.subdev.entity, CSI2_PAD_SOURCE,
-   &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
-   if (ret < 0)
-   goto error_link;
-
-   ret = media_create_pad_link(
-   &iss->csi2b.subdev.entity, CSI2_PAD_SOURCE,
-   &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SINK, 0);
-   if (ret < 0)
-   goto error_link;
-
-   ret = media_create_pad_link(
-   &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
-   &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
-   if (ret < 0)
-   goto error_link;
-
-   ret = media_create_pad_link(
-   &iss->ipipeif.subdev.entity, IPIPEIF_PAD_SOURCE_VP,
-   &iss->ipipe.subdev.entity, IPIPE_PAD_SINK, 0);
-   if (ret < 0)
-   goto error_link;
-
-   ret = media_create_pad_link(
-   &iss->ipipe.subdev.entity, IPIPE_PAD_SOURCE_VP,
-   &iss->resizer.subdev.entity, RESIZER_PAD_SINK, 0);
-   if (ret < 0)
-   goto error_link;
-
return 0;
 
-error_link:
-   omap4iss_resizer_cleanup(iss);
 error_resizer:
omap4iss_ipipe_clean

[PATCH 0/5] [media] Create pads links after entities registration

2015-09-03 Thread Javier Martinez Canillas
Hello,

This series changes all the MC media drivers that are currently creating
pads links before registering the media entities with the media device.

The patches are similar to the ones posted for the OMAP3 ISP driver [0]
and depends on Mauro's "[PATCH v8 00/55] MC next generation patches" [1].

The patches just moves the entities registration logic before pads links
creation and in the case of the vsp1, split the pads links creationg from
the entities initialization logic as it was made for the OMAP3 ISP driver.

Unfortunately I don't have hardware to test these patches and they were
only build tested. So testing that I didn't introduce any regression will
be highly appreciated.

[0]: https://lkml.org/lkml/2015/8/26/453
[1]: http://www.spinics.net/lists/linux-samsung-soc/msg47089.html

Best regards,
Javier


Javier Martinez Canillas (5):
  [media] staging: omap4iss: separate links creation from entities init
  [media] v4l: vsp1: create pad links after subdev registration
  [media] v4l: vsp1: separate links creation from entities init
  [media] uvcvideo: create pad links after subdev registration
  [media] smiapp: create pad links after subdev registration

 drivers/media/i2c/smiapp/smiapp-core.c   |  20 +++---
 drivers/media/platform/vsp1/vsp1_drv.c   |  30 +---
 drivers/media/platform/vsp1/vsp1_rpf.c   |  29 +---
 drivers/media/platform/vsp1/vsp1_rwpf.h  |   5 ++
 drivers/media/platform/vsp1/vsp1_wpf.c   |  40 +++
 drivers/media/usb/uvc/uvc_entity.c   |  16 +++--
 drivers/staging/media/omap4iss/iss.c | 101 ++-
 drivers/staging/media/omap4iss/iss_csi2.c|  35 +++---
 drivers/staging/media/omap4iss/iss_csi2.h|   1 +
 drivers/staging/media/omap4iss/iss_ipipeif.c |  29 
 drivers/staging/media/omap4iss/iss_ipipeif.h |   1 +
 drivers/staging/media/omap4iss/iss_resizer.c |  29 
 drivers/staging/media/omap4iss/iss_resizer.h |   1 +
 13 files changed, 224 insertions(+), 113 deletions(-)

-- 
2.4.3

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


Re: [PATCH 02/18] staging: iio: hmc5843: Export missing SPI module alias information

2015-09-05 Thread Javier Martinez Canillas
Hello Jonathan,

On 09/05/2015 06:31 PM, Jonathan Cameron wrote:
> On 01/09/15 00:09, Javier Martinez Canillas wrote:
>> Hello Jonathan,
>>
>> On 08/22/2015 07:59 PM, Jonathan Cameron wrote:
>>> On 20/08/15 08:07, Javier Martinez Canillas wrote:
>>>> The SPI core always reports the MODALIAS uevent as "spi:"
>>>> regardless of the mechanism that was used to register the device
>>>> (i.e: OF or board code) and the table that is used later to match
>>>> the driver with the device (i.e: SPI id table or OF match table).
>>>>
>>>> So drivers needs to export the SPI id table and this be built into
>>>> the module or udev won't have the necessary information to autoload
>>>> the needed driver module when the device is added.
>>>>
>>>> Signed-off-by: Javier Martinez Canillas 
>>> Applied to the togreg branch of iio.git.
>>>
>>> This is too late for the upcoming merge window so it will be queued up for
>>> the next one.
>>>
>>
>> IMHO this patch and "[PATCH 01/18] iio: Export SPI module alias
>> information in missing drivers" [0] are fixing broken module
>> autoloading which are bugs so are material for the 4.3 -rc cycle.
> 
> It's a corner case.  Could also be argued that this isn't
> a bug but rather a case of a feature (autoprobing) being added
> that wasn't supported before.  It's not obligatory to support
> autoloading (even if we would normally aim to do so).
> 
> I'm happy enough for a request to apply these to stable occurs
> after they hit Linus' tree (as a trivial backport) but I don't
> think they really deserve being sent on as fixes.
> 
> Of course, I might be missing something that means something is
> actually broken, as opposed to not present.
>

Well, as a user I would expect that if I have a driver built-in
and it works, building it as a module will also work so I think
module autoload it's a bugfix and not a new feature.

And the patch is trivial and won't cause any issues so I don't
see why it can't be -rc material.

But of course is up to you, git log shows me that these drivers
have been since v3.10 so it seems that nobody cared anyways.
 
> Jonathan
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v8 10/55] [media] media: rename the function that create pad links

2015-09-10 Thread Javier Martinez Canillas
On Sun, Aug 30, 2015 at 5:06 AM, Mauro Carvalho Chehab
 wrote:
> With the new API, a link can be either between two PADs or between an 
> interface
> and an entity. So, we need to use a better name for the function that create
> links between two pads.
>
> So, rename the such function to media_create_pad_link().
>
> No functional changes.
>
> This patch was created via this shell script:
> for i in $(find drivers/media -name '*.[ch]' -type f) $(find 
> drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' 
> -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a 
> && mv a $i; done
>
> Signed-off-by: Mauro Carvalho Chehab 
> Acked-by: Hans Verkuil 
> Signed-off-by: Mauro Carvalho Chehab 
>

Reviewed-by: Javier Martinez Canillas 
Tested-by: Javier Martinez Canillas 

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


[PATCH] staging: dgap: fix returned errno code in dgap_parsefile()

2015-09-21 Thread Javier Martinez Canillas
The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed. Since the error number is propagated,
the caller will get a -EPERM which is the wrong error condition.

Also, the smatch tool complains with the following warning:

dgap_parsefile() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Javier Martinez Canillas 

---

 drivers/staging/dgap/dgap.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
index 303d97023ccb..e17bde7bf416 100644
--- a/drivers/staging/dgap/dgap.c
+++ b/drivers/staging/dgap/dgap.c
@@ -642,7 +642,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
 
@@ -861,7 +861,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = TNODE;
@@ -883,7 +883,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = CUNODE;
@@ -914,7 +914,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = LNODE;
@@ -933,7 +933,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = CNODE;
@@ -975,7 +975,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = MNODE;
@@ -1054,7 +1054,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = PNODE;
@@ -1076,7 +1076,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = JNODE;
@@ -1098,7 +1098,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = ANODE;
@@ -1120,7 +1120,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = INTRNODE;
@@ -1141,7 +1141,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = TSNODE;
@@ -1163,7 +1163,7 @@ static int dgap_parsefile(char **in)
 
p->next = kzalloc(sizeof(struct cnode), GFP_KERNEL);
if (!p->next)
-   return -1;
+   return -ENOMEM;
 
p = p->next;
p->type = CSNODE;
@@ -1185,7 +1185,7 @@ static int 

Re: [PATCH] staging: dgap: fix returned errno code in dgap_parsefile()

2015-09-21 Thread Javier Martinez Canillas
Hello Sudip,

On 09/22/2015 06:52 AM, Sudip Mukherjee wrote:
> On Tue, Sep 22, 2015 at 02:39:36AM +0200, Javier Martinez Canillas wrote:
>> The driver is using -1 instead of the -ENOMEM defined macro to specify
>> that a buffer allocation failed. Since the error number is propagated,
>> the caller will get a -EPERM which is the wrong error condition.
> Just a little doubt. caller means the function which is calling this
> dgap_parsefile() or you meant the user?

I meant whatever function calls dgap_parsefile(), which currently is
only dgap_firmware_load().

> The function which is calling this dgap_parsefile() is just checking if
> it has received 0 or something else. Something else is error and it
> rerturns -EINVAL for all types of error (ofcourse that is also wrong).
> So the user will see -EINVAL for all types of error in dgap_parsefile().
>

Yes, I also verified what dgap_firmware_load() does with the returned error
code to make sure that it was safe to do this change without affecting the
rest of the driver.

But I believe the patch and what the commit message says is true regardless
of the fact that the caller is just checking for != 0. dgap_firmware_load()
stills gets a wrong error condition whether it's checking it or not.
 
> regards
> sudip
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: wicl1000: fix dereference after free in wilc_wlan_cleanup()

2015-09-22 Thread Javier Martinez Canillas
The wilc_wlan_cleanup() function iterates over the list of transmission
buffers freeing all of them and then iterates over the receive buffers
list to free all of them as well.

But on the receive loop a pointer to struct txq_entry_t is dereferenced
instead of the pointer to a struct rxq_entry_t. This not only causes a
dereference to a pointer already freed but also leaks the memory in the
struct rxq_entry_t buffer.

Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Javier Martinez Canillas 

---

 drivers/staging/wilc1000/wilc_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 4c25179c2fec..c40f143b00b7 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1746,7 +1746,7 @@ static void wilc_wlan_cleanup(void)
if (rqe == NULL)
break;
 #ifdef MEMORY_DYNAMIC
-   kfree(tqe->buffer);
+   kfree(rqe->buffer);
 #endif
kfree(rqe);
} while (1);
-- 
2.4.3

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


Re: [PATCH] staging: wicl1000: fix dereference after free in wilc_wlan_cleanup()

2015-09-22 Thread Javier Martinez Canillas
Hello Sudip,

Thanks a lot for your feedback.

On 09/22/2015 02:16 PM, Sudip Mukherjee wrote:
> On Tue, Sep 22, 2015 at 12:24:50PM +0200, Javier Martinez Canillas wrote:
>> The wilc_wlan_cleanup() function iterates over the list of transmission
>> buffers freeing all of them and then iterates over the receive buffers
>> list to free all of them as well.
>>
>> But on the receive loop a pointer to struct txq_entry_t is dereferenced
>> instead of the pointer to a struct rxq_entry_t. This not only causes a
>> dereference to a pointer already freed but also leaks the memory in the
>> struct rxq_entry_t buffer.
>>
>> Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
>> Signed-off-by: Javier Martinez Canillas 
>>
>> ---
>>
>>  drivers/staging/wilc1000/wilc_wlan.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
>> b/drivers/staging/wilc1000/wilc_wlan.c
>> index 4c25179c2fec..c40f143b00b7 100644
>> --- a/drivers/staging/wilc1000/wilc_wlan.c
>> +++ b/drivers/staging/wilc1000/wilc_wlan.c
>> @@ -1746,7 +1746,7 @@ static void wilc_wlan_cleanup(void)
>>  if (rqe == NULL)
>>  break;
>>  #ifdef MEMORY_DYNAMIC
>> -kfree(tqe->buffer);
>> +kfree(rqe->buffer);
>>  #endif
> MEMORY_DYNAMIC is only used here and no where else. And buffer was
> allocated in the else part of #ifdef MEMORY_STATIC.
> So you should really be using #ifndef MEMORY_STATIC here instead of
> #ifdef MEMORY_DYNAMIC otherwise memory leak will still remain.
>

You are right that #ifndef MEMORY_STATIC should be used instead to fix
the memory leak. I'll post a v2 changing that as well.

> regards
> sudip
>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: wicl1000: fix dereference after free in wilc_wlan_cleanup()

2015-09-22 Thread Javier Martinez Canillas
The wilc_wlan_cleanup() function iterates over the list of transmission
buffers freeing all of them and then iterates over the receive buffers
list to free all of them as well.

But on the receive loop a pointer to struct txq_entry_t is dereferenced
instead of the pointer to a struct rxq_entry_t. This not only causes a
dereference to a pointer already freed but also leaks the memory in the
struct rxq_entry_t buffer.

Also, the buffer is allocated when MEMORY_STATIC is not defined no when
MEMORY_DYNAMIC is defined. So use #ifndef MEMORY_STATIC instead as it's
done in the rest of the driver to avoid leaking the buffer memory.

Fixes: c5c77ba18ea6 ("staging: wilc1000: Add SDIO/SPI 802.11 driver")
Signed-off-by: Javier Martinez Canillas 

---

Changes in v2:
- Change also the #ifdef MEMORY_DYNAMIC to #ifndef MEMORY_STATIC since buffer
  is allocated when MEMORY_STATIC isn't defined. Suggested by Sudip Mukherjee.

 drivers/staging/wilc1000/wilc_wlan.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 4c25179c2fec..fc9028d59dcd 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1745,8 +1745,8 @@ static void wilc_wlan_cleanup(void)
rqe = wilc_wlan_rxq_remove();
if (rqe == NULL)
break;
-#ifdef MEMORY_DYNAMIC
-   kfree(tqe->buffer);
+#ifndef MEMORY_STATIC
+   kfree(rqe->buffer);
 #endif
kfree(rqe);
} while (1);
-- 
2.4.3

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


[PATCH] staging: wicl1000: remove duplicated operand in OR operation

2015-09-22 Thread Javier Martinez Canillas
The IEEE80211_STYPE_PROBE_REQ flag appears twice in the expression
and coccicheck complains with:

wilc_wfi_cfgoperations.h:80:3-38: duplicated argument to & or |

Signed-off-by: Javier Martinez Canillas 

---

 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 4d37c4e859e9..25490c2af1e9 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -80,7 +80,6 @@ static const struct ieee80211_txrx_stypes
BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
-   BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
BIT(IEEE80211_STYPE_DISASSOC >> 4) |
BIT(IEEE80211_STYPE_AUTH >> 4) |
BIT(IEEE80211_STYPE_DEAUTH >> 4)
-- 
2.4.3

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