[PATCH v2] staging: gdm724x: use different endian converters to fix sparse warnings

2017-01-04 Thread Eric S. Stone
These functions require non __bitwise annotated types for both input
and output. Changing the endian converters used from ones that operate
on __bitwise annotated types, to those that operate on u16/u32, fixes
these sparse warnings:

CHECK   drivers/staging/gdm724x/gdm_endian.c
drivers/staging/gdm724x/gdm_endian.c:28:24: warning: incorrect type in return 
expression (different base types)
drivers/staging/gdm724x/gdm_endian.c:28:24:expected unsigned short
drivers/staging/gdm724x/gdm_endian.c:28:24:got restricted __le16 [usertype] 

drivers/staging/gdm724x/gdm_endian.c:30:24: warning: incorrect type in return 
expression (different base types)
drivers/staging/gdm724x/gdm_endian.c:30:24:expected unsigned short
drivers/staging/gdm724x/gdm_endian.c:30:24:got restricted __be16 [usertype] 

drivers/staging/gdm724x/gdm_endian.c:36:24: warning: cast to restricted __le16
drivers/staging/gdm724x/gdm_endian.c:38:24: warning: cast to restricted __be16
drivers/staging/gdm724x/gdm_endian.c:44:24: warning: incorrect type in return 
expression (different base types)
drivers/staging/gdm724x/gdm_endian.c:44:24:expected unsigned int
drivers/staging/gdm724x/gdm_endian.c:44:24:got restricted __le32 [usertype] 

drivers/staging/gdm724x/gdm_endian.c:46:24: warning: incorrect type in return 
expression (different base types)
drivers/staging/gdm724x/gdm_endian.c:46:24:expected unsigned int
drivers/staging/gdm724x/gdm_endian.c:46:24:got restricted __be32 [usertype] 

drivers/staging/gdm724x/gdm_endian.c:52:24: warning: cast to restricted __le32
drivers/staging/gdm724x/gdm_endian.c:54:24: warning: cast to restricted __be32

Signed-off-by: Eric S. Stone 
---

Notes:
v1 of this patch was titled differently:
staging: gdm724x: add forced casts in endian converters to fix sparse 
warnings

 drivers/staging/gdm724x/gdm_endian.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/gdm724x/gdm_endian.c 
b/drivers/staging/gdm724x/gdm_endian.c
index d7144e7..db25a93 100644
--- a/drivers/staging/gdm724x/gdm_endian.c
+++ b/drivers/staging/gdm724x/gdm_endian.c
@@ -25,31 +25,35 @@ void gdm_set_endian(struct gdm_endian *ed, u8 dev_endian)
 u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
 {
if (ed->dev_ed == ENDIANNESS_LITTLE)
-   return cpu_to_le16(x);
+   cpu_to_le16s(&x);
else
-   return cpu_to_be16(x);
+   cpu_to_be16s(&x);
+   return x;
 }
 
 u16 gdm_dev16_to_cpu(struct gdm_endian *ed, u16 x)
 {
if (ed->dev_ed == ENDIANNESS_LITTLE)
-   return le16_to_cpu(x);
+   le16_to_cpus(&x);
else
-   return be16_to_cpu(x);
+   be16_to_cpus(&x);
+   return x;
 }
 
 u32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x)
 {
if (ed->dev_ed == ENDIANNESS_LITTLE)
-   return cpu_to_le32(x);
+   cpu_to_le32s(&x);
else
-   return cpu_to_be32(x);
+   cpu_to_be32s(&x);
+   return x;
 }
 
 u32 gdm_dev32_to_cpu(struct gdm_endian *ed, u32 x)
 {
if (ed->dev_ed == ENDIANNESS_LITTLE)
-   return le32_to_cpu(x);
+   le32_to_cpus(&x);
else
-   return be32_to_cpu(x);
+   be32_to_cpus(&x);
+   return x;
 }
-- 
2.9.3

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


Re: [PATCH] staging: gdm724x: add forced casts in endian converters to fix sparse warnings

2017-01-04 Thread Greg KH
On Tue, Jan 03, 2017 at 10:44:17PM -0800, Eric S. Stone wrote:
> On Tue, Jan 03, 2017 at 04:30:58PM +0100, Greg KH wrote:
> > On Wed, Dec 28, 2016 at 10:08:43PM -0800, Eric S. Stone wrote:
> > > The modified functions do explicit endian checking and conversion. The
> > > added forced casts fix these sparse warnings:
> > > 
> > > CHECK   drivers/staging/gdm724x/gdm_endian.c
> > > drivers/staging/gdm724x/gdm_endian.c:28:24: warning: incorrect type in 
> > > return expression (different base types)
> > > drivers/staging/gdm724x/gdm_endian.c:28:24:expected unsigned short
> > > drivers/staging/gdm724x/gdm_endian.c:28:24:got restricted __le16 
> > > [usertype] 
> > > drivers/staging/gdm724x/gdm_endian.c:30:24: warning: incorrect type in 
> > > return expression (different base types)
> > > drivers/staging/gdm724x/gdm_endian.c:30:24:expected unsigned short
> > > drivers/staging/gdm724x/gdm_endian.c:30:24:got restricted __be16 
> > > [usertype] 
> > > drivers/staging/gdm724x/gdm_endian.c:36:24: warning: cast to restricted 
> > > __le16
> > > drivers/staging/gdm724x/gdm_endian.c:38:24: warning: cast to restricted 
> > > __be16
> > > drivers/staging/gdm724x/gdm_endian.c:44:24: warning: incorrect type in 
> > > return expression (different base types)
> > > drivers/staging/gdm724x/gdm_endian.c:44:24:expected unsigned int
> > > drivers/staging/gdm724x/gdm_endian.c:44:24:got restricted __le32 
> > > [usertype] 
> > > drivers/staging/gdm724x/gdm_endian.c:46:24: warning: incorrect type in 
> > > return expression (different base types)
> > > drivers/staging/gdm724x/gdm_endian.c:46:24:expected unsigned int
> > > drivers/staging/gdm724x/gdm_endian.c:46:24:got restricted __be32 
> > > [usertype] 
> > > drivers/staging/gdm724x/gdm_endian.c:52:24: warning: cast to restricted 
> > > __le32
> > > drivers/staging/gdm724x/gdm_endian.c:54:24: warning: cast to restricted 
> > > __be32
> > > 
> > > Signed-off-by: Eric S. Stone 
> > > ---
> > >  drivers/staging/gdm724x/gdm_endian.c | 16 
> > >  1 file changed, 8 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/drivers/staging/gdm724x/gdm_endian.c 
> > > b/drivers/staging/gdm724x/gdm_endian.c
> > > index d7144e7..00ae7a8 100644
> > > --- a/drivers/staging/gdm724x/gdm_endian.c
> > > +++ b/drivers/staging/gdm724x/gdm_endian.c
> > > @@ -25,31 +25,31 @@ void gdm_set_endian(struct gdm_endian *ed, u8 
> > > dev_endian)
> > >  u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
> > >  {
> > >   if (ed->dev_ed == ENDIANNESS_LITTLE)
> > > - return cpu_to_le16(x);
> > > + return (__force u16)cpu_to_le16(x);
> > >   else
> > > - return cpu_to_be16(x);
> > > + return (__force u16)cpu_to_be16(x);
> > 
> > That's crazy, look at what you are writing here, does it really make any
> > sense?
> > 
> > Please fix this up properly...
> > 
> > thanks,
> > 
> > greg k-h
> 
> Thanks for the feedback and sorry for the Crazy. I'll resubmit using
> cpu_to_le16s(u16 *) and friends, avoiding casts. I was trying to keep
> the code using the same non-mutating converters it was already using,
> but it was a bad tradeoff since those all use the __bitwise annotated
> types and we need u16/u32 here. So instead:
> 
> u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
> {
>   if (ed->dev_ed == ENDIANNESS_LITTLE)
>   cpu_to_le16s(&x);
>   else
>   cpu_to_be16s(&x);
>   return x;
> }
> 
> I also tried to alternatively fix the warnings by normalizing the
> driver code to one endiannes (getting rid of u16/u32), but since the
> different device models have different endianness, conversions of some
> sort remain necessary.

Ah, ick, sorry, I was a bit hasty on my review (having to review 300+
staging patches all at once does that to you...)

This code is odd, but not unprecidented, there are other drivers that
need this.  Let me go see how they handled this type of thing, it might
be easier to just copy what they did...

thanks,

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


Re: [PATCH] staging: gdm724x: add forced casts in endian converters to fix sparse warnings

2017-01-04 Thread Greg KH
On Wed, Jan 04, 2017 at 09:54:53AM +0100, Greg KH wrote:
> On Tue, Jan 03, 2017 at 10:44:17PM -0800, Eric S. Stone wrote:
> > On Tue, Jan 03, 2017 at 04:30:58PM +0100, Greg KH wrote:
> > > On Wed, Dec 28, 2016 at 10:08:43PM -0800, Eric S. Stone wrote:
> > > > The modified functions do explicit endian checking and conversion. The
> > > > added forced casts fix these sparse warnings:
> > > > 
> > > > CHECK   drivers/staging/gdm724x/gdm_endian.c
> > > > drivers/staging/gdm724x/gdm_endian.c:28:24: warning: incorrect type in 
> > > > return expression (different base types)
> > > > drivers/staging/gdm724x/gdm_endian.c:28:24:expected unsigned short
> > > > drivers/staging/gdm724x/gdm_endian.c:28:24:got restricted __le16 
> > > > [usertype] 
> > > > drivers/staging/gdm724x/gdm_endian.c:30:24: warning: incorrect type in 
> > > > return expression (different base types)
> > > > drivers/staging/gdm724x/gdm_endian.c:30:24:expected unsigned short
> > > > drivers/staging/gdm724x/gdm_endian.c:30:24:got restricted __be16 
> > > > [usertype] 
> > > > drivers/staging/gdm724x/gdm_endian.c:36:24: warning: cast to restricted 
> > > > __le16
> > > > drivers/staging/gdm724x/gdm_endian.c:38:24: warning: cast to restricted 
> > > > __be16
> > > > drivers/staging/gdm724x/gdm_endian.c:44:24: warning: incorrect type in 
> > > > return expression (different base types)
> > > > drivers/staging/gdm724x/gdm_endian.c:44:24:expected unsigned int
> > > > drivers/staging/gdm724x/gdm_endian.c:44:24:got restricted __le32 
> > > > [usertype] 
> > > > drivers/staging/gdm724x/gdm_endian.c:46:24: warning: incorrect type in 
> > > > return expression (different base types)
> > > > drivers/staging/gdm724x/gdm_endian.c:46:24:expected unsigned int
> > > > drivers/staging/gdm724x/gdm_endian.c:46:24:got restricted __be32 
> > > > [usertype] 
> > > > drivers/staging/gdm724x/gdm_endian.c:52:24: warning: cast to restricted 
> > > > __le32
> > > > drivers/staging/gdm724x/gdm_endian.c:54:24: warning: cast to restricted 
> > > > __be32
> > > > 
> > > > Signed-off-by: Eric S. Stone 
> > > > ---
> > > >  drivers/staging/gdm724x/gdm_endian.c | 16 
> > > >  1 file changed, 8 insertions(+), 8 deletions(-)
> > > > 
> > > > diff --git a/drivers/staging/gdm724x/gdm_endian.c 
> > > > b/drivers/staging/gdm724x/gdm_endian.c
> > > > index d7144e7..00ae7a8 100644
> > > > --- a/drivers/staging/gdm724x/gdm_endian.c
> > > > +++ b/drivers/staging/gdm724x/gdm_endian.c
> > > > @@ -25,31 +25,31 @@ void gdm_set_endian(struct gdm_endian *ed, u8 
> > > > dev_endian)
> > > >  u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
> > > >  {
> > > > if (ed->dev_ed == ENDIANNESS_LITTLE)
> > > > -   return cpu_to_le16(x);
> > > > +   return (__force u16)cpu_to_le16(x);
> > > > else
> > > > -   return cpu_to_be16(x);
> > > > +   return (__force u16)cpu_to_be16(x);
> > > 
> > > That's crazy, look at what you are writing here, does it really make any
> > > sense?
> > > 
> > > Please fix this up properly...
> > > 
> > > thanks,
> > > 
> > > greg k-h
> > 
> > Thanks for the feedback and sorry for the Crazy. I'll resubmit using
> > cpu_to_le16s(u16 *) and friends, avoiding casts. I was trying to keep
> > the code using the same non-mutating converters it was already using,
> > but it was a bad tradeoff since those all use the __bitwise annotated
> > types and we need u16/u32 here. So instead:
> > 
> > u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
> > {
> > if (ed->dev_ed == ENDIANNESS_LITTLE)
> > cpu_to_le16s(&x);
> > else
> > cpu_to_be16s(&x);
> > return x;
> > }
> > 
> > I also tried to alternatively fix the warnings by normalizing the
> > driver code to one endiannes (getting rid of u16/u32), but since the
> > different device models have different endianness, conversions of some
> > sort remain necessary.
> 
> Ah, ick, sorry, I was a bit hasty on my review (having to review 300+
> staging patches all at once does that to you...)
> 
> This code is odd, but not unprecidented, there are other drivers that
> need this.  Let me go see how they handled this type of thing, it might
> be easier to just copy what they did...

Ah, and you were right with your first try, look at
drivers/usb/host/ohci.h and the cpu_to_hc16() function.  Your use of
__force is right, the only thing I would suggest is adding a new type,
__dev16 much like the ohci.h file creates __hc16 to keep things a bit
more obvious what is going on here.

Can you fix up your original patch much like this?

thanks, and again, sorry for the complaint on your patch, my fault.

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


Re: [PATCH v2] staging: gdm724x: use different endian converters to fix sparse warnings

2017-01-04 Thread Greg KH
On Wed, Jan 04, 2017 at 12:25:55AM -0800, Eric S. Stone wrote:
> These functions require non __bitwise annotated types for both input
> and output. Changing the endian converters used from ones that operate
> on __bitwise annotated types, to those that operate on u16/u32, fixes
> these sparse warnings:
> 
> CHECK   drivers/staging/gdm724x/gdm_endian.c
> drivers/staging/gdm724x/gdm_endian.c:28:24: warning: incorrect type in return 
> expression (different base types)
> drivers/staging/gdm724x/gdm_endian.c:28:24:expected unsigned short
> drivers/staging/gdm724x/gdm_endian.c:28:24:got restricted __le16 
> [usertype] 
> drivers/staging/gdm724x/gdm_endian.c:30:24: warning: incorrect type in return 
> expression (different base types)
> drivers/staging/gdm724x/gdm_endian.c:30:24:expected unsigned short
> drivers/staging/gdm724x/gdm_endian.c:30:24:got restricted __be16 
> [usertype] 
> drivers/staging/gdm724x/gdm_endian.c:36:24: warning: cast to restricted __le16
> drivers/staging/gdm724x/gdm_endian.c:38:24: warning: cast to restricted __be16
> drivers/staging/gdm724x/gdm_endian.c:44:24: warning: incorrect type in return 
> expression (different base types)
> drivers/staging/gdm724x/gdm_endian.c:44:24:expected unsigned int
> drivers/staging/gdm724x/gdm_endian.c:44:24:got restricted __le32 
> [usertype] 
> drivers/staging/gdm724x/gdm_endian.c:46:24: warning: incorrect type in return 
> expression (different base types)
> drivers/staging/gdm724x/gdm_endian.c:46:24:expected unsigned int
> drivers/staging/gdm724x/gdm_endian.c:46:24:got restricted __be32 
> [usertype] 
> drivers/staging/gdm724x/gdm_endian.c:52:24: warning: cast to restricted __le32
> drivers/staging/gdm724x/gdm_endian.c:54:24: warning: cast to restricted __be32
> 
> Signed-off-by: Eric S. Stone 
> ---
> 
> Notes:
> v1 of this patch was titled differently:
> staging: gdm724x: add forced casts in endian converters to fix sparse 
> warnings
> 
>  drivers/staging/gdm724x/gdm_endian.c | 20 
>  1 file changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/gdm724x/gdm_endian.c 
> b/drivers/staging/gdm724x/gdm_endian.c
> index d7144e7..db25a93 100644
> --- a/drivers/staging/gdm724x/gdm_endian.c
> +++ b/drivers/staging/gdm724x/gdm_endian.c
> @@ -25,31 +25,35 @@ void gdm_set_endian(struct gdm_endian *ed, u8 dev_endian)
>  u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
>  {
>   if (ed->dev_ed == ENDIANNESS_LITTLE)
> - return cpu_to_le16(x);
> + cpu_to_le16s(&x);
>   else
> - return cpu_to_be16(x);
> + cpu_to_be16s(&x);
> + return x;
>  }
>  
>  u16 gdm_dev16_to_cpu(struct gdm_endian *ed, u16 x)
>  {
>   if (ed->dev_ed == ENDIANNESS_LITTLE)
> - return le16_to_cpu(x);
> + le16_to_cpus(&x);
>   else
> - return be16_to_cpu(x);
> + be16_to_cpus(&x);
> + return x;
>  }
>  
>  u32 gdm_cpu_to_dev32(struct gdm_endian *ed, u32 x)
>  {
>   if (ed->dev_ed == ENDIANNESS_LITTLE)
> - return cpu_to_le32(x);
> + cpu_to_le32s(&x);
>   else
> - return cpu_to_be32(x);
> + cpu_to_be32s(&x);
> + return x;
>  }
>  
>  u32 gdm_dev32_to_cpu(struct gdm_endian *ed, u32 x)
>  {
>   if (ed->dev_ed == ENDIANNESS_LITTLE)
> - return le32_to_cpu(x);
> + le32_to_cpus(&x);
>   else
> - return be32_to_cpu(x);
> + be32_to_cpus(&x);
> + return x;
>  }

Nah, see my response to your first version of this patch as to what
would be a bit better change here.  Although, maybe this is the better
version, no forcing involved, these functions are only called very
infrequently, and the end result you want in native cpu format.

Ugh, I don't know anymore, I need some more coffee...

thanks,

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


Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file

2017-01-04 Thread Greg KH
On Tue, Jan 03, 2017 at 09:26:46PM +, Stuart Yoder wrote:
> 
> > -Original Message-
> > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > Sent: Tuesday, January 03, 2017 10:48 AM
> > To: Stuart Yoder 
> > Cc: de...@driverdev.osuosl.org; a...@arndb.de; Roy Pledge 
> > ; Alexandru Marginean
> > ; linux-ker...@vger.kernel.org; ag...@suse.de; 
> > Bogdan Hamciuc
> > ; Laurentiu Tudor 
> > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > 
> > On Tue, Dec 06, 2016 at 06:10:38PM +, Stuart Yoder wrote:
> > >
> > >
> > > > -Original Message-
> > > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > > Sent: Tuesday, December 06, 2016 11:56 AM
> > > > To: Stuart Yoder 
> > > > Cc: Ruxandra Ioana Radulescu ; 
> > > > de...@driverdev.osuosl.org; linux-
> > > > ker...@vger.kernel.org; ag...@suse.de; a...@arndb.de; Alexandru 
> > > > Marginean
> > ;
> > > > Bogdan Hamciuc ; Roy Pledge 
> > > > ; Laurentiu Tudor
> > > > 
> > > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > > >
> > > > On Tue, Dec 06, 2016 at 12:59:59PM +, Stuart Yoder wrote:
> > > > >
> > > > >
> > > > > > -Original Message-
> > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > > > > Sent: Tuesday, December 06, 2016 4:20 AM
> > > > > > To: Ruxandra Ioana Radulescu 
> > > > > > Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; 
> > > > > > ag...@suse.de; a...@arndb.de;
> > > > Alexandru
> > > > > > Marginean ; Bogdan Hamciuc 
> > > > > > ; Stuart Yoder
> > > > > > ; Roy Pledge ; Laurentiu 
> > > > > > Tudor
> > 
> > > > > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > > > > >
> > > > > > On Tue, Dec 06, 2016 at 10:06:25AM +, Ruxandra Ioana Radulescu 
> > > > > > wrote:
> > > > > > > > -Original Message-
> > > > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org]
> > > > > > > > Sent: Tuesday, December 06, 2016 11:58 AM
> > > > > > > > To: Ruxandra Ioana Radulescu 
> > > > > > > > Cc: de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org;
> > > > > > > > ag...@suse.de; a...@arndb.de; Alexandru Marginean
> > > > > > > > ; Bogdan Hamciuc
> > > > > > > > ; Stuart Yoder ; 
> > > > > > > > Roy
> > > > > > > > Pledge ; Laurentiu Tudor
> > > > > > > > 
> > > > > > > > Subject: Re: [PATCH 7/8] staging: fsl-dpaa2/eth: Add TODO file
> > > > > > > >
> > > > > > > > On Tue, Dec 06, 2016 at 03:34:41AM -0600, Ioana Radulescu wrote:
> > > > > > > > > Add a list of TODO items for the Ethernet driver
> > > > > > > > >
> > > > > > > > > Signed-off-by: Ioana Radulescu 
> > > > > > > > > ---
> > > > > > > > >  drivers/staging/fsl-dpaa2/ethernet/TODO |9 +
> > > > > > > > >  1 files changed, 9 insertions(+), 0 deletions(-)
> > > > > > > > >  create mode 100644 drivers/staging/fsl-dpaa2/ethernet/TODO
> > > > > > > > >
> > > > > > > > > diff --git a/drivers/staging/fsl-dpaa2/ethernet/TODO 
> > > > > > > > > b/drivers/staging/fsl-
> > > > > > > > dpaa2/ethernet/TODO
> > > > > > > > > new file mode 100644
> > > > > > > > > index 000..833265b
> > > > > > > > > --- /dev/null
> > > > > > > > > +++ b/drivers/staging/fsl-dpaa2/ethernet/TODO
> > > > > > > > > @@ -0,0 +1,9 @@
> > > > > > > > > +* Add a DPAA2 MAC kernel driver in order to allow PHY 
> > > > > > > > > management;
> > > > > > > > currently
> > > > > > > > > +  the DPMAC objects and their link to DPNIs are handled by 
> > > > > > > > > MC internally
> > > > > > > > > +  and all PHYs are seen as fixed-link
> > > > > > > > > +* add more debug support: decide how to expose detailed debug
> > > > > > > > statistics,
> > > > > > > > > +  add ingress error queue support
> > > > > > > > > +* MC firmware uprev; the DPAA2 objects used by the Ethernet 
> > > > > > > > > driver
> > > > > > > > need to
> > > > > > > > > +  be kept in sync with binary interface changes in MC
> > > > > > > > > +* refine README file
> > > > > > > > > +* cleanup
> > > > > > > >
> > > > > > > > These seem like very minor things, why not just spend a week 
> > > > > > > > and do this
> > > > > > > > work and get it merged to the "correct" portion of the kernel 
> > > > > > > > tree?  Why
> > > > > > > > does this have to go into staging?
> > > > > > >
> > > > > > > Actually the first bullet is not minor at all and requires some 
> > > > > > > design
> > > > > > > choices that we aren't yet completely clear with, and which in 
> > > > > > > turn may
> > > > > > > affect parts of the Ethernet driver. We figured it would be best 
> > > > > > > to try
> > > > > > > adding this in staging first (and also provide this way an 
> > > > > > > example of using
> > > > > > > the fsl-mc bus and dpio driver) than wait until all MAC 
> > > > > > > development
> > > > > > > questions are ironed-out.
> > > > > >
> > > > > > Ok, that makes sense.
> > > > > >
> > > > > > > I can remove the other bullets from the TODO list if you think 
> > > > > > > they're
> > > > > > > not worth mentioning.
> > > > > >
> > > 

[PATCH 2/2] pwm: Remove .can_sleep from struct pwm_chip

2017-01-04 Thread Thierry Reding
All PWM devices have been marked as "might sleep" since v4.5, there is
no longer a need to differentiate on a per-chip basis.

Signed-off-by: Thierry Reding 
---
 drivers/pwm/pwm-atmel-hlcdc.c | 1 -
 drivers/pwm/pwm-atmel.c   | 1 -
 drivers/pwm/pwm-bcm-kona.c| 1 -
 drivers/pwm/pwm-berlin.c  | 1 -
 drivers/pwm/pwm-brcmstb.c | 1 -
 drivers/pwm/pwm-fsl-ftm.c | 1 -
 drivers/pwm/pwm-imx.c | 1 -
 drivers/pwm/pwm-lp3943.c  | 1 -
 drivers/pwm/pwm-mxs.c | 2 +-
 drivers/pwm/pwm-pca9685.c | 1 -
 drivers/pwm/pwm-sti.c | 1 -
 drivers/pwm/pwm-sun4i.c   | 1 -
 drivers/pwm/pwm-twl-led.c | 1 -
 drivers/pwm/pwm-twl.c | 1 -
 drivers/staging/greybus/pwm.c | 1 -
 include/linux/pwm.h   | 3 ---
 16 files changed, 1 insertion(+), 18 deletions(-)

diff --git a/drivers/pwm/pwm-atmel-hlcdc.c b/drivers/pwm/pwm-atmel-hlcdc.c
index 14fc011faa32..999187277ea5 100644
--- a/drivers/pwm/pwm-atmel-hlcdc.c
+++ b/drivers/pwm/pwm-atmel-hlcdc.c
@@ -270,7 +270,6 @@ static int atmel_hlcdc_pwm_probe(struct platform_device 
*pdev)
chip->chip.npwm = 1;
chip->chip.of_xlate = of_pwm_xlate_with_flags;
chip->chip.of_pwm_n_cells = 3;
-   chip->chip.can_sleep = 1;
 
ret = pwmchip_add_with_polarity(&chip->chip, PWM_POLARITY_INVERSED);
if (ret) {
diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index e6b8b1b7e6ba..67a7023be5c2 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -385,7 +385,6 @@ static int atmel_pwm_probe(struct platform_device *pdev)
 
atmel_pwm->chip.base = -1;
atmel_pwm->chip.npwm = 4;
-   atmel_pwm->chip.can_sleep = true;
atmel_pwm->config = data->config;
atmel_pwm->updated_pwms = 0;
mutex_init(&atmel_pwm->isr_lock);
diff --git a/drivers/pwm/pwm-bcm-kona.c b/drivers/pwm/pwm-bcm-kona.c
index c63418322023..09a95aeb3a70 100644
--- a/drivers/pwm/pwm-bcm-kona.c
+++ b/drivers/pwm/pwm-bcm-kona.c
@@ -276,7 +276,6 @@ static int kona_pwmc_probe(struct platform_device *pdev)
kp->chip.npwm = 6;
kp->chip.of_xlate = of_pwm_xlate_with_flags;
kp->chip.of_pwm_n_cells = 3;
-   kp->chip.can_sleep = true;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
kp->base = devm_ioremap_resource(&pdev->dev, res);
diff --git a/drivers/pwm/pwm-berlin.c b/drivers/pwm/pwm-berlin.c
index 01339c152ab0..771859aca4be 100644
--- a/drivers/pwm/pwm-berlin.c
+++ b/drivers/pwm/pwm-berlin.c
@@ -206,7 +206,6 @@ static int berlin_pwm_probe(struct platform_device *pdev)
pwm->chip.ops = &berlin_pwm_ops;
pwm->chip.base = -1;
pwm->chip.npwm = 4;
-   pwm->chip.can_sleep = true;
pwm->chip.of_xlate = of_pwm_xlate_with_flags;
pwm->chip.of_pwm_n_cells = 3;
 
diff --git a/drivers/pwm/pwm-brcmstb.c b/drivers/pwm/pwm-brcmstb.c
index 5d5adee16886..8063cffa1c96 100644
--- a/drivers/pwm/pwm-brcmstb.c
+++ b/drivers/pwm/pwm-brcmstb.c
@@ -270,7 +270,6 @@ static int brcmstb_pwm_probe(struct platform_device *pdev)
p->chip.ops = &brcmstb_pwm_ops;
p->chip.base = -1;
p->chip.npwm = 2;
-   p->chip.can_sleep = true;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
p->base = devm_ioremap_resource(&pdev->dev, res);
diff --git a/drivers/pwm/pwm-fsl-ftm.c b/drivers/pwm/pwm-fsl-ftm.c
index fad968eb75f6..557b4ea16796 100644
--- a/drivers/pwm/pwm-fsl-ftm.c
+++ b/drivers/pwm/pwm-fsl-ftm.c
@@ -446,7 +446,6 @@ static int fsl_pwm_probe(struct platform_device *pdev)
fpc->chip.of_pwm_n_cells = 3;
fpc->chip.base = -1;
fpc->chip.npwm = 8;
-   fpc->chip.can_sleep = true;
 
ret = pwmchip_add(&fpc->chip);
if (ret < 0) {
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index d600fd5cd4ba..1223187ad354 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -304,7 +304,6 @@ static int imx_pwm_probe(struct platform_device *pdev)
imx->chip.dev = &pdev->dev;
imx->chip.base = -1;
imx->chip.npwm = 1;
-   imx->chip.can_sleep = true;
 
r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
imx->mmio_base = devm_ioremap_resource(&pdev->dev, r);
diff --git a/drivers/pwm/pwm-lp3943.c b/drivers/pwm/pwm-lp3943.c
index 872ea76a4f19..52584e9962ed 100644
--- a/drivers/pwm/pwm-lp3943.c
+++ b/drivers/pwm/pwm-lp3943.c
@@ -278,7 +278,6 @@ static int lp3943_pwm_probe(struct platform_device *pdev)
lp3943_pwm->chip.dev = &pdev->dev;
lp3943_pwm->chip.ops = &lp3943_pwm_ops;
lp3943_pwm->chip.npwm = LP3943_NUM_PWMS;
-   lp3943_pwm->chip.can_sleep = true;
 
platform_set_drvdata(pdev, lp3943_pwm);
 
diff --git a/drivers/pwm/pwm-mxs.c b/drivers/pwm/pwm-mxs.c
index 9a596324ebef..a6017ad9926c 100644
--- a/drivers/pwm/pwm-mxs.c
+++ b/drivers/pwm/pwm-mxs.c
@@ -151,7 +151,7 @@ static int mxs_pwm_probe(struct platform_device *pdev)
mxs->chip.dev = &pdev->dev;
mxs->chip.op

[PATCH 1/2] pwm: Remove pwm_can_sleep()

2017-01-04 Thread Thierry Reding
The last user of this function has been removed, so it is no longer
needed.

Signed-off-by: Thierry Reding 
---
 drivers/pwm/core.c  | 12 
 include/linux/pwm.h |  7 ---
 2 files changed, 19 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 172ef8245811..78e114a11c4f 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -960,18 +960,6 @@ void devm_pwm_put(struct device *dev, struct pwm_device 
*pwm)
 }
 EXPORT_SYMBOL_GPL(devm_pwm_put);
 
-/**
-  * pwm_can_sleep() - report whether PWM access will sleep
-  * @pwm: PWM device
-  *
-  * Returns: True if accessing the PWM can sleep, false otherwise.
-  */
-bool pwm_can_sleep(struct pwm_device *pwm)
-{
-   return true;
-}
-EXPORT_SYMBOL_GPL(pwm_can_sleep);
-
 #ifdef CONFIG_DEBUG_FS
 static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s)
 {
diff --git a/include/linux/pwm.h b/include/linux/pwm.h
index 2c6c5114c089..e15fd3ce6502 100644
--- a/include/linux/pwm.h
+++ b/include/linux/pwm.h
@@ -451,8 +451,6 @@ struct pwm_device *devm_pwm_get(struct device *dev, const 
char *con_id);
 struct pwm_device *devm_of_pwm_get(struct device *dev, struct device_node *np,
   const char *con_id);
 void devm_pwm_put(struct device *dev, struct pwm_device *pwm);
-
-bool pwm_can_sleep(struct pwm_device *pwm);
 #else
 static inline struct pwm_device *pwm_request(int pwm_id, const char *label)
 {
@@ -566,11 +564,6 @@ static inline struct pwm_device *devm_of_pwm_get(struct 
device *dev,
 static inline void devm_pwm_put(struct device *dev, struct pwm_device *pwm)
 {
 }
-
-static inline bool pwm_can_sleep(struct pwm_device *pwm)
-{
-   return false;
-}
 #endif
 
 static inline void pwm_apply_args(struct pwm_device *pwm)
-- 
2.11.0

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


Re: [PATCH] Staging: fbtft: hx8340bn: Style fix, octal not decimal permissions

2017-01-04 Thread Andy Shevchenko
On Wed, Jan 4, 2017 at 3:20 AM, Derek Robson  wrote:
> Fixed coding style issue, found with Checkpatch.pl
> changed permissions to octal style.

You missed SoB.

> @@ -37,7 +37,7 @@
> "3 3 17 8 4 7 05 7 6 0 3 1 6 0 0 "
>
>  static bool emulate;
> -module_param(emulate, bool, 0);
> +module_param(emulate, bool, );

Why not to allow reading as well?

>  MODULE_PARM_DESC(emulate, "Force emulation in 9-bit mode");

-- 
With Best Regards,
Andy Shevchenko
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 2/2] staging: iio: ad7606: move out of staging

2017-01-04 Thread Eva Rachel Retuya
On Fri, Dec 30, 2016 at 08:16:02PM +, Jonathan Cameron wrote:
> On 11/12/16 02:47, Eva Rachel Retuya wrote:
> > Move the ad7606 driver from staging/iio/adc to iio/adc. Also, update the
> > corresponding Makefile and Kconfig associated with the change.
> > 
> > Signed-off-by: Eva Rachel Retuya 
> Personally (and this is much debated ;) I prefer for the odd case
> of staging graduations, that git isn't run with the -M parameter so we
> have the whole driver to comment on.
> 
> Anyhow, just casting my eyes over the code so here are some notes:
> 1. The whole computing scale available values on the fly seems rather over the
> top as they can be easily precomputed and stored in a static const array.
> There are only 2 of them!
> 

OK, will submit another version with this in mind. Also, will drop this
patch since Lars said he prefers to not "graduate" this driver yet until the
hardwire issues are resolved.

Thanks for the notes, will consider submitting a patchset addressing
these after I'm done with my IIO project.

Eva

> 2. There are some single line comments still using multiline syntax (now
> I'm really nitpicking ;)
> 
> 3. A slight oddity has crept in with the cleanup of attributes.  We now
> prevent the appearance of the _scale_available / oversampling_ratio_available
> attributes if the gpios are attached, but not _scale or _oversampling.
> (oops).  If we are going to do this dance, then we should also have an
> alternative set of iio_chan_spec array to reflect this.
> 
> 4. I'd drop the 'More devices added in future' comment. It's now the future
> and they haven't been yet ;)
> 
> 5. We can write oversampling ratio, but queries to the write_get_fmt will
> return an error for that. Probably want to fix that unless I'm missing 
> something.
> 
> 6. There are some ancient references to 'ring' buffers in the comments and
> function naming.  We switched over from my hand rolled ring buffer to the
> kfifo buffer we now use ages ago.  Would be nice to clear those out.
> 
> None of these are really blockers to it moving out of staging
> (except the bugs we introduced in the cleanup), but might be nice
> to do one last series pinning those down then get a final review done to
> see if we missed anything else.
> 
> Been a long time since I looked at this one in any depth and it's certainly
> heading in the right direction!
> 
> Jonathan
> 
> > ---
> >  drivers/iio/adc/Kconfig| 34 
> > ++
> >  drivers/iio/adc/Makefile   |  3 +++
> >  drivers/{staging => }/iio/adc/ad7606.c |  0
> >  drivers/{staging => }/iio/adc/ad7606.h |  0
> >  drivers/{staging => }/iio/adc/ad7606_par.c |  0
> >  drivers/{staging => }/iio/adc/ad7606_spi.c |  0
> >  drivers/staging/iio/adc/Kconfig| 34 
> > --
> >  drivers/staging/iio/adc/Makefile   |  4 
> >  8 files changed, 37 insertions(+), 38 deletions(-)
> >  rename drivers/{staging => }/iio/adc/ad7606.c (100%)
> >  rename drivers/{staging => }/iio/adc/ad7606.h (100%)
> >  rename drivers/{staging => }/iio/adc/ad7606_par.c (100%)
> >  rename drivers/{staging => }/iio/adc/ad7606_spi.c (100%)
> > 
> > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> > index be81ba3..3fa2c60 100644
> > --- a/drivers/iio/adc/Kconfig
> > +++ b/drivers/iio/adc/Kconfig
> > @@ -58,6 +58,40 @@ config AD7476
> >   To compile this driver as a module, choose M here: the
> >   module will be called ad7476.
> >  
> > +config AD7606
> > +   tristate "Analog Devices AD7606 ADC driver"
> > +   depends on GPIOLIB || COMPILE_TEST
> > +   depends on HAS_IOMEM
> > +   select IIO_BUFFER
> > +   select IIO_TRIGGERED_BUFFER
> > +   help
> > + Say yes here to build support for Analog Devices:
> > + ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC).
> > +
> > + To compile this driver as a module, choose M here: the
> > + module will be called ad7606.
> > +
> > +config AD7606_IFACE_PARALLEL
> > +   tristate "parallel interface support"
> > +   depends on AD7606
> > +   help
> > + Say yes here to include parallel interface support on the AD7606
> > + ADC driver.
> > +
> > + To compile this driver as a module, choose M here: the
> > + module will be called ad7606_parallel.
> > +
> > +config AD7606_IFACE_SPI
> > +   tristate "spi interface support"
> > +   depends on AD7606
> > +   depends on SPI
> > +   help
> > + Say yes here to include parallel interface support on the AD7606
> > + ADC driver.
> > +
> > + To compile this driver as a module, choose M here: the
> > + module will be called ad7606_spi.
> > +
> >  config AD7766
> > tristate "Analog Devices AD7766/AD7767 ADC driver"
> > depends on SPI_MASTER
> > diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile
> > index f8e1218..dfe7dea 100644
> > --- a/drivers/iio/adc/Makefile
> > +++ b/drivers/iio/adc/Makefile
> > @@ -9,6 +9,9 @@ obj-$(CONFIG_AD7291) += ad

Re: [PATCH] staging: greybus: add host device function pointer checks

2017-01-04 Thread Johan Hovold
On Tue, Jan 03, 2017 at 01:46:09PM -0600, Jason Hrycay wrote:
> On Mon, Jan 02, 2017 at 02:54:37PM +0100, Johan Hovold wrote:
> > On Tue, Dec 20, 2016 at 02:49:27PM -0600, Jason Hrycay wrote:
> > > Add sanity checks for cport_quiesce and cport_clear before invoking the
> > > callbacks as these function pointers are not required during the host
> > > device registration. This follows the logic implemented elsewhere for
> > > various other function pointers.
> > 
> > Yeah, I allowed for some inconsistency here given that these callbacks
> > are mandatory on our current platform.
> > 
> > No harm in checking this way though (well, at least as long as we
> > remember to set the pointers).
> > 
> 
> OK, makes sense. We ran into it while integrating the Motorola
> host-device stack into the latest version of greybus (we were
> previously forked from a version a year ago - wow time flies).

Cool. Yeah, things changed quite a bit over the last year. Just let us
know if you have any questions.

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


[PATCH 2/5] staging:r8188eu: remove rtw_update_mem_stat definition

2017-01-04 Thread Ivan Safonov
rtw_update_mem_stat definition does not used. Remove it.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/osdep_service.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index b940baf..a3cdd1f 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -69,7 +69,6 @@ static inline int rtw_netif_queue_stopped(struct net_device 
*pnetdev)
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3));
 }
 
-#define rtw_update_mem_stat(flag, sz) do {} while (0)
 u8 *_rtw_malloc(u32 sz);
 #define rtw_malloc(sz) _rtw_malloc((sz))
 
-- 
2.10.2

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


[PATCH 1/5] staging:r8188eu: remove RTW_STATUS_CODE()

2017-01-04 Thread Ivan Safonov
RTW_STATUS_CODE() does not used. Remove it.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/osdep_service.h |  2 --
 drivers/staging/rtl8188eu/os_dep/osdep_service.c  | 12 
 2 files changed, 14 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index 9047b6d..b940baf 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -69,8 +69,6 @@ static inline int rtw_netif_queue_stopped(struct net_device 
*pnetdev)
netif_tx_queue_stopped(netdev_get_tx_queue(pnetdev, 3));
 }
 
-int RTW_STATUS_CODE(int error_code);
-
 #define rtw_update_mem_stat(flag, sz) do {} while (0)
 u8 *_rtw_malloc(u32 sz);
 #define rtw_malloc(sz) _rtw_malloc((sz))
diff --git a/drivers/staging/rtl8188eu/os_dep/osdep_service.c 
b/drivers/staging/rtl8188eu/os_dep/osdep_service.c
index 51abfe9..3be8725 100644
--- a/drivers/staging/rtl8188eu/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8188eu/os_dep/osdep_service.c
@@ -21,18 +21,6 @@
 #include 
 #include 
 
-/*
- * Translate the OS dependent @param error_code to OS independent
- * RTW_STATUS_CODE
- * @return: one of RTW_STATUS_CODE
- */
-inline int RTW_STATUS_CODE(int error_code)
-{
-   if (error_code >= 0)
-   return _SUCCESS;
-   return _FAIL;
-}
-
 u8 *_rtw_malloc(u32 sz)
 {
return kmalloc(sz, in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
-- 
2.10.2

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


[PATCH 3/5] staging:r8188eu: remove (NDEV|ADPT)_(FMT|ARG) definitions

2017-01-04 Thread Ivan Safonov
(NDEV|ADPT)_(FMT|ARG) definitions does not used. Remove it.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/include/osdep_service.h | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/osdep_service.h 
b/drivers/staging/rtl8188eu/include/osdep_service.h
index a3cdd1f..ee3f5ee 100644
--- a/drivers/staging/rtl8188eu/include/osdep_service.h
+++ b/drivers/staging/rtl8188eu/include/osdep_service.h
@@ -85,10 +85,6 @@ struct net_device *rtw_alloc_etherdev_with_old_priv(void 
*old_priv);
(((struct rtw_netdev_priv_indicator *)netdev_priv(netdev))->priv)
 void rtw_free_netdev(struct net_device *netdev);
 
-#define NDEV_FMT "%s"
-#define NDEV_ARG(ndev) ndev->name
-#define ADPT_FMT "%s"
-#define ADPT_ARG(adapter) adapter->pnetdev->name
 #define FUNC_NDEV_FMT "%s(%s)"
 #define FUNC_NDEV_ARG(ndev) __func__, ndev->name
 #define FUNC_ADPT_FMT "%s(%s)"
-- 
2.10.2

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


[PATCH 5/5] staging:r8188eu: remove unused WIFI_MP_*STATE and WIFI_MP_CTX* definitions

2017-01-04 Thread Ivan Safonov
fw_state member of struct mlme_priv never obtain WIFI_MP_STATE value,
so code only for (fw_state == WIFI_MP_STATE) is dead.
Remove it, WIFI_MP_*STATE and WIFI_MP_CTX* definitions.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/core/rtw_cmd.c   |  3 --
 drivers/staging/rtl8188eu/core/rtw_ioctl_set.c |  5 ---
 drivers/staging/rtl8188eu/core/rtw_recv.c  | 42 +-
 drivers/staging/rtl8188eu/core/rtw_xmit.c  |  2 +-
 drivers/staging/rtl8188eu/include/rtw_mlme.h   |  8 -
 drivers/staging/rtl8188eu/os_dep/ioctl_linux.c |  8 +
 6 files changed, 3 insertions(+), 65 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_cmd.c 
b/drivers/staging/rtl8188eu/core/rtw_cmd.c
index 36109ce..1497966 100644
--- a/drivers/staging/rtl8188eu/core/rtw_cmd.c
+++ b/drivers/staging/rtl8188eu/core/rtw_cmd.c
@@ -1321,9 +1321,6 @@ void rtw_setassocsta_cmdrsp_callback(struct adapter 
*padapter,  struct cmd_obj *
 
spin_lock_bh(&pmlmepriv->lock);
 
-   if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) && 
(check_fwstate(pmlmepriv, _FW_UNDER_LINKING) == true))
-   _clr_fwstate_(pmlmepriv, _FW_UNDER_LINKING);
-
set_fwstate(pmlmepriv, _FW_LINKED);
spin_unlock_bh(&pmlmepriv->lock);
 
diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c 
b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
index 6ed23f4..67508a6 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c
@@ -573,11 +573,6 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter)
u8  bw_40MHz = 0, short_GI_20 = 0, short_GI_40 = 0;
u32 ht_ielen = 0;
 
-   if (adapter->registrypriv.mp_mode == 1) {
-   if (check_fwstate(pmlmepriv, WIFI_MP_STATE))
-   return 0;
-   }
-
if ((!check_fwstate(pmlmepriv, _FW_LINKED)) &&
(!check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE)))
return 0;
diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c 
b/drivers/staging/rtl8188eu/core/rtw_recv.c
index bb0844d..e51cbe1 100644
--- a/drivers/staging/rtl8188eu/core/rtw_recv.c
+++ b/drivers/staging/rtl8188eu/core/rtw_recv.c
@@ -650,7 +650,6 @@ int sta2sta_data_frame(
 int sta2sta_data_frame(struct adapter *adapter, struct recv_frame *precv_frame,
   struct sta_info **psta)
 {
-   u8 *ptr = precv_frame->rx_data;
int ret = _SUCCESS;
struct rx_pkt_attrib *pattrib = &precv_frame->attrib;
struct  sta_priv *pstapriv = &adapter->stapriv;
@@ -706,14 +705,6 @@ int sta2sta_data_frame(struct adapter *adapter, struct 
recv_frame *precv_frame,
 
sta_addr = pattrib->src;
}
-   } else if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) {
-   memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN);
-   memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN);
-   memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN);
-   memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
-   memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
-   sta_addr = mybssid;
} else {
ret  = _FAIL;
}
@@ -802,23 +793,6 @@ static int ap2sta_data_frame(
ret = RTW_RX_HANDLED;
goto exit;
}
-   } else if ((check_fwstate(pmlmepriv, WIFI_MP_STATE) == true) &&
-  (check_fwstate(pmlmepriv, _FW_LINKED) == true)) {
-   memcpy(pattrib->dst, GetAddr1Ptr(ptr), ETH_ALEN);
-   memcpy(pattrib->src, GetAddr2Ptr(ptr), ETH_ALEN);
-   memcpy(pattrib->bssid, GetAddr3Ptr(ptr), ETH_ALEN);
-   memcpy(pattrib->ra, pattrib->dst, ETH_ALEN);
-   memcpy(pattrib->ta, pattrib->src, ETH_ALEN);
-
-   /*  */
-   memcpy(pattrib->bssid,  mybssid, ETH_ALEN);
-
-   *psta = rtw_get_stainfo(pstapriv, pattrib->bssid); /*  get 
sta_info */
-   if (*psta == NULL) {
-   RT_TRACE(_module_rtl871x_recv_c_, _drv_err_, ("can't 
get psta under MP_MODE ; drop pkt\n"));
-   ret = _FAIL;
-   goto exit;
-   }
} else if (check_fwstate(pmlmepriv, WIFI_AP_STATE)) {
/* Special case */
ret = RTW_RX_HANDLED;
@@ -1309,8 +1283,6 @@ static int wlanhdr_to_ethhdr(struct recv_frame 
*precvframe)
u8  *psnap_type;
struct ieee80211_snap_hdr   *psnap;
 
-   struct adapter  *adapter = precvframe->adapter;
-   struct mlme_priv*pmlmepriv = &adapter->mlmepriv;
u8 *ptr = precvframe->rx_data;
struct rx_pkt_attrib *pattrib = &precvframe->attrib;
 
@@ -1341,19 +1313,7 @@ static int wlanhdr_to_ethhdr(struct recv_frame 
*precvframe)
eth_type = ntohs(be_tmp); /* pattrib->ether_type */
pattrib->eth_type = eth_type;
 
-   if ((check_fwstat

[PATCH 4/5] staging:r8188eu: eleminate recovery attemp using skb_clone after netdev_alloc_skb fail

2017-01-04 Thread Ivan Safonov
It is wrong to create new skb using skb_clone instead netdev_alloc_skb,
because buffer data will be changed later.

Signed-off-by: Ivan Safonov 
---
 drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c | 19 +++
 1 file changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c 
b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
index e2dbe1b..5f6cbe0 100644
--- a/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
+++ b/drivers/staging/rtl8188eu/os_dep/usb_ops_linux.c
@@ -133,22 +133,9 @@ static int recvbuf2recvframe(struct adapter *adapt, struct 
sk_buff *pskb)
precvframe->rx_tail = pkt_copy->data;
precvframe->rx_data = pkt_copy->data;
} else {
-   if ((pattrib->mfrag == 1) && (pattrib->frag_num == 0)) {
-   DBG_88E("recvbuf2recvframe: alloc_skb fail , 
drop frag frame\n");
-   rtw_free_recvframe(precvframe, 
pfree_recv_queue);
-   goto _exit_recvbuf2recvframe;
-   }
-   precvframe->pkt = skb_clone(pskb, GFP_ATOMIC);
-   if (precvframe->pkt) {
-   precvframe->rx_tail = pbuf + 
pattrib->drvinfo_sz + RXDESC_SIZE;
-   precvframe->rx_head = precvframe->rx_tail;
-   precvframe->rx_data = precvframe->rx_tail;
-   precvframe->rx_end =  pbuf + 
pattrib->drvinfo_sz + RXDESC_SIZE + alloc_sz;
-   } else {
-   DBG_88E("recvbuf2recvframe: skb_clone fail\n");
-   rtw_free_recvframe(precvframe, 
pfree_recv_queue);
-   goto _exit_recvbuf2recvframe;
-   }
+   DBG_88E("recvbuf2recvframe: alloc_skb fail , drop frag 
frame\n");
+   rtw_free_recvframe(precvframe, pfree_recv_queue);
+   goto _exit_recvbuf2recvframe;
}
 
recvframe_put(precvframe, skb_len);
-- 
2.10.2

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


[PATCH 04/14] staging: comedi: daqboard2000: check firmware length

2017-01-04 Thread Ian Abbott
Firmware files for DAQBoard/2000 have a header, which is skipped,
followed by a sequence of FPGA configuration bytes to be programmed in
pairs.  The FPGA configuration bytes start with the sequence 0xff, 0x20.

Make the firmware loading callback function
`daqboard2000_load_firmware()` return an error `-EINVAL` if the FPGA
start sequence is not found, or the remaining length is not a multiple
of 2.

The firmware loading callback tries to program the FPGA up to 3 times
until it succeeds or it has tried too many times.  Currently, it
searches for the FPGA start sequence in the firmware data each time
through the retry loop.  Change it to adjust the start position and
length before entering the loop.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 25 -
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index e73baba7c312..49feec39c4c6 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -511,6 +511,26 @@ static int daqboard2000_load_firmware(struct comedi_device 
*dev,
int retry;
size_t i;
 
+   /* Look for FPGA start sequence in firmware. */
+   for (i = 0; i + 1 < len; i++) {
+   if (cpld_array[i] == 0xff && cpld_array[i + 1] == 0x20)
+   break;
+   }
+   if (i + 1 >= len) {
+   dev_err(dev->class_dev, "bad firmware - no start sequence\n");
+   return -EINVAL;
+   }
+   /* Check length is even. */
+   if ((len - i) & 1) {
+   dev_err(dev->class_dev,
+   "bad firmware - odd length (%zu = %zu - %zu)\n",
+   len - i, len, i);
+   return -EINVAL;
+   }
+   /* Strip firmware header. */
+   cpld_array += i;
+   len -= i;
+
/* Check to make sure the serial eeprom is present on the board */
cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
if (!(cntrl & PLX_CNTRL_EEPRESENT))
@@ -521,11 +541,6 @@ static int daqboard2000_load_firmware(struct comedi_device 
*dev,
daqboard2000_reload_plx(dev);
daqboard2000_pulse_prog_pin(dev);
if (daqboard2000_poll_cpld(dev, DB2K_CPLD_STATUS_INIT)) {
-   for (i = 0; i < len; i++) {
-   if (cpld_array[i] == 0xff &&
-   cpld_array[i + 1] == 0x20)
-   break;
-   }
for (; i < len; i += 2) {
u16 data =
(cpld_array[i] << 8) + cpld_array[i + 1];
-- 
2.11.0

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


[PATCH 03/14] staging: comedi: daqboard2000: use type 'u16' for CPLD data and status

2017-01-04 Thread Ian Abbott
The CPLD status and data registers used to load firmware are 16 bits
wide.  Use the type `u16` to represent data and status values instead of
`int`.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 954a1a536fb4..e73baba7c312 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -470,11 +470,11 @@ static void daqboard2000_pulse_prog_pin(struct 
comedi_device *dev)
mdelay(10); /* Not in the original code, but I like symmetry... */
 }
 
-static int daqboard2000_poll_cpld(struct comedi_device *dev, int mask)
+static int daqboard2000_poll_cpld(struct comedi_device *dev, u16 mask)
 {
int result = 0;
int i;
-   int cpld;
+   u16 cpld;
 
/* timeout after 50 tries -> 5ms */
for (i = 0; i < 50; i++) {
@@ -489,7 +489,7 @@ static int daqboard2000_poll_cpld(struct comedi_device 
*dev, int mask)
return result;
 }
 
-static int daqboard2000_write_cpld(struct comedi_device *dev, int data)
+static int daqboard2000_write_cpld(struct comedi_device *dev, u16 data)
 {
int result = 0;
 
@@ -527,7 +527,7 @@ static int daqboard2000_load_firmware(struct comedi_device 
*dev,
break;
}
for (; i < len; i += 2) {
-   int data =
+   u16 data =
(cpld_array[i] << 8) + cpld_array[i + 1];
if (!daqboard2000_write_cpld(dev, data))
break;
-- 
2.11.0

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


[PATCH 02/14] staging: comedi: daqboard2000: define macros for CPLD registers

2017-01-04 Thread Ian Abbott
The Daqboard/2000 uses a write-only data register and a read-only status
register in a pre-programmed CPLD device to program the main firmware on
the board.  Both registers are at offset 0x1000 from PCI BAR 2.  Define
macros for the register offsets.  Rename the existing macros for the
status register values for consistency.  (Two status bits are defined,
but the driver code only seems to use one of them.)

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 23 +--
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index b23a9feb975c..954a1a536fb4 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -116,10 +116,6 @@
 #define DAQBOARD2000_SUBSYSTEM_IDS20x0002  /* Daqboard/2000 - 2 Dacs */
 #define DAQBOARD2000_SUBSYSTEM_IDS40x0004  /* Daqboard/2000 - 4 Dacs */
 
-/* CPLD status bits */
-#define DAQBOARD2000_CPLD_INIT 0x0002
-#define DAQBOARD2000_CPLD_DONE 0x0004
-
 static const struct comedi_lrange range_daqboard2000_ai = {
13, {
BIP_RANGE(10),
@@ -173,6 +169,10 @@ static const struct comedi_lrange range_daqboard2000_ai = {
 #define DB2K_REG_TRIG_DACS 0xbc/* u16 */
 #define DB2K_REG_DIO_P2_EXP_IO_16_BIT(x)   (0xc0 + (x) * 2) /* s16 */
 
+/* CPLD registers */
+#define DB2K_REG_CPLD_STATUS   0x1000  /* u16 (r) */
+#define DB2K_REG_CPLD_WDATA0x1000  /* u16 (w) */
+
 /* Scan Sequencer programming */
 #define DB2K_ACQ_CONTROL_SEQ_START_SCAN_LIST   0x0011
 #define DB2K_ACQ_CONTROL_SEQ_STOP_SCAN_LIST0x0010
@@ -238,6 +238,10 @@ static const struct comedi_lrange range_daqboard2000_ai = {
 #define DB2K_REF_DACS_SELECT_POS_REF   0x0100
 #define DB2K_REF_DACS_SELECT_NEG_REF   0x
 
+/* CPLD status bits */
+#define DB2K_CPLD_STATUS_INIT  0x0002
+#define DB2K_CPLD_STATUS_TXDONE0x0004
+
 struct daq200_boardtype {
const char *name;
int id;
@@ -474,7 +478,7 @@ static int daqboard2000_poll_cpld(struct comedi_device 
*dev, int mask)
 
/* timeout after 50 tries -> 5ms */
for (i = 0; i < 50; i++) {
-   cpld = readw(dev->mmio + 0x1000);
+   cpld = readw(dev->mmio + DB2K_REG_CPLD_STATUS);
if ((cpld & mask) == mask) {
result = 1;
break;
@@ -490,11 +494,10 @@ static int daqboard2000_write_cpld(struct comedi_device 
*dev, int data)
int result = 0;
 
usleep_range(10, 20);
-   writew(data, dev->mmio + 0x1000);
-   if ((readw(dev->mmio + 0x1000) & DAQBOARD2000_CPLD_INIT) ==
-   DAQBOARD2000_CPLD_INIT) {
+   writew(data, dev->mmio + DB2K_REG_CPLD_WDATA);
+   if (readw(dev->mmio + DB2K_REG_CPLD_STATUS) & DB2K_CPLD_STATUS_INIT)
result = 1;
-   }
+
return result;
 }
 
@@ -517,7 +520,7 @@ static int daqboard2000_load_firmware(struct comedi_device 
*dev,
daqboard2000_reset_local_bus(dev);
daqboard2000_reload_plx(dev);
daqboard2000_pulse_prog_pin(dev);
-   if (daqboard2000_poll_cpld(dev, DAQBOARD2000_CPLD_INIT)) {
+   if (daqboard2000_poll_cpld(dev, DB2K_CPLD_STATUS_INIT)) {
for (i = 0; i < len; i++) {
if (cpld_array[i] == 0xff &&
cpld_array[i + 1] == 0x20)
-- 
2.11.0

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


[PATCH 01/14] staging: comedi: daqboard2000: use macros from "plx9080.h"

2017-01-04 Thread Ian Abbott
The Daqboard/2000 uses a PLX PCI-9080 chip to interface with the PCI
bus.  The "daqboard2000" driver uses the PCI-9080 "CNTRL" register to
perform various tasks, but defines its own macros for the register
values.  Use the macros from "plx9080.h" instead.  The various functions
that change the CNTRL register just wiggle individual bits up and down,
but they ignore the current register value - the old macros defined the
full value to be written to the register.  Change them to read and
modify the register value.

Also remove a read of the CNTRL register in `daqboard2000_auto_attach()`
where the value is just thrown away, as it seems to serve no purpose
there (such as flushing PCI writes).

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 48 +--
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 0f4eb954aa80..b23a9feb975c 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -109,23 +109,13 @@
 #include "../comedi_pci.h"
 
 #include "8255.h"
+#include "plx9080.h"
 
 #define DAQBOARD2000_FIRMWARE  "daqboard2000_firmware.bin"
 
 #define DAQBOARD2000_SUBSYSTEM_IDS20x0002  /* Daqboard/2000 - 2 Dacs */
 #define DAQBOARD2000_SUBSYSTEM_IDS40x0004  /* Daqboard/2000 - 4 Dacs */
 
-/* Initialization bits for the Serial EEPROM Control Register */
-#define DB2K_SECR_PROG_PIN_HI  0x8001767e
-#define DB2K_SECR_PROG_PIN_LO  0x8000767e
-#define DB2K_SECR_LOCAL_BUS_HI 0xc000767e
-#define DB2K_SECR_LOCAL_BUS_LO 0x8000767e
-#define DB2K_SECR_RELOAD_HI0xa000767e
-#define DB2K_SECR_RELOAD_LO0x8000767e
-
-/* SECR status bits */
-#define DAQBOARD2000_EEPROM_PRESENT 0x1000
-
 /* CPLD status bits */
 #define DAQBOARD2000_CPLD_INIT 0x0002
 #define DAQBOARD2000_CPLD_DONE 0x0004
@@ -434,32 +424,45 @@ static int daqboard2000_ao_insn_write(struct 
comedi_device *dev,
 static void daqboard2000_reset_local_bus(struct comedi_device *dev)
 {
struct daqboard2000_private *devpriv = dev->private;
+   u32 cntrl;
 
-   writel(DB2K_SECR_LOCAL_BUS_HI, devpriv->plx + 0x6c);
+   cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
+   cntrl |= PLX_CNTRL_RESET;
+   writel(cntrl, devpriv->plx + PLX_REG_CNTRL);
mdelay(10);
-   writel(DB2K_SECR_LOCAL_BUS_LO, devpriv->plx + 0x6c);
+   cntrl &= ~PLX_CNTRL_RESET;
+   writel(cntrl, devpriv->plx + PLX_REG_CNTRL);
mdelay(10);
 }
 
 static void daqboard2000_reload_plx(struct comedi_device *dev)
 {
struct daqboard2000_private *devpriv = dev->private;
+   u32 cntrl;
 
-   writel(DB2K_SECR_RELOAD_LO, devpriv->plx + 0x6c);
+   cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
+   cntrl &= ~PLX_CNTRL_EERELOAD;
+   writel(cntrl, devpriv->plx + PLX_REG_CNTRL);
mdelay(10);
-   writel(DB2K_SECR_RELOAD_HI, devpriv->plx + 0x6c);
+   cntrl |= PLX_CNTRL_EERELOAD;
+   writel(cntrl, devpriv->plx + PLX_REG_CNTRL);
mdelay(10);
-   writel(DB2K_SECR_RELOAD_LO, devpriv->plx + 0x6c);
+   cntrl &= ~PLX_CNTRL_EERELOAD;
+   writel(cntrl, devpriv->plx + PLX_REG_CNTRL);
mdelay(10);
 }
 
 static void daqboard2000_pulse_prog_pin(struct comedi_device *dev)
 {
struct daqboard2000_private *devpriv = dev->private;
+   u32 cntrl;
 
-   writel(DB2K_SECR_PROG_PIN_HI, devpriv->plx + 0x6c);
+   cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
+   cntrl |= PLX_CNTRL_USERO;
+   writel(cntrl, devpriv->plx + PLX_REG_CNTRL);
mdelay(10);
-   writel(DB2K_SECR_PROG_PIN_LO, devpriv->plx + 0x6c);
+   cntrl &= ~PLX_CNTRL_USERO;
+   writel(cntrl, devpriv->plx + PLX_REG_CNTRL);
mdelay(10); /* Not in the original code, but I like symmetry... */
 }
 
@@ -501,14 +504,13 @@ static int daqboard2000_load_firmware(struct 
comedi_device *dev,
 {
struct daqboard2000_private *devpriv = dev->private;
int result = -EIO;
-   /* Read the serial EEPROM control register */
-   int secr;
+   u32 cntrl;
int retry;
size_t i;
 
/* Check to make sure the serial eeprom is present on the board */
-   secr = readl(devpriv->plx + 0x6c);
-   if (!(secr & DAQBOARD2000_EEPROM_PRESENT))
+   cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
+   if (!(cntrl & PLX_CNTRL_EEPRESENT))
return -EIO;
 
for (retry = 0; retry < 3; retry++) {
@@ -677,8 +679,6 @@ static int daqboard2000_auto_attach(struct comedi_device 
*dev,
if (result)
return result;
 
-   readl(devpriv->plx + 0x6c);
-
result = comedi_load_firmware(dev, &comedi_to_pci_dev(dev)->dev,
  DAQBOARD2000_FIRMWARE,
  daqboard2000_load_firmware, 0);
-- 
2.11.

[PATCH 05/14] staging: comedi: daqboard2000: replace daqboard2000_poll_cpld()

2017-01-04 Thread Ian Abbott
`daqboard2000_poll_cpld()` waits for a specified status bit in the CPLD
status register to be set, giving up after 50 tries over a period of
about 5 milliseconds.  It returns 1 if the status bit is set, otherwise
0.  It is only ever called to check the "INIT" status bit.  Replace it
with new function `daqboard2000_wait_cpld_init()`, which returns 0 if
the "INIT" status bit becomes set within 50 tries, or `-ETIMEDOUT` if
not set within 50 tries.  The firmware loading callback
`daqboard2000_load_firmware()` may return the error result from
`daqboard2000_wait_cpld_init()` if it has used up all its firmware
loading attempts and that was the last error.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 33 +++
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 49feec39c4c6..f4c738037e28 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -470,17 +470,17 @@ static void daqboard2000_pulse_prog_pin(struct 
comedi_device *dev)
mdelay(10); /* Not in the original code, but I like symmetry... */
 }
 
-static int daqboard2000_poll_cpld(struct comedi_device *dev, u16 mask)
+static int daqboard2000_wait_cpld_init(struct comedi_device *dev)
 {
-   int result = 0;
+   int result = -ETIMEDOUT;
int i;
u16 cpld;
 
/* timeout after 50 tries -> 5ms */
for (i = 0; i < 50; i++) {
cpld = readw(dev->mmio + DB2K_REG_CPLD_STATUS);
-   if ((cpld & mask) == mask) {
-   result = 1;
+   if (cpld & DB2K_CPLD_STATUS_INIT) {
+   result = 0;
break;
}
usleep_range(100, 1000);
@@ -540,20 +540,23 @@ static int daqboard2000_load_firmware(struct 
comedi_device *dev,
daqboard2000_reset_local_bus(dev);
daqboard2000_reload_plx(dev);
daqboard2000_pulse_prog_pin(dev);
-   if (daqboard2000_poll_cpld(dev, DB2K_CPLD_STATUS_INIT)) {
-   for (; i < len; i += 2) {
-   u16 data =
-   (cpld_array[i] << 8) + cpld_array[i + 1];
-   if (!daqboard2000_write_cpld(dev, data))
-   break;
-   }
-   if (i >= len) {
-   daqboard2000_reset_local_bus(dev);
-   daqboard2000_reload_plx(dev);
-   result = 0;
+   result = daqboard2000_wait_cpld_init(dev);
+   if (result)
+   continue;
+
+   for (; i < len; i += 2) {
+   u16 data = (cpld_array[i] << 8) + cpld_array[i + 1];
+
+   if (!daqboard2000_write_cpld(dev, data)) {
+   result = -EIO;
break;
}
}
+   if (result == 0) {
+   daqboard2000_reset_local_bus(dev);
+   daqboard2000_reload_plx(dev);
+   break;
+   }
}
return result;
 }
-- 
2.11.0

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


[PATCH 07/14] staging: comedi: daqboard2000: check result of FPGA programming

2017-01-04 Thread Ian Abbott
According to an old, GPL'ed Linux driver at
,
after programming the FPGA, the General Purpose Input (USERI) of the PLX
PCI-9080 should go high shortly after a valid FPGA bitstream has been
loaded.  Add a new function `daqboard2000_wait_fpga_programmed()` to
wait for that, performing up to 200 checks over a 20 ms period (this is
loosely based on `pollFPGADone()` in the above-mentioned old driver).
Return 0 if the FPGA appears to have loaded successfully, or
`-ETIMEDOUT` if it runs out of checks.  Call it from the firmware
loading callback `daqboard2000_load_firmware()` after writing the
firmware to the FPGA to check it is programmed successfully.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index d6f30261db9b..4e3e81186bc3 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -501,6 +501,23 @@ static int daqboard2000_write_cpld(struct comedi_device 
*dev, u16 data)
return result;
 }
 
+static int daqboard2000_wait_fpga_programmed(struct comedi_device *dev)
+{
+   struct daqboard2000_private *devpriv = dev->private;
+   int i;
+
+   /* Time out after 200 tries -> 20ms */
+   for (i = 0; i < 200; i++) {
+   u32 cntrl = readl(devpriv->plx + PLX_REG_CNTRL);
+   /* General Purpose Input (USERI) set on FPGA "DONE". */
+   if (cntrl & PLX_CNTRL_USERI)
+   return 0;
+
+   usleep_range(100, 1000);
+   }
+   return -ETIMEDOUT;
+}
+
 static int daqboard2000_load_firmware(struct comedi_device *dev,
  const u8 *cpld_array, size_t len,
  unsigned long context)
@@ -551,6 +568,8 @@ static int daqboard2000_load_firmware(struct comedi_device 
*dev,
if (result)
break;
}
+   if (result == 0)
+   result = daqboard2000_wait_fpga_programmed(dev);
if (result == 0) {
daqboard2000_reset_local_bus(dev);
daqboard2000_reload_plx(dev);
-- 
2.11.0

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


[PATCH 06/14] staging: comedi: daqboard2000: change daqboard2000_write_cpld() return value

2017-01-04 Thread Ian Abbott
`daqboard2000_write_cpld()` currently returns 1 on success, or 0 on
failure.  Change it to return 0 on success, or `-EIO` on failure.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index f4c738037e28..d6f30261db9b 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -491,12 +491,12 @@ static int daqboard2000_wait_cpld_init(struct 
comedi_device *dev)
 
 static int daqboard2000_write_cpld(struct comedi_device *dev, u16 data)
 {
-   int result = 0;
+   int result = -EIO;
 
usleep_range(10, 20);
writew(data, dev->mmio + DB2K_REG_CPLD_WDATA);
if (readw(dev->mmio + DB2K_REG_CPLD_STATUS) & DB2K_CPLD_STATUS_INIT)
-   result = 1;
+   result = 0;
 
return result;
 }
@@ -547,10 +547,9 @@ static int daqboard2000_load_firmware(struct comedi_device 
*dev,
for (; i < len; i += 2) {
u16 data = (cpld_array[i] << 8) + cpld_array[i + 1];
 
-   if (!daqboard2000_write_cpld(dev, data)) {
-   result = -EIO;
+   result = daqboard2000_write_cpld(dev, data);
+   if (result)
break;
-   }
}
if (result == 0) {
daqboard2000_reset_local_bus(dev);
-- 
2.11.0

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


[PATCH 09/14] staging: comedi: daqboard2000: remove unused 'card' member

2017-01-04 Thread Ian Abbott
The `card` member of `struct daqboard2000_private` and the enumerated
constant `card_daqboard_2000` are not used.  Remove them.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 626571fc1c01..5949ec1eaad9 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -256,9 +256,6 @@ static const struct daq200_boardtype boardtypes[] = {
 };
 
 struct daqboard2000_private {
-   enum {
-   card_daqboard_2000
-   } card;
void __iomem *plx;
 };
 
-- 
2.11.0

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


[PATCH 00/14] staging: comedi: daqboard2000: some clean-up

2017-01-04 Thread Ian Abbott
I've had these clean-up patches for the daqboard2000 driver sitting
around for a few months, with a view to adding support for more boards
in the same series, and adding support for extra subdevice types.  I
never got around to doing that, but I did manage to add support for a
couple of extra DAC channels on one of the two currently supported card
types.

01) staging: comedi: daqboard2000: use macros from "plx9080.h"
02) staging: comedi: daqboard2000: define macros for CPLD registers
03) staging: comedi: daqboard2000: use type 'u16' for CPLD data and
status
04) staging: comedi: daqboard2000: check firmware length
05) staging: comedi: daqboard2000: replace daqboard2000_poll_cpld()
06) staging: comedi: daqboard2000: change daqboard2000_write_cpld()
return value
07) staging: comedi: daqboard2000: check result of FPGA programming
08) staging: comedi: daqboard2000: check CPLD status before writing
firmware data
09) staging: comedi: daqboard2000: remove unused 'card' member
10) staging: comedi: daqboard2000: use shorter, consistent prefix
11) staging: comedi: daqboard2000: use designated initializers
12) staging: comedi: daqboard2000: support 4 AO channels
13) staging: comedi: daqboard2000: change COMEDI device names
14) staging: comedi: daqboard2000: use pci_id_table 'driver_data'

Note that there is a checkpatch warning in patches 07 and 08: "Possible
unwrapped commit description (prefer a maximum 75 chars per line)", but
that is due to a long URL in the patch description.

 drivers/staging/comedi/drivers/daqboard2000.c | 401 ++
 1 file changed, 222 insertions(+), 179 deletions(-)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 08/14] staging: comedi: daqboard2000: check CPLD status before writing firmware data

2017-01-04 Thread Ian Abbott
According to an old GPL'ed driver at
,
The CPLD status register can be checked to make sure that it is ready to
accept the next 16-bit word of FPGA firmware data, but that doesn't work
on older versions of the CPLD, where a simple delay should be used
between successive writes.  The current version of the Comedi driver
just uses a delay between successive writes.  Change it to check for the
newer CPLD in the `daqboard2000_load_firmware()`, and change the
firmware word writing function `daqboard2000_write_cpld()` to wait for
the status bit (`DB2K_CPLD_STATUS_TXREADY`, previously called
`DB2K_CPLD_TXDONE`) to be set for newer CPLD, or just delay for older CPLD.
Return an error if it times out waiting for the status bit.

The wait for the `DB2K_CPLD_STATUS_TXREADY` status bit to be set is
performed by new function `daqboard2000_wait_cpld_txready()`, which
returns 0 if the status bit is set within 100 microseconds, or
`-ETIMEDOUT` if not.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 41 ++-
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 4e3e81186bc3..626571fc1c01 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -240,7 +240,10 @@ static const struct comedi_lrange range_daqboard2000_ai = {
 
 /* CPLD status bits */
 #define DB2K_CPLD_STATUS_INIT  0x0002
-#define DB2K_CPLD_STATUS_TXDONE0x0004
+#define DB2K_CPLD_STATUS_TXREADY   0x0004
+#define DB2K_CPLD_VERSION_MASK 0xf000
+/* "New CPLD" signature. */
+#define DB2K_CPLD_VERSION_NEW  0x5000
 
 struct daq200_boardtype {
const char *name;
@@ -489,14 +492,35 @@ static int daqboard2000_wait_cpld_init(struct 
comedi_device *dev)
return result;
 }
 
-static int daqboard2000_write_cpld(struct comedi_device *dev, u16 data)
+static int daqboard2000_wait_cpld_txready(struct comedi_device *dev)
 {
-   int result = -EIO;
+   int i;
+
+   for (i = 0; i < 100; i++) {
+   if (readw(dev->mmio + DB2K_REG_CPLD_STATUS) &
+   DB2K_CPLD_STATUS_TXREADY) {
+   return 0;
+   }
+   udelay(1);
+   }
+   return -ETIMEDOUT;
+}
+
+static int daqboard2000_write_cpld(struct comedi_device *dev, u16 data,
+  bool new_cpld)
+{
+   int result = 0;
 
-   usleep_range(10, 20);
+   if (new_cpld) {
+   result = daqboard2000_wait_cpld_txready(dev);
+   if (result)
+   return result;
+   } else {
+   usleep_range(10, 20);
+   }
writew(data, dev->mmio + DB2K_REG_CPLD_WDATA);
-   if (readw(dev->mmio + DB2K_REG_CPLD_STATUS) & DB2K_CPLD_STATUS_INIT)
-   result = 0;
+   if (!(readw(dev->mmio + DB2K_REG_CPLD_STATUS) & DB2K_CPLD_STATUS_INIT))
+   result = -EIO;
 
return result;
 }
@@ -527,6 +551,7 @@ static int daqboard2000_load_firmware(struct comedi_device 
*dev,
u32 cntrl;
int retry;
size_t i;
+   bool new_cpld;
 
/* Look for FPGA start sequence in firmware. */
for (i = 0; i + 1 < len; i++) {
@@ -561,10 +586,12 @@ static int daqboard2000_load_firmware(struct 
comedi_device *dev,
if (result)
continue;
 
+   new_cpld = (readw(dev->mmio + DB2K_REG_CPLD_STATUS) &
+   DB2K_CPLD_VERSION_MASK) == DB2K_CPLD_VERSION_NEW;
for (; i < len; i += 2) {
u16 data = (cpld_array[i] << 8) + cpld_array[i + 1];
 
-   result = daqboard2000_write_cpld(dev, data);
+   result = daqboard2000_write_cpld(dev, data, new_cpld);
if (result)
break;
}
-- 
2.11.0

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


[PATCH 14/14] staging: comedi: daqboard2000: use pci_id_table 'driver_data'

2017-01-04 Thread Ian Abbott
The driver's COMEDI "auto-attach" handler `db2k_auto_attach()` calls
`db2k_find_boardinfo()` to find an element of our board information
array `db2k_boardtypes[]` that matches the probed PCI device.  The
driver's PCI device table matches several boards in the DaqBoard/2000
series that match a single PCI vendor and device ID combination.
`db2k_find_boardinfo()` uses the probed PCI device's subvendor and
subdevice IDs to find the matching board information, returning `NULL`
for no match.

Change the driver's PCI device table `db2k_pci_table[]` to match
supported PCI vendor, device, subvendor and subdevice IDs, and set the
`.driver_data` member of each element to the index of the matching
element of `db2k_boardtypes[]`.  That index gets passed through to the
COMEDI auto-attach handler `db2k_auto_attach()`.  Use it to index
directly into `db2k_boardtypes[]` instead of calling
`db2k_find_boardinfo()` to find the match.
Use array index designators in the initializer of `db2k_boardtypes[]`.
Use enumerated constants defined by new type `enum db2k_boardids` to
name the board type indices.

The `id` member of `struct db2k_boardtype` is no longer used, so remove
it.  Also remove the subdevice ID macros `DB2K_SUBSYSTEM_IDS2` and
`DB2K_SUBSYSTEM_IDS4` as the subdevice IDs are now specified as numbers
in the PCI device table.  Remove `db2k_find_boardinfo()` as it is no
longer used.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 46 ++-
 1 file changed, 16 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 5460d138830a..32dd8a857b6b 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -113,9 +113,6 @@
 
 #define DB2K_FIRMWARE  "daqboard2000_firmware.bin"
 
-#define DB2K_SUBSYSTEM_IDS20x0002  /* Daqboard/2000 - 2 Dacs */
-#define DB2K_SUBSYSTEM_IDS40x0004  /* Daqboard/2001 - 4 Dacs */
-
 static const struct comedi_lrange db2k_ai_range = {
13, {
BIP_RANGE(10),
@@ -245,21 +242,23 @@ static const struct comedi_lrange db2k_ai_range = {
 /* "New CPLD" signature. */
 #define DB2K_CPLD_VERSION_NEW  0x5000
 
+enum db2k_boardid {
+   BOARD_DAQBOARD2000,
+   BOARD_DAQBOARD2001
+};
+
 struct db2k_boardtype {
const char *name;
-   int id;
bool has_2_ao:1;/* false: 4 AO chans; true: 2 AO chans */
 };
 
 static const struct db2k_boardtype db2k_boardtypes[] = {
-   {
+   [BOARD_DAQBOARD2000] = {
.name   = "daqboard2000",
-   .id = DB2K_SUBSYSTEM_IDS2,
.has_2_ao   = true,
},
-   {
+   [BOARD_DAQBOARD2001] = {
.name   = "daqboard2001",
-   .id = DB2K_SUBSYSTEM_IDS4,
},
 };
 
@@ -690,25 +689,7 @@ static int db2k_8255_cb(struct comedi_device *dev, int 
dir, int port, int data,
return readw(dev->mmio + iobase + port * 2);
 }
 
-static const void *db2k_find_boardinfo(struct comedi_device *dev,
-  struct pci_dev *pcidev)
-{
-   const struct db2k_boardtype *board;
-   int i;
-
-   if (pcidev->subsystem_vendor != PCI_VENDOR_ID_IOTECH)
-   return NULL;
-
-   for (i = 0; i < ARRAY_SIZE(db2k_boardtypes); i++) {
-   board = &db2k_boardtypes[i];
-   if (pcidev->subsystem_device == board->id)
-   return board;
-   }
-   return NULL;
-}
-
-static int db2k_auto_attach(struct comedi_device *dev,
-   unsigned long context_unused)
+static int db2k_auto_attach(struct comedi_device *dev, unsigned long context)
 {
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct db2k_boardtype *board;
@@ -716,8 +697,10 @@ static int db2k_auto_attach(struct comedi_device *dev,
struct comedi_subdevice *s;
int result;
 
-   board = db2k_find_boardinfo(dev, pcidev);
-   if (!board)
+   if (context >= ARRAY_SIZE(db2k_boardtypes))
+   return -ENODEV;
+   board = &db2k_boardtypes[context];
+   if (!board->name)
return -ENODEV;
dev->board_ptr = board;
dev->board_name = board->name;
@@ -796,7 +779,10 @@ static int db2k_pci_probe(struct pci_dev *dev, const 
struct pci_device_id *id)
 }
 
 static const struct pci_device_id db2k_pci_table[] = {
-   { PCI_DEVICE(PCI_VENDOR_ID_IOTECH, 0x0409) },
+   { PCI_DEVICE_SUB(PCI_VENDOR_ID_IOTECH, 0x0409, PCI_VENDOR_ID_IOTECH,
+0x0002), .driver_data = BOARD_DAQBOARD2000, },
+   { PCI_DEVICE_SUB(PCI_VENDOR_ID_IOTECH, 0x0409, PCI_VENDOR_ID_IOTECH,
+0x0004), .driver_data = BOARD_DAQBOARD2001, },
{ 0 }
 };
 MODULE_DEVICE_TABLE(pci, db2k_pci_table);
-- 
2.11.0

__

[PATCH 12/14] staging: comedi: daqboard2000: support 4 AO channels

2017-01-04 Thread Ian Abbott
The driver supports DaqBoard/2000 and DaqBoard/2001. DaqBoard/2000 has 2
AO channels, but DaqBoard/2001 has 4 AO channels.  The driver currently
only supports 2 AO channels, but supporting 4 channels is just a case of
setting the `n_chan` member of the COMEDI subdevice to 4 instead of 2.

Add a new boolean flag member `has_2_ao` to `struct db2k_boardtype` to
be set to `true` if the board only has 2 AO channels.  Set this to
`true` in the element of `db2k_boardtypes[]` that corresponds to the
DaqBoard/2000.  Use it in `db2k_auto_attach()` to initialize the number
of AO channels to 2 or 4, as appropriate.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 18933c2565d9..8f0325ef0012 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -114,7 +114,7 @@
 #define DB2K_FIRMWARE  "daqboard2000_firmware.bin"
 
 #define DB2K_SUBSYSTEM_IDS20x0002  /* Daqboard/2000 - 2 Dacs */
-#define DB2K_SUBSYSTEM_IDS40x0004  /* Daqboard/2000 - 4 Dacs */
+#define DB2K_SUBSYSTEM_IDS40x0004  /* Daqboard/2001 - 4 Dacs */
 
 static const struct comedi_lrange db2k_ai_range = {
13, {
@@ -248,12 +248,14 @@ static const struct comedi_lrange db2k_ai_range = {
 struct db2k_boardtype {
const char *name;
int id;
+   bool has_2_ao:1;/* false: 4 AO chans; true: 2 AO chans */
 };
 
 static const struct db2k_boardtype db2k_boardtypes[] = {
{
.name   = "ids2",
.id = DB2K_SUBSYSTEM_IDS2,
+   .has_2_ao   = true,
},
{
.name   = "ids4",
@@ -758,7 +760,7 @@ static int db2k_auto_attach(struct comedi_device *dev,
/* ao subdevice */
s->type = COMEDI_SUBD_AO;
s->subdev_flags = SDF_WRITABLE;
-   s->n_chan = 2;
+   s->n_chan = board->has_2_ao ? 2 : 4;
s->maxdata = 0x;
s->insn_write = db2k_ao_insn_write;
s->range_table = &range_bipolar10;
-- 
2.11.0

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


[PATCH 11/14] staging: comedi: daqboard2000: use designated initializers

2017-01-04 Thread Ian Abbott
Replace the undesignated initializers for each element of
`db2k_boardtypes[]` with an equivalent designated initializer for ease
of future maintenance.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 7a086cfa2712..18933c2565d9 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -251,8 +251,14 @@ struct db2k_boardtype {
 };
 
 static const struct db2k_boardtype db2k_boardtypes[] = {
-   {"ids2", DB2K_SUBSYSTEM_IDS2},
-   {"ids4", DB2K_SUBSYSTEM_IDS4},
+   {
+   .name   = "ids2",
+   .id = DB2K_SUBSYSTEM_IDS2,
+   },
+   {
+   .name   = "ids4",
+   .id = DB2K_SUBSYSTEM_IDS4,
+   },
 };
 
 struct db2k_private {
-- 
2.11.0

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


[PATCH 13/14] staging: comedi: daqboard2000: change COMEDI device names

2017-01-04 Thread Ian Abbott
The COMEDI device name strings are currently set to "ids2" for the
DaqBoard/2000, and to "ids4" for the DaqBoard/2001.  Change them to
"daqboard2000" and "daqboard2001" respectively.  (The COMEDI driver name
string is also "daqboard2000".)

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 8f0325ef0012..5460d138830a 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -253,12 +253,12 @@ struct db2k_boardtype {
 
 static const struct db2k_boardtype db2k_boardtypes[] = {
{
-   .name   = "ids2",
+   .name   = "daqboard2000",
.id = DB2K_SUBSYSTEM_IDS2,
.has_2_ao   = true,
},
{
-   .name   = "ids4",
+   .name   = "daqboard2001",
.id = DB2K_SUBSYSTEM_IDS4,
},
 };
-- 
2.11.0

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


[PATCH 10/14] staging: comedi: daqboard2000: use shorter, consistent prefix

2017-01-04 Thread Ian Abbott
Use a consistent prefix of `db2k_` or `DB2K_` for identifiers.  The
existing prefixes `DAQBOARD2000_` and `daqboard2000_` are a bit on the
lengthy side.

Signed-off-by: Ian Abbott 
---
 drivers/staging/comedi/drivers/daqboard2000.c | 214 --
 1 file changed, 100 insertions(+), 114 deletions(-)

diff --git a/drivers/staging/comedi/drivers/daqboard2000.c 
b/drivers/staging/comedi/drivers/daqboard2000.c
index 5949ec1eaad9..7a086cfa2712 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -111,12 +111,12 @@
 #include "8255.h"
 #include "plx9080.h"
 
-#define DAQBOARD2000_FIRMWARE  "daqboard2000_firmware.bin"
+#define DB2K_FIRMWARE  "daqboard2000_firmware.bin"
 
-#define DAQBOARD2000_SUBSYSTEM_IDS20x0002  /* Daqboard/2000 - 2 Dacs */
-#define DAQBOARD2000_SUBSYSTEM_IDS40x0004  /* Daqboard/2000 - 4 Dacs */
+#define DB2K_SUBSYSTEM_IDS20x0002  /* Daqboard/2000 - 2 Dacs */
+#define DB2K_SUBSYSTEM_IDS40x0004  /* Daqboard/2000 - 4 Dacs */
 
-static const struct comedi_lrange range_daqboard2000_ai = {
+static const struct comedi_lrange db2k_ai_range = {
13, {
BIP_RANGE(10),
BIP_RANGE(5),
@@ -245,30 +245,28 @@ static const struct comedi_lrange range_daqboard2000_ai = 
{
 /* "New CPLD" signature. */
 #define DB2K_CPLD_VERSION_NEW  0x5000
 
-struct daq200_boardtype {
+struct db2k_boardtype {
const char *name;
int id;
 };
 
-static const struct daq200_boardtype boardtypes[] = {
-   {"ids2", DAQBOARD2000_SUBSYSTEM_IDS2},
-   {"ids4", DAQBOARD2000_SUBSYSTEM_IDS4},
+static const struct db2k_boardtype db2k_boardtypes[] = {
+   {"ids2", DB2K_SUBSYSTEM_IDS2},
+   {"ids4", DB2K_SUBSYSTEM_IDS4},
 };
 
-struct daqboard2000_private {
+struct db2k_private {
void __iomem *plx;
 };
 
-static void daqboard2000_write_acq_scan_list_entry(struct comedi_device *dev,
-  u16 entry)
+static void db2k_write_acq_scan_list_entry(struct comedi_device *dev, u16 
entry)
 {
writew(entry & 0x00ff, dev->mmio + DB2K_REG_ACQ_SCAN_LIST_FIFO);
writew((entry >> 8) & 0x00ff,
   dev->mmio + DB2K_REG_ACQ_SCAN_LIST_FIFO);
 }
 
-static void daqboard2000_setup_sampling(struct comedi_device *dev, int chan,
-   int gain)
+static void db2k_setup_sampling(struct comedi_device *dev, int chan, int gain)
 {
u16 word0, word1, word2, word3;
 
@@ -302,16 +300,14 @@ static void daqboard2000_setup_sampling(struct 
comedi_device *dev, int chan,
/* These should be read from EEPROM */
word2 |= 0x0800;/* offset */
word3 |= 0xc000;/* gain */
-   daqboard2000_write_acq_scan_list_entry(dev, word0);
-   daqboard2000_write_acq_scan_list_entry(dev, word1);
-   daqboard2000_write_acq_scan_list_entry(dev, word2);
-   daqboard2000_write_acq_scan_list_entry(dev, word3);
+   db2k_write_acq_scan_list_entry(dev, word0);
+   db2k_write_acq_scan_list_entry(dev, word1);
+   db2k_write_acq_scan_list_entry(dev, word2);
+   db2k_write_acq_scan_list_entry(dev, word3);
 }
 
-static int daqboard2000_ai_status(struct comedi_device *dev,
- struct comedi_subdevice *s,
- struct comedi_insn *insn,
- unsigned long context)
+static int db2k_ai_status(struct comedi_device *dev, struct comedi_subdevice 
*s,
+ struct comedi_insn *insn, unsigned long context)
 {
unsigned int status;
 
@@ -321,10 +317,9 @@ static int daqboard2000_ai_status(struct comedi_device 
*dev,
return -EBUSY;
 }
 
-static int daqboard2000_ai_insn_read(struct comedi_device *dev,
-struct comedi_subdevice *s,
-struct comedi_insn *insn,
-unsigned int *data)
+static int db2k_ai_insn_read(struct comedi_device *dev,
+struct comedi_subdevice *s,
+struct comedi_insn *insn, unsigned int *data)
 {
int gain, chan;
int ret;
@@ -353,12 +348,12 @@ static int daqboard2000_ai_insn_read(struct comedi_device 
*dev,
 * forced to fix it.  --ds
 */
for (i = 0; i < insn->n; i++) {
-   daqboard2000_setup_sampling(dev, chan, gain);
+   db2k_setup_sampling(dev, chan, gain);
/* Enable reading from the scanlist FIFO */
writew(DB2K_ACQ_CONTROL_SEQ_START_SCAN_LIST,
   dev->mmio + DB2K_REG_ACQ_CONTROL);
 
-   ret = comedi_timeout(dev, s, insn, daqboard2000_ai_status,
+   ret = comedi_timeout(dev, s, insn, db2k_ai_status,
 DB2K_ACQ_STATUS_CONFIG_PIPE_FULL);
if (ret)
 

Re: [PATCH v2 04/19] ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors

2017-01-04 Thread Vladimir Zapolskiy
Hi Steve,

On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor.
> Both hang off the same i2c2 bus, so they require different (and non-
> default) i2c slave addresses.
> 
> The OV5642 connects to the parallel-bus mux input port on ipu1_csi0_mux.
> 
> The OV5640 connects to the input port on the MIPI CSI-2 receiver on
> mipi_csi. It is set to transmit over MIPI virtual channel 1.
> 
> Note there is a pin conflict with GPIO6. This pin functions as a power
> input pin to the OV5642, but ENET uses it as the h/w workaround for
> erratum ERR006687, to wake-up the ARM cores on normal RX and TX packet
> done events (see 6261c4c8). So workaround 6261c4c8 is reverted here to
> support the OV5642, and the "fsl,err006687-workaround-present" boolean
> also must be removed. The result is that the CPUidle driver will no longer
> allow entering the deep idle states on the sabrelite.

For me it sounds like a candidate of its own separate change.

> 
> Signed-off-by: Steve Longerbeam 
> ---

[snip]

>  &audmux {
>   pinctrl-names = "default";
>   pinctrl-0 = <&pinctrl_audmux>;
> @@ -271,9 +298,6 @@
>   txd1-skew-ps = <0>;
>   txd2-skew-ps = <0>;
>   txd3-skew-ps = <0>;
> - interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>,
> -   <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;

Like you say in the commit message this is a partial revert of 6261c4c8f13e
("ARM: dts: imx6qdl-sabrelite: use GPIO_6 for FEC interrupt.")

> - fsl,err006687-workaround-present;

This is a partial revert of a28eeb43ee57 ("ARM: dts: imx6: tag boards that
have the HW workaround for ERR006687").

The change should be split and reviewed separately in my opinion, also
cc Gary Bisson  for SabreLite changes.

>   status = "okay";
>  };
>  
> @@ -302,6 +326,52 @@
>   pinctrl-names = "default";
>   pinctrl-0 = <&pinctrl_i2c2>;
>   status = "okay";
> +
> + camera: ov5642@42 {
> + compatible = "ovti,ov5642";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_ov5642>;
> + clocks = <&clks IMX6QDL_CLK_CKO2>;
> + clock-names = "xclk";
> + reg = <0x42>;
> + xclk = <2400>;
> + reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>;
> + pwdn-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
> + gp-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>;
> +
> + port {
> + ov5642_to_ipu1_csi0_mux: endpoint {
> + remote-endpoint = 
> <&ipu1_csi0_mux_from_parallel_sensor>;
> + bus-width = <8>;
> + hsync-active = <1>;
> + vsync-active = <1>;
> + };
> + };
> + };
> +
> + mipi_camera: ov5640@40 {

Please reorder device nodes by address value, also according to ePAPR
node names should be generic, labels can be specific:

ov5640: camera@40 {
...
};

ov5642: camera@42 {
...
};

> + compatible = "ovti,ov5640_mipi";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_ov5640>;
> + clocks = <&mipi_xclk>;
> + clock-names = "xclk";
> + reg = <0x40>;
> + xclk = <2200>;
> + reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; /* NANDF_D5 */
> + pwdn-gpios = <&gpio6 9 GPIO_ACTIVE_HIGH>; /* NANDF_WP_B */
> +
> + port {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ov5640_to_mipi_csi: endpoint@1 {
> + reg = <1>;
> + remote-endpoint = <&mipi_csi_from_mipi_sensor>;
> + data-lanes = <0 1>;
> + clock-lanes = <2>;
> + };
> + };
> + };
>  };
>  
>  &i2c3 {
> @@ -374,7 +444,6 @@
>   MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL   0x1b030
>   /* Phy reset */
>   MX6QDL_PAD_EIM_D23__GPIO3_IO23  0x000b0
> - MX6QDL_PAD_GPIO_6__ENET_IRQ 0x000b1

Yep.

>   >;
>   };
>  
> @@ -449,6 +518,39 @@
>   >;
>   };
>  
> + pinctrl_ov5642: ov5642grp {
> + fsl,pins = <
> + MX6QDL_PAD_SD1_DAT0__GPIO1_IO16 0x8000
> + MX6QDL_PAD_GPIO_6__GPIO1_IO06   0x8000
> + MX6QDL_PAD_GPIO_8__GPIO1_IO08   0x8000
> + MX6QDL_PAD_GPIO_3__CCM_CLKO20x8000
> + >;
> + };
> +
> + pinctrl_ipu1_csi0: ipu1grp-csi0 {

Please rename node name to ipu1csi0grp.

> + 

Re: [PATCH v2 05/19] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors

2017-01-04 Thread Vladimir Zapolskiy
On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor.
> 
> The OV5642 connects to the parallel-bus mux input port on ipu1_csi0_mux.
> 
> The OV5640 connects to the input port on the MIPI CSI-2 receiver on
> mipi_csi. It is set to transmit over MIPI virtual channel 1.
> 
> Until the OV5652 sensor module compatible with the SabreSD becomes
> available for testing, the ov5642 node is currently disabled.
> 
> Signed-off-by: Steve Longerbeam 
> ---

[snip]

> +
> + camera: ov5642@3c {

ov5642: camera@3c

> + compatible = "ovti,ov5642";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_ov5642>;
> + clocks = <&clks IMX6QDL_CLK_CKO>;
> + clock-names = "xclk";
> + reg = <0x3c>;
> + xclk = <2400>;
> + DOVDD-supply = <&vgen4_reg>; /* 1.8v */
> + AVDD-supply = <&vgen5_reg>;  /* 2.8v, rev C board is VGEN3
> + rev B board is VGEN5 */
> + DVDD-supply = <&vgen2_reg>;  /* 1.5v*/
> + pwdn-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; /* SD1_DAT0 */
> + reset-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; /* SD1_DAT1 */

Comments about SD1_* pad names are redundant.

> + status = "disabled";

Why is it disabled here?

> +
> + port {
> + ov5642_to_ipu1_csi0_mux: endpoint {
> + remote-endpoint = 
> <&ipu1_csi0_mux_from_parallel_sensor>;
> + bus-width = <8>;
> + hsync-active = <1>;
> + vsync-active = <1>;
> + };
> + };
> + };
>  };
>  
>  &i2c2 {
> @@ -322,6 +376,34 @@
>   };
>   };
>   };
> +
> + mipi_camera: ov5640@3c {

ov5640: camera@3c

> + compatible = "ovti,ov5640_mipi";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_ov5640>;
> + reg = <0x3c>;
> + clocks = <&clks IMX6QDL_CLK_CKO>;
> + clock-names = "xclk";
> + xclk = <2400>;
> + DOVDD-supply = <&vgen4_reg>; /* 1.8v */
> + AVDD-supply = <&vgen5_reg>;  /* 2.8v, rev C board is VGEN3
> + rev B board is VGEN5 */
> + DVDD-supply = <&vgen2_reg>;  /* 1.5v*/
> + pwdn-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>; /* SD1_DAT2 */
> + reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>; /* SD1_CLK */

Comments about SD1_* pad names are redundant.

> +
> + port {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + ov5640_to_mipi_csi: endpoint@1 {
> + reg = <1>;
> + remote-endpoint = <&mipi_csi_from_mipi_sensor>;
> + data-lanes = <0 1>;
> + clock-lanes = <2>;
> + };
> + };
> + };
>  };
>  
>  &i2c3 {
> @@ -426,6 +508,36 @@
>   >;
>   };
>  
> + pinctrl_ov5640: ov5640grp {
> + fsl,pins = <
> + MX6QDL_PAD_SD1_DAT2__GPIO1_IO19 0x8000
> + MX6QDL_PAD_SD1_CLK__GPIO1_IO20  0x8000
> + >;
> + };
> +
> + pinctrl_ov5642: ov5642grp {
> + fsl,pins = <
> + MX6QDL_PAD_SD1_DAT0__GPIO1_IO16 0x8000
> + MX6QDL_PAD_SD1_DAT1__GPIO1_IO17 0x8000
> + >;
> + };
> +
> + pinctrl_ipu1_csi0: ipu1grp-csi0 {

Please rename the node name to ipu1csi0grp.

Please add new pin control groups preserving the alphanimerical order.

> + fsl,pins = <
> + MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12
> 0x8000
> + MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13
> 0x8000
> + MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14
> 0x8000
> + MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15
> 0x8000
> + MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16
> 0x8000
> + MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17
> 0x8000
> + MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18
> 0x8000
> + MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19
> 0x8000
> + MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK   
> 0x8000
> + MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC  
> 0x8000
> + MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 
> 0x8000
> +

Re: [PATCH v2 09/19] ARM: dts: imx6-sabreauto: add the ADV7180 video decoder

2017-01-04 Thread Vladimir Zapolskiy
On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> Enables the ADV7180 decoder sensor. The ADV7180 connects to the
> parallel-bus mux input on ipu1_csi0_mux.
> 
> On the sabreauto, two analog video inputs are routed to the ADV7180,
> composite on Ain1, and composite on Ain3. Those inputs are defined
> via inputs and input-names under the ADV7180 node. The ADV7180 power
> pin is via max7310_b port expander.
> 
> Signed-off-by: Steve Longerbeam 
> ---
>  arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 56 
> 
>  1 file changed, 56 insertions(+)
> 
> diff --git a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi 
> b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
> index 83ac2ff..30ee378 100644
> --- a/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
> +++ b/arch/arm/boot/dts/imx6qdl-sabreauto.dtsi
> @@ -147,10 +147,42 @@
>   gpio-controller;
>   #gpio-cells = <2>;
>   };
> +
> + camera: adv7180@21 {

adv7180: camera@21

> + compatible = "adi,adv7180";
> + reg = <0x21>;
> + powerdown-gpios = <&max7310_b 2 
> GPIO_ACTIVE_LOW>;
> + interrupt-parent = <&gpio1>;
> + interrupts = <27 0x8>;
> + inputs = <0x00 0x02>;
> + input-names = "ADV7180 Composite on Ain1",
> + "ADV7180 Composite on Ain3";
> +
> + port {
> + adv7180_to_ipu1_csi0_mux: endpoint {
> + remote-endpoint = 
> <&ipu1_csi0_mux_from_parallel_sensor>;
> + bus-width = <8>;
> + };
> + };
> + };
>   };
>   };
>  };
>  
> +&ipu1_csi0_from_ipu1_csi0_mux {
> + bus-width = <8>;
> +};
> +
> +&ipu1_csi0_mux_from_parallel_sensor {
> + remote-endpoint = <&adv7180_to_ipu1_csi0_mux>;
> + bus-width = <8>;
> +};
> +
> +&ipu1_csi0 {
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_ipu1_csi0>;
> +};
> +
>  &clks {
>   assigned-clocks = <&clks IMX6QDL_PLL4_BYPASS_SRC>,
> <&clks IMX6QDL_PLL4_BYPASS>,
> @@ -451,6 +483,30 @@
>   >;
>   };
>  
> + pinctrl_ipu1_csi0: ipu1grp-csi0 {

Please rename node name to ipu1csi0grp.

> + fsl,pins = <
> + MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04   
> 0x8000
> + MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05   
> 0x8000
> + MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06   
> 0x8000
> + MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07   
> 0x8000
> + MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08   
> 0x8000
> + MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09   
> 0x8000
> + MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18  
> 0x8000
> + MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19  
> 0x8000
> + MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 
> 0x8000
> + MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC
> 0x8000
> + MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC   
> 0x8000
> + >;
> + };
> +
>   pinctrl_pwm3: pwm1grp {
>   fsl,pins = <
>   MX6QDL_PAD_SD4_DAT1__PWM3_OUT   0x1b0b1
> 

--
With best wishes,
Vladimir
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next] net/hyperv: remove use of VLAN_TAG_PRESENT

2017-01-04 Thread Vitaly Kuznetsov
Michał Mirosław  writes:

> Signed-off-by: Michał Mirosław 

Can we have a non-empty description please?

> ---
>  drivers/net/hyperv/hyperv_net.h   |  2 +-
>  drivers/net/hyperv/netvsc_drv.c   | 13 ++---
>  drivers/net/hyperv/rndis_filter.c |  4 ++--
>  3 files changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/hyperv/hyperv_net.h b/drivers/net/hyperv/hyperv_net.h
> index 3958adade7eb..b53729e85a79 100644
> --- a/drivers/net/hyperv/hyperv_net.h
> +++ b/drivers/net/hyperv/hyperv_net.h
> @@ -186,7 +186,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
>   void **data,
>   struct ndis_tcp_ip_checksum_info *csum_info,
>   struct vmbus_channel *channel,
> - u16 vlan_tci);
> + u16 vlan_tci, bool vlan_present);
>  void netvsc_channel_cb(void *context);
>  int rndis_filter_open(struct netvsc_device *nvdev);
>  int rndis_filter_close(struct netvsc_device *nvdev);
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index c9414c054852..6597d7901929 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -595,7 +595,7 @@ void netvsc_linkstatus_callback(struct hv_device 
> *device_obj,
>  static struct sk_buff *netvsc_alloc_recv_skb(struct net_device *net,
>   struct hv_netvsc_packet *packet,
>   struct ndis_tcp_ip_checksum_info *csum_info,
> - void *data, u16 vlan_tci)
> + void *data)
>  {
>   struct sk_buff *skb;
>
> @@ -625,10 +625,6 @@ static struct sk_buff *netvsc_alloc_recv_skb(struct 
> net_device *net,
>   skb->ip_summed = CHECKSUM_UNNECESSARY;
>   }
>
> - if (vlan_tci & VLAN_TAG_PRESENT)
> - __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
> -vlan_tci);
> -
>   return skb;
>  }
>
> @@ -641,7 +637,7 @@ int netvsc_recv_callback(struct hv_device *device_obj,
>   void **data,
>   struct ndis_tcp_ip_checksum_info *csum_info,
>   struct vmbus_channel *channel,
> - u16 vlan_tci)
> + u16 vlan_tci, bool vlan_present)
>  {
>   struct net_device *net = hv_get_drvdata(device_obj);
>   struct net_device_context *net_device_ctx = netdev_priv(net);
> @@ -664,12 +660,15 @@ int netvsc_recv_callback(struct hv_device *device_obj,
>   net = vf_netdev;
>
>   /* Allocate a skb - TODO direct I/O to pages? */
> - skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data, vlan_tci);
> + skb = netvsc_alloc_recv_skb(net, packet, csum_info, *data);
>   if (unlikely(!skb)) {
>   ++net->stats.rx_dropped;
>   return NVSP_STAT_FAIL;
>   }
>
> + if (vlan_present)
> + __vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), vlan_tci);
> +
>   if (net != vf_netdev)
>   skb_record_rx_queue(skb,
>   channel->offermsg.offer.sub_channel_index);
> diff --git a/drivers/net/hyperv/rndis_filter.c 
> b/drivers/net/hyperv/rndis_filter.c
> index 8d90904e0e49..7f7b410a41c2 100644
> --- a/drivers/net/hyperv/rndis_filter.c
> +++ b/drivers/net/hyperv/rndis_filter.c
> @@ -381,13 +381,13 @@ static int rndis_filter_receive_data(struct 
> rndis_device *dev,
>
>   vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO);
>   if (vlan) {
> - vlan_tci = VLAN_TAG_PRESENT | vlan->vlanid |
> + vlan_tci = vlan->vlanid |
>   (vlan->pri << VLAN_PRIO_SHIFT);
>   }
>
>   csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO);
>   return netvsc_recv_callback(net_device_ctx->device_ctx, pkt, data,
> - csum_info, channel, vlan_tci);
> + csum_info, channel, vlan_tci, vlan);
>  }
>
>  int rndis_filter_receive(struct hv_device *dev,

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


Re: [PATCH v2 10/19] media: Add i.MX media core driver

2017-01-04 Thread Vladimir Zapolskiy
Hi Steve,

On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> Add the core media driver for i.MX SOC.
> 
> Signed-off-by: Steve Longerbeam 
> ---
>  Documentation/devicetree/bindings/media/imx.txt   | 205 +

v2 was sent before getting Rob's review comments, but still they
should be addressed in v3.

Also I would suggest to separate device tree binding documentation
change and place it as the first patch in the series, this should
make the following DTS changes valid.

>  Documentation/media/v4l-drivers/imx.rst   | 430 ++
>  drivers/staging/media/Kconfig |   2 +
>  drivers/staging/media/Makefile|   1 +
>  drivers/staging/media/imx/Kconfig |   8 +
>  drivers/staging/media/imx/Makefile|   6 +
>  drivers/staging/media/imx/TODO|  18 +
>  drivers/staging/media/imx/imx-media-common.c  | 985 
> ++
>  drivers/staging/media/imx/imx-media-dev.c | 479 +++
>  drivers/staging/media/imx/imx-media-fim.c | 509 +++
>  drivers/staging/media/imx/imx-media-internal-sd.c | 457 ++
>  drivers/staging/media/imx/imx-media-of.c  | 291 +++
>  drivers/staging/media/imx/imx-media-of.h  |  25 +
>  drivers/staging/media/imx/imx-media.h | 299 +++
>  include/media/imx.h   |  15 +
>  include/uapi/Kbuild   |   1 +
>  include/uapi/linux/v4l2-controls.h|   4 +
>  include/uapi/media/Kbuild |   2 +
>  include/uapi/media/imx.h  |  30 +

Probably Greg should ack the UAPI changes, you may consider
to split them into a separate patch.

>  19 files changed, 3767 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/imx.txt
>  create mode 100644 Documentation/media/v4l-drivers/imx.rst
>  create mode 100644 drivers/staging/media/imx/Kconfig
>  create mode 100644 drivers/staging/media/imx/Makefile
>  create mode 100644 drivers/staging/media/imx/TODO
>  create mode 100644 drivers/staging/media/imx/imx-media-common.c
>  create mode 100644 drivers/staging/media/imx/imx-media-dev.c
>  create mode 100644 drivers/staging/media/imx/imx-media-fim.c
>  create mode 100644 drivers/staging/media/imx/imx-media-internal-sd.c
>  create mode 100644 drivers/staging/media/imx/imx-media-of.c
>  create mode 100644 drivers/staging/media/imx/imx-media-of.h
>  create mode 100644 drivers/staging/media/imx/imx-media.h
>  create mode 100644 include/media/imx.h
>  create mode 100644 include/uapi/media/Kbuild
>  create mode 100644 include/uapi/media/imx.h
> 

[snip]

> +
> +struct imx_media_subdev *
> +imx_media_find_subdev_by_sd(struct imx_media_dev *imxmd,
> + struct v4l2_subdev *sd)
> +{
> + struct imx_media_subdev *imxsd;
> + int i, ret = -ENODEV;
> +
> + for (i = 0; i < imxmd->num_subdevs; i++) {
> + imxsd = &imxmd->subdev[i];
> + if (sd == imxsd->sd) {

This can be simplifed:

...

if (sd == imxsd->sd)
return imxsd;
}

return ERR_PTR(-ENODEV);

> + ret = 0;
> + break;
> + }
> + }
> +
> + return ret ? ERR_PTR(ret) : imxsd;
> +}
> +EXPORT_SYMBOL_GPL(imx_media_find_subdev_by_sd);
> +
> +struct imx_media_subdev *
> +imx_media_find_subdev_by_id(struct imx_media_dev *imxmd, u32 grp_id)
> +{
> + struct imx_media_subdev *imxsd;
> + int i, ret = -ENODEV;
> +
> + for (i = 0; i < imxmd->num_subdevs; i++) {
> + imxsd = &imxmd->subdev[i];
> + if (imxsd->sd && imxsd->sd->grp_id == grp_id) {
> + ret = 0;
> + break;

This can be simplifed:

...

if (imxsd->sd && imxsd->sd->grp_id == grp_i)
return imxsd;
}

return ERR_PTR(-ENODEV);

> + }
> + }
> +
> + return ret ? ERR_PTR(ret) : imxsd;
> +}
> +EXPORT_SYMBOL_GPL(imx_media_find_subdev_by_id);
> +

[snip]

> diff --git a/drivers/staging/media/imx/imx-media-dev.c 
> b/drivers/staging/media/imx/imx-media-dev.c
> new file mode 100644
> index 000..8d22730
> --- /dev/null
> +++ b/drivers/staging/media/imx/imx-media-dev.c
> @@ -0,0 +1,479 @@
> +/*
> + * V4L2 Media Controller Driver for Freescale i.MX5/6 SOC
> + *
> + * Copyright (c) 2016 Mentor Graphics Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

Please sort out the list of headers alphabetically.

> +#include 
> +#include 
> +#include "imx-media.h"
> +#include "imx-media-of.h"

Re: [PATCH v2 11/19] media: imx: Add CSI subdev driver

2017-01-04 Thread Vladimir Zapolskiy
On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> This is a media entity subdevice for the i.MX Camera
> Serial Interface module.
> 
> Signed-off-by: Steve Longerbeam 
> ---

[snip]

> diff --git a/drivers/staging/media/imx/imx-csi.c 
> b/drivers/staging/media/imx/imx-csi.c
> new file mode 100644
> index 000..975eafb
> --- /dev/null
> +++ b/drivers/staging/media/imx/imx-csi.c
> @@ -0,0 +1,638 @@
> +/*
> + * V4L2 Capture CSI Subdev for Freescale i.MX5/6 SOC
> + *
> + * Copyright (c) 2014-2016 Mentor Graphics Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

Please add the headers alphabetically ordered.

> +#include 
> +#include "imx-media.h"
> +
> +#define CSI_NUM_PADS 2
> +
> +struct csi_priv {
> + struct device *dev;
> + struct ipu_soc *ipu;
> + struct imx_media_dev *md;
> + struct v4l2_subdev sd;
> + struct media_pad pad[CSI_NUM_PADS];
> + struct v4l2_mbus_framefmt format_mbus[CSI_NUM_PADS];
> + struct v4l2_mbus_config sensor_mbus_cfg;
> + struct v4l2_rect crop;
> + struct ipu_csi *csi;
> + int csi_id;
> + int input_pad;
> + int output_pad;
> + bool power_on;  /* power is on */
> + bool stream_on; /* streaming is on */
> +
> + /* the sink for the captured frames */
> + struct v4l2_subdev *sink_sd;
> + enum ipu_csi_dest dest;
> + struct v4l2_subdev *src_sd;
> +
> + struct v4l2_ctrl_handler ctrl_hdlr;
> + struct imx_media_fim *fim;
> +
> + /* the attached sensor at stream on */
> + struct imx_media_subdev *sensor;
> +};
> +
> +static inline struct csi_priv *sd_to_dev(struct v4l2_subdev *sdev)
> +{
> + return container_of(sdev, struct csi_priv, sd);
> +}
> +
> +/* Update the CSI whole sensor and active windows */
> +static int csi_setup(struct csi_priv *priv)
> +{
> + struct v4l2_mbus_framefmt infmt;
> +
> + ipu_csi_set_window(priv->csi, &priv->crop);
> +
> + /*
> +  * the ipu-csi doesn't understand ALTERNATE, but it only
> +  * needs to know whether the stream is interlaced, so set
> +  * to INTERLACED if infmt field is ALTERNATE.
> +  */
> + infmt = priv->format_mbus[priv->input_pad];
> + if (infmt.field == V4L2_FIELD_ALTERNATE)
> + infmt.field = V4L2_FIELD_INTERLACED;
> +
> + ipu_csi_init_interface(priv->csi, &priv->sensor_mbus_cfg, &infmt);
> +
> + ipu_csi_set_dest(priv->csi, priv->dest);
> +
> + ipu_csi_dump(priv->csi);
> +
> + return 0;
> +}
> +
> +static int csi_start(struct csi_priv *priv)
> +{
> + int ret;
> +
> + if (!priv->sensor) {
> + v4l2_err(&priv->sd, "no sensor attached\n");
> + return -EINVAL;
> + }
> +
> + ret = csi_setup(priv);
> + if (ret)
> + return ret;
> +
> + /* start the frame interval monitor */
> + ret = imx_media_fim_set_stream(priv->fim, priv->sensor, true);
> + if (ret)
> + return ret;
> +
> + ret = ipu_csi_enable(priv->csi);
> + if (ret) {
> + v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
> + return ret;
> + }
> +
> + return 0;

if (ret)
v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);

return ret;

> +}
> +
> +static void csi_stop(struct csi_priv *priv)
> +{
> + /* stop the frame interval monitor */
> + imx_media_fim_set_stream(priv->fim, priv->sensor, false);
> +
> + ipu_csi_disable(priv->csi);
> +}
> +
> +static int csi_s_stream(struct v4l2_subdev *sd, int enable)
> +{
> + struct csi_priv *priv = v4l2_get_subdevdata(sd);
> + int ret = 0;
> +
> + if (!priv->src_sd || !priv->sink_sd)
> + return -EPIPE;
> +
> + v4l2_info(sd, "stream %s\n", enable ? "ON" : "OFF");
> +
> + if (enable && !priv->stream_on)
> + ret = csi_start(priv);
> + else if (!enable && priv->stream_on)
> + csi_stop(priv);
> +
> + if (!ret)
> + priv->stream_on = enable;
> + return ret;
> +}
> +
> +static int csi_s_power(struct v4l2_subdev *sd, int on)
> +{
> + struct csi_priv *priv = v4l2_get_subdevdata(sd);
> + int ret = 0;
> +
> + v4l2_info(sd, "power %s\n", on ? "ON" : "OFF");
> +
> + if (on != priv->power_on)
> + ret = imx_media_fim_set_power(priv->fim, on);
> +
> + if (!ret)
> + priv->power_on = on;
> + return ret;
> +}
> +
> +static int csi_link_setup(struct media_entity *entity,
> +   const struct media_pad *local,
> +   const struct media_pad *remote, u32 flags)
> +{
> + struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
> + struct csi_priv *priv = v4l2_get_subdevdata(sd);
> + struct v4l2_subd

[PATCH 1/2] staging: greybus: audio_topology: Fix spaces between operator and string

2017-01-04 Thread Emmanuil Chatzipetru
Fix coding style issue caught by checkpatch.pl related to the following
warning:
- "CHECK: spaces preferred around that '*' (ctx:VxV) "

Signed-off-by: Emmanuil Chatzipetru 
---
 drivers/staging/greybus/audio_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/audio_topology.c 
b/drivers/staging/greybus/audio_topology.c
index 8b216ca99cf9..3001a4971c06 100644
--- a/drivers/staging/greybus/audio_topology.c
+++ b/drivers/staging/greybus/audio_topology.c
@@ -1312,7 +1312,7 @@ static int gbaudio_tplg_process_routes(struct 
gbaudio_module_info *module,
goto error;
}
dev_dbg(module->dev, "Route {%s, %s, %s}\n", dapm_routes->sink,
-   (dapm_routes->control) ? dapm_routes->control:"NULL",
+   (dapm_routes->control) ? dapm_routes->control : "NULL",
dapm_routes->source);
dapm_routes++;
curr++;
-- 
2.1.4

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


[PATCH 2/2] staging: greybus: log: Fix line over 80 characters.

2017-01-04 Thread Emmanuil Chatzipetru
Fix coding style issue caught by checkpatch.pl related to the following
warning:
- CHECK: WARNING: line over 80 characters

Signed-off-by: Emmanuil Chatzipetru 
---
 drivers/staging/greybus/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/log.c b/drivers/staging/greybus/log.c
index 1a18ab1ff8aa..87910fd4a332 100644
--- a/drivers/staging/greybus/log.c
+++ b/drivers/staging/greybus/log.c
@@ -39,7 +39,7 @@ static int gb_log_request_handler(struct gb_operation *op)
len = le16_to_cpu(receive->len);
if (len != (int)(op->request->payload_size - sizeof(*receive))) {
dev_err(dev, "log request wrong size %d vs %d\n", len,
-   (int)(op->request->payload_size - 
sizeof(*receive)));
+   (int)(op->request->payload_size - sizeof(*receive)));
return -EINVAL;
}
if (len == 0) {
-- 
2.1.4

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


Re: [PATCH v2 12/19] media: imx: Add SMFC subdev driver

2017-01-04 Thread Vladimir Zapolskiy
On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> This is a media entity subdevice driver for the i.MX Sensor Multi-FIFO
> Controller module. Video frames are received from the CSI and can
> be routed to various sinks including the i.MX Image Converter for
> scaling, color-space conversion, motion compensated deinterlacing,
> and image rotation.
> 
> Signed-off-by: Steve Longerbeam 
> ---
>  drivers/staging/media/imx/Makefile   |   1 +
>  drivers/staging/media/imx/imx-smfc.c | 739 
> +++
>  2 files changed, 740 insertions(+)
>  create mode 100644 drivers/staging/media/imx/imx-smfc.c
> 
> diff --git a/drivers/staging/media/imx/Makefile 
> b/drivers/staging/media/imx/Makefile
> index 133672a..3559d7b 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -5,4 +5,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o
>  obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o
>  
>  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
> +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o

May be

obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o imx-smfc.o

>  
> diff --git a/drivers/staging/media/imx/imx-smfc.c 
> b/drivers/staging/media/imx/imx-smfc.c
> new file mode 100644
> index 000..565048c
> --- /dev/null
> +++ b/drivers/staging/media/imx/imx-smfc.c
> @@ -0,0 +1,739 @@
> +/*
> + * V4L2 Capture SMFC Subdev for Freescale i.MX5/6 SOC
> + *
> + * This subdevice handles capture of raw/unconverted video frames
> + * from the CSI, directly to memory via the Sensor Multi-FIFO Controller.
> + *
> + * Copyright (c) 2012-2016 Mentor Graphics Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

Please sort the list of headers alphabetically.

> +#include 
> +#include "imx-media.h"
> +

[snip]

> +static irqreturn_t imx_smfc_eof_interrupt(int irq, void *dev_id)
> +{
> + struct imx_smfc_priv *priv = dev_id;
> + struct imx_media_dma_buf *done, *next;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&priv->irqlock, flags);

spin_lock(&priv->irqlock) should be sufficient.

> +
> + if (priv->last_eof) {
> + complete(&priv->last_eof_comp);
> + priv->last_eof = false;
> + goto unlock;
> + }
> +
> + /* inform CSI of this EOF so it can monitor frame intervals */
> + v4l2_subdev_call(priv->src_sd, core, interrupt_service_routine,
> +  0, NULL);
> +
> + done = imx_media_dma_buf_get_active(priv->out_ring);
> + /* give the completed buffer to the sink  */
> + if (!WARN_ON(!done))
> + imx_media_dma_buf_done(done, IMX_MEDIA_BUF_STATUS_DONE);
> +
> + /* priv->next buffer is now the active one */
> + imx_media_dma_buf_set_active(priv->next);
> +
> + /* bump the EOF timeout timer */
> + mod_timer(&priv->eof_timeout_timer,
> +   jiffies + msecs_to_jiffies(IMX_MEDIA_EOF_TIMEOUT));
> +
> + if (ipu_idmac_buffer_is_ready(priv->smfc_ch, priv->ipu_buf_num))
> + ipu_idmac_clear_buffer(priv->smfc_ch, priv->ipu_buf_num);
> +
> + /* get next queued buffer */
> + next = imx_media_dma_buf_get_next_queued(priv->out_ring);
> +
> + ipu_cpmem_set_buffer(priv->smfc_ch, priv->ipu_buf_num, next->phys);
> + ipu_idmac_select_buffer(priv->smfc_ch, priv->ipu_buf_num);
> +
> + /* toggle IPU double-buffer index */
> + priv->ipu_buf_num ^= 1;
> + priv->next = next;
> +
> +unlock:
> + spin_unlock_irqrestore(&priv->irqlock, flags);
> + return IRQ_HANDLED;
> +}
> +

[snip]

> +
> +static const struct platform_device_id imx_smfc_ids[] = {
> + { .name = "imx-ipuv3-smfc" },
> + { },
> +};
> +MODULE_DEVICE_TABLE(platform, imx_smfc_ids);
> +
> +static struct platform_driver imx_smfc_driver = {
> + .probe = imx_smfc_probe,
> + .remove = imx_smfc_remove,
> + .id_table = imx_smfc_ids,
> + .driver = {
> + .name = "imx-ipuv3-smfc",
> + .owner = THIS_MODULE,

You can drop owner assignment.

> + },
> +};
> +module_platform_driver(imx_smfc_driver);
> +
> +MODULE_DESCRIPTION("i.MX SMFC subdev driver");
> +MODULE_AUTHOR("Steve Longerbeam ");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:imx-ipuv3-smfc");
> 

--
With best wishes,
Vladimir
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/2] staging: greybus: audio_topology: Fix spaces between operator and string

2017-01-04 Thread Johan Hovold
On Wed, Jan 04, 2017 at 03:07:31PM +0100, Emmanuil Chatzipetru wrote:
> Fix coding style issue caught by checkpatch.pl related to the following
> warning:
>   - "CHECK: spaces preferred around that '*' (ctx:VxV) "
> 
> Signed-off-by: Emmanuil Chatzipetru 

Acked-by: Johan Hovold 

> ---
>  drivers/staging/greybus/audio_topology.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/audio_topology.c 
> b/drivers/staging/greybus/audio_topology.c
> index 8b216ca99cf9..3001a4971c06 100644
> --- a/drivers/staging/greybus/audio_topology.c
> +++ b/drivers/staging/greybus/audio_topology.c
> @@ -1312,7 +1312,7 @@ static int gbaudio_tplg_process_routes(struct 
> gbaudio_module_info *module,
>   goto error;
>   }
>   dev_dbg(module->dev, "Route {%s, %s, %s}\n", dapm_routes->sink,
> - (dapm_routes->control) ? dapm_routes->control:"NULL",
> + (dapm_routes->control) ? dapm_routes->control : "NULL",
>   dapm_routes->source);
>   dapm_routes++;
>   curr++;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] staging: greybus: log: Fix line over 80 characters.

2017-01-04 Thread Johan Hovold
On Wed, Jan 04, 2017 at 03:07:32PM +0100, Emmanuil Chatzipetru wrote:
> Fix coding style issue caught by checkpatch.pl related to the following
> warning:
>   - CHECK: WARNING: line over 80 characters
> 
> Signed-off-by: Emmanuil Chatzipetru 
> ---
>  drivers/staging/greybus/log.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/log.c b/drivers/staging/greybus/log.c
> index 1a18ab1ff8aa..87910fd4a332 100644
> --- a/drivers/staging/greybus/log.c
> +++ b/drivers/staging/greybus/log.c
> @@ -39,7 +39,7 @@ static int gb_log_request_handler(struct gb_operation *op)
>   len = le16_to_cpu(receive->len);
>   if (len != (int)(op->request->payload_size - sizeof(*receive))) {
>   dev_err(dev, "log request wrong size %d vs %d\n", len,
> - (int)(op->request->payload_size - 
> sizeof(*receive)));
> + (int)(op->request->payload_size - sizeof(*receive)));

This file is consistently using two-tab indentation for continuation
lines. If you really want to stay within 80 cols here you should drop
the cast and use %zu as format specifier instead.

You can drop the redundant cast in the comparison as well while at it.

>   return -EINVAL;
>   }
>   if (len == 0) {

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


Re: [PATCH v2 13/19] media: imx: Add IC subdev drivers

2017-01-04 Thread Vladimir Zapolskiy
On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> This is a set of three media entity subdevice drivers for the i.MX
> Image Converter. The i.MX IC module contains three independent
> "tasks":
> 
> - Pre-processing Encode task: video frames are routed directly from
>   the CSI and can be scaled, color-space converted, and rotated.
>   Scaled output is limited to 1024x1024 resolution. Output frames
>   are routed to the camera interface entities (camif).
> 
> - Pre-processing Viewfinder task: this task can perform the same
>   conversions as the pre-process encode task, but in addition can
>   be used for hardware motion compensated deinterlacing. Frames can
>   come either directly from the CSI or from the SMFC entities (memory
>   buffers via IDMAC channels). Scaled output is limited to 1024x1024
>   resolution. Output frames can be routed to various sinks including
>   the post-processing task entities.
> 
> - Post-processing task: same conversions as pre-process encode. However
>   this entity sends frames to the i.MX IPU image converter which supports
>   image tiling, which allows scaled output up to 4096x4096 resolution.
>   Output frames can be routed to the camera interfaces.
> 
> Signed-off-by: Steve Longerbeam 
> ---

[snip]

> +static int imx_ic_probe(struct platform_device *pdev)
> +{
> + struct imx_media_internal_sd_platformdata *pdata;
> + struct imx_ic_priv *priv;
> + int ret;
> +
> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, &priv->sd);
> + priv->dev = &pdev->dev;
> +
> + /* get our ipu_id, grp_id and IC task id */
> + pdata = priv->dev->platform_data;
> + priv->ipu_id = pdata->ipu_id;
> + switch (pdata->grp_id) {
> + case IMX_MEDIA_GRP_ID_IC_PRPENC:
> + priv->task_id = IC_TASK_ENCODER;
> + break;
> + case IMX_MEDIA_GRP_ID_IC_PRPVF:
> + priv->task_id = IC_TASK_VIEWFINDER;
> + break;
> + case IMX_MEDIA_GRP_ID_IC_PP0...IMX_MEDIA_GRP_ID_IC_PP3:
> + priv->task_id = IC_TASK_POST_PROCESSOR;
> + break;
> + default:
> + return -EINVAL;
> + }
> +
> + v4l2_subdev_init(&priv->sd, ic_ops[priv->task_id]->subdev_ops);
> + v4l2_set_subdevdata(&priv->sd, priv);
> + priv->sd.internal_ops = ic_ops[priv->task_id]->internal_ops;
> + priv->sd.entity.ops = ic_ops[priv->task_id]->entity_ops;
> + priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_SCALER;
> + priv->sd.dev = &pdev->dev;
> + priv->sd.owner = THIS_MODULE;
> + priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
> + priv->sd.grp_id = pdata->grp_id;
> + strncpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
> +
> + ret = ic_ops[priv->task_id]->init(priv);
> + if (ret)
> + return ret;
> +
> + ret = v4l2_async_register_subdev(&priv->sd);
> + if (ret)
> + goto remove;
> +
> + return 0;
> +remove:
> + ic_ops[priv->task_id]->remove(priv);
> + return ret;

if (ret)
ic_ops[priv->task_id]->remove(priv);

return ret;

as an alternative.

[snip]

> +static const struct platform_device_id imx_ic_ids[] = {
> + { .name = "imx-ipuv3-ic" },
> + { },
> +};
> +MODULE_DEVICE_TABLE(platform, imx_ic_ids);
> +
> +static struct platform_driver imx_ic_driver = {
> + .probe = imx_ic_probe,
> + .remove = imx_ic_remove,
> + .id_table = imx_ic_ids,
> + .driver = {
> + .name = "imx-ipuv3-ic",
> + .owner = THIS_MODULE,

Please drop .owner assignment.

> + },
> +};
> +module_platform_driver(imx_ic_driver);
> +
> +MODULE_DESCRIPTION("i.MX IC subdev driver");
> +MODULE_AUTHOR("Steve Longerbeam ");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:imx-ipuv3-ic");
> diff --git a/drivers/staging/media/imx/imx-ic-pp.c 
> b/drivers/staging/media/imx/imx-ic-pp.c
> new file mode 100644
> index 000..5ef0581
> --- /dev/null
> +++ b/drivers/staging/media/imx/imx-ic-pp.c
> @@ -0,0 +1,636 @@
> +/*
> + * V4L2 IC Post-Processor Subdev for Freescale i.MX5/6 SOC
> + *
> + * Copyright (c) 2014-2016 Mentor Graphics Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

Please sort the list of headers alphabetically.

> +#include 
> +#include 
> +#include "imx-media.h"
> +#include "imx-ic.h"
> +

[snip]

> +
> +static int pp_start(struct pp_priv *priv)
> +{
> + struct imx_ic_priv *ic_priv = priv->ic_priv;
> + struct ipu_image image_in, image_out;
> + c

Re: [PATCH v2 14/19] media: imx: Add Camera Interface subdev driver

2017-01-04 Thread Vladimir Zapolskiy
On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> This is the camera interface driver that provides the v4l2
> user interface. Frames can be received from various sources:
> 
> - directly from SMFC for capturing unconverted images directly from
>   camera sensors.
> 
> - from the IC pre-process encode task.
> 
> - from the IC pre-process viewfinder task.
> 
> - from the IC post-process task.
> 
> Signed-off-by: Steve Longerbeam 
> ---
>  drivers/staging/media/imx/Makefile|2 +-
>  drivers/staging/media/imx/imx-camif.c | 1010 
> +
>  2 files changed, 1011 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/staging/media/imx/imx-camif.c
> 
> diff --git a/drivers/staging/media/imx/Makefile 
> b/drivers/staging/media/imx/Makefile
> index d2a962c..fe9e992 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -8,4 +8,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o
>  
>  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
>  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
> -
> +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o

obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o imx-csi.o imx-smfc.o

as an option.

> diff --git a/drivers/staging/media/imx/imx-camif.c 
> b/drivers/staging/media/imx/imx-camif.c
> new file mode 100644
> index 000..3cf167e
> --- /dev/null
> +++ b/drivers/staging/media/imx/imx-camif.c
> @@ -0,0 +1,1010 @@
> +/*
> + * Video Camera Capture Subdev for Freescale i.MX5/6 SOC
> + *
> + * Copyright (c) 2012-2016 Mentor Graphics Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

Please sort the list of headers alphabetically.

> +#include 
> +#include 
> +#include "imx-media.h"
> +
> +#define DEVICE_NAME "imx-media-camif"

I would propose to drop this macro.

> +
> +#define CAMIF_NUM_PADS 2
> +
> +#define CAMIF_DQ_TIMEOUT5000

Add a comment about time unit?

> +
> +struct camif_priv;
> +

This is a leftover apparently.

> +struct camif_priv {
> + struct device *dev;
> + struct video_devicevfd;
> + struct media_pipeline  mp;
> + struct imx_media_dev  *md;

[snip]

> +static int camif_probe(struct platform_device *pdev)
> +{
> + struct imx_media_internal_sd_platformdata *pdata;
> + struct camif_priv *priv;
> + struct video_device *vfd;
> + int ret;
> +
> + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + platform_set_drvdata(pdev, priv);
> + priv->dev = &pdev->dev;
> +
> + pdata = priv->dev->platform_data;
> +
> + mutex_init(&priv->mutex);
> + spin_lock_init(&priv->q_lock);
> +
> + v4l2_subdev_init(&priv->sd, &camif_subdev_ops);
> + v4l2_set_subdevdata(&priv->sd, priv);
> + priv->sd.internal_ops = &camif_internal_ops;
> + priv->sd.entity.ops = &camif_entity_ops;
> + priv->sd.entity.function = MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER;
> + priv->sd.dev = &pdev->dev;
> + priv->sd.owner = THIS_MODULE;
> + /* get our group id and camif id */
> + priv->sd.grp_id = pdata->grp_id;
> + priv->id = (pdata->grp_id >> IMX_MEDIA_GRP_ID_CAMIF_BIT) - 1;
> + strncpy(priv->sd.name, pdata->sd_name, sizeof(priv->sd.name));
> + snprintf(camif_videodev.name, sizeof(camif_videodev.name),
> +  "%s devnode", pdata->sd_name);
> +
> + priv->sd.flags = V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
> +
> + vfd = &priv->vfd;
> + *vfd = camif_videodev;
> + vfd->lock = &priv->mutex;
> + vfd->queue = &priv->buffer_queue;
> +
> + video_set_drvdata(vfd, priv);
> +
> + v4l2_ctrl_handler_init(&priv->ctrl_hdlr, 0);
> +
> + ret = v4l2_async_register_subdev(&priv->sd);
> + if (ret)
> + goto free_ctrls;
> +
> + return 0;
> +free_ctrls:
> + v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
> + return ret;

A shorter version:

if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);

return ret;

> +}
> +
> +static int camif_remove(struct platform_device *pdev)
> +{
> + struct camif_priv *priv =
> + (struct camif_priv *)platform_get_drvdata(pdev);
> +
> + v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
> + v4l2_async_unregister_subdev(&priv->sd);
> + media_entity_cleanup(&priv->sd.entity);
> + v4l2_device_unregister_subdev(&priv->sd);
> +
> + return 0;
> +}
> +
> +static const struct platform_device_id camif_ids[] = {
> + { .name = DEVICE_NAME },
> + { },
> +};
> +MODULE_DEVICE_TABLE(platform, camif_ids);
> +
> +static 

Re: [PATCH] staging: gdm724x: add forced casts in endian converters to fix sparse warnings

2017-01-04 Thread Eric S. Stone
On Wed, Jan 04, 2017 at 09:59:27AM +0100, Greg KH wrote:
> On Wed, Jan 04, 2017 at 09:54:53AM +0100, Greg KH wrote:
> > On Tue, Jan 03, 2017 at 10:44:17PM -0800, Eric S. Stone wrote:
> > > On Tue, Jan 03, 2017 at 04:30:58PM +0100, Greg KH wrote:
> > > > On Wed, Dec 28, 2016 at 10:08:43PM -0800, Eric S. Stone wrote:
> > > > > The modified functions do explicit endian checking and conversion. The
> > > > > added forced casts fix these sparse warnings:
> > > > > 
> > > > > CHECK   drivers/staging/gdm724x/gdm_endian.c
> > > > > drivers/staging/gdm724x/gdm_endian.c:28:24: warning: incorrect type 
> > > > > in return expression (different base types)
> > > > > drivers/staging/gdm724x/gdm_endian.c:28:24:expected unsigned short
> > > > > drivers/staging/gdm724x/gdm_endian.c:28:24:got restricted __le16 
> > > > > [usertype] 
> > > > > drivers/staging/gdm724x/gdm_endian.c:30:24: warning: incorrect type 
> > > > > in return expression (different base types)
> > > > > drivers/staging/gdm724x/gdm_endian.c:30:24:expected unsigned short
> > > > > drivers/staging/gdm724x/gdm_endian.c:30:24:got restricted __be16 
> > > > > [usertype] 
> > > > > drivers/staging/gdm724x/gdm_endian.c:36:24: warning: cast to 
> > > > > restricted __le16
> > > > > drivers/staging/gdm724x/gdm_endian.c:38:24: warning: cast to 
> > > > > restricted __be16
> > > > > drivers/staging/gdm724x/gdm_endian.c:44:24: warning: incorrect type 
> > > > > in return expression (different base types)
> > > > > drivers/staging/gdm724x/gdm_endian.c:44:24:expected unsigned int
> > > > > drivers/staging/gdm724x/gdm_endian.c:44:24:got restricted __le32 
> > > > > [usertype] 
> > > > > drivers/staging/gdm724x/gdm_endian.c:46:24: warning: incorrect type 
> > > > > in return expression (different base types)
> > > > > drivers/staging/gdm724x/gdm_endian.c:46:24:expected unsigned int
> > > > > drivers/staging/gdm724x/gdm_endian.c:46:24:got restricted __be32 
> > > > > [usertype] 
> > > > > drivers/staging/gdm724x/gdm_endian.c:52:24: warning: cast to 
> > > > > restricted __le32
> > > > > drivers/staging/gdm724x/gdm_endian.c:54:24: warning: cast to 
> > > > > restricted __be32
> > > > > 
> > > > > Signed-off-by: Eric S. Stone 
> > > > > ---
> > > > >  drivers/staging/gdm724x/gdm_endian.c | 16 
> > > > >  1 file changed, 8 insertions(+), 8 deletions(-)
> > > > > 
> > > > > diff --git a/drivers/staging/gdm724x/gdm_endian.c 
> > > > > b/drivers/staging/gdm724x/gdm_endian.c
> > > > > index d7144e7..00ae7a8 100644
> > > > > --- a/drivers/staging/gdm724x/gdm_endian.c
> > > > > +++ b/drivers/staging/gdm724x/gdm_endian.c
> > > > > @@ -25,31 +25,31 @@ void gdm_set_endian(struct gdm_endian *ed, u8 
> > > > > dev_endian)
> > > > >  u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
> > > > >  {
> > > > >   if (ed->dev_ed == ENDIANNESS_LITTLE)
> > > > > - return cpu_to_le16(x);
> > > > > + return (__force u16)cpu_to_le16(x);
> > > > >   else
> > > > > - return cpu_to_be16(x);
> > > > > + return (__force u16)cpu_to_be16(x);
> > > > 
> > > > That's crazy, look at what you are writing here, does it really make any
> > > > sense?
> > > > 
> > > > Please fix this up properly...
> > > > 
> > > > thanks,
> > > > 
> > > > greg k-h
> > > 
> > > Thanks for the feedback and sorry for the Crazy. I'll resubmit using
> > > cpu_to_le16s(u16 *) and friends, avoiding casts. I was trying to keep
> > > the code using the same non-mutating converters it was already using,
> > > but it was a bad tradeoff since those all use the __bitwise annotated
> > > types and we need u16/u32 here. So instead:
> > > 
> > > u16 gdm_cpu_to_dev16(struct gdm_endian *ed, u16 x)
> > > {
> > >   if (ed->dev_ed == ENDIANNESS_LITTLE)
> > >   cpu_to_le16s(&x);
> > >   else
> > >   cpu_to_be16s(&x);
> > >   return x;
> > > }
> > > 
> > > I also tried to alternatively fix the warnings by normalizing the
> > > driver code to one endiannes (getting rid of u16/u32), but since the
> > > different device models have different endianness, conversions of some
> > > sort remain necessary.
> > 
> > Ah, ick, sorry, I was a bit hasty on my review (having to review 300+
> > staging patches all at once does that to you...)
> > 
> > This code is odd, but not unprecidented, there are other drivers that
> > need this.  Let me go see how they handled this type of thing, it might
> > be easier to just copy what they did...
> 
> Ah, and you were right with your first try, look at
> drivers/usb/host/ohci.h and the cpu_to_hc16() function.  Your use of
> __force is right, the only thing I would suggest is adding a new type,
> __dev16 much like the ohci.h file creates __hc16 to keep things a bit
> more obvious what is going on here.
> 
> Can you fix up your original patch much like this?
> 
> thanks, and again, sorry for the complaint on your patch, my fault.
> 
> greg k-h

Agree typedefs would make this clearer, I'll add them in. With

Re: [PATCH v2 15/19] media: imx: Add MIPI CSI-2 Receiver subdev driver

2017-01-04 Thread Vladimir Zapolskiy
On 01/03/2017 10:57 PM, Steve Longerbeam wrote:
> Adds MIPI CSI-2 Receiver subdev driver. This subdev is required
> for sensors with a MIPI CSI2 interface.
> 
> Signed-off-by: Steve Longerbeam 
> ---
>  drivers/staging/media/imx/Makefile|   1 +
>  drivers/staging/media/imx/imx-mipi-csi2.c | 509 
> ++
>  2 files changed, 510 insertions(+)
>  create mode 100644 drivers/staging/media/imx/imx-mipi-csi2.c
> 
> diff --git a/drivers/staging/media/imx/Makefile 
> b/drivers/staging/media/imx/Makefile
> index fe9e992..0decef7 100644
> --- a/drivers/staging/media/imx/Makefile
> +++ b/drivers/staging/media/imx/Makefile
> @@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o
>  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o
>  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
>  obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o
> +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o
> diff --git a/drivers/staging/media/imx/imx-mipi-csi2.c 
> b/drivers/staging/media/imx/imx-mipi-csi2.c
> new file mode 100644
> index 000..84df16e
> --- /dev/null
> +++ b/drivers/staging/media/imx/imx-mipi-csi2.c
> @@ -0,0 +1,509 @@
> +/*
> + * MIPI CSI-2 Receiver Subdev for Freescale i.MX5/6 SOC.
> + *
> + * Copyright (c) 2012-2014 Mentor Graphics Inc.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; either version 2 of the License, or
> + * (at your option) any later version.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 

Please sort the list of headers alphabetically.

> +#include 

Why do you need to include this header?

> +#include 
> +#include "imx-media.h"
> +

[snip]

> +static int imxcsi2_s_stream(struct v4l2_subdev *sd, int enable)
> +{
> + struct imxcsi2_dev *csi2 = sd_to_dev(sd);
> + int i, ret = 0;
> +
> + if (!csi2->src_sd)
> + return -EPIPE;
> + for (i = 0; i < CSI2_NUM_SRC_PADS; i++) {
> + if (csi2->sink_sd[i])
> + break;
> + }
> + if (i >= CSI2_NUM_SRC_PADS)
> + return -EPIPE;
> +
> + v4l2_info(sd, "stream %s\n", enable ? "ON" : "OFF");
> +
> + if (enable && !csi2->stream_on) {
> + clk_prepare_enable(csi2->pix_clk);

It can complicate the design for you, but in general clk_prepare_enable()
can return an error.

> + ret = imxcsi2_dphy_wait(csi2);
> + if (ret)
> + clk_disable_unprepare(csi2->pix_clk);
> + } else if (!enable && csi2->stream_on) {
> + clk_disable_unprepare(csi2->pix_clk);
> + }
> +
> + if (!ret)
> + csi2->stream_on = enable;
> + return ret;
> +}
> +

[snip]

> +
> +static int imxcsi2_parse_endpoints(struct imxcsi2_dev *csi2)
> +{
> + struct device_node *node = csi2->dev->of_node;
> + struct device_node *epnode;
> + struct v4l2_of_endpoint ep;
> + int ret = 0;
> +
> + epnode = of_graph_get_next_endpoint(node, NULL);
> + if (!epnode) {
> + v4l2_err(&csi2->sd, "failed to get endpoint node\n");
> + return -EINVAL;
> + }
> +
> + v4l2_of_parse_endpoint(epnode, &ep);

Do of_node_put(epnode) here and remove 'out' goto label.

> + if (ep.bus_type != V4L2_MBUS_CSI2) {
> + v4l2_err(&csi2->sd, "invalid bus type, must be MIPI CSI2\n");
> + ret = -EINVAL;
> + goto out;
> + }
> +
> + csi2->bus = ep.bus.mipi_csi2;
> +
> + v4l2_info(&csi2->sd, "data lanes: %d\n", csi2->bus.num_data_lanes);
> + v4l2_info(&csi2->sd, "flags: 0x%08x\n", csi2->bus.flags);
> +out:
> + of_node_put(epnode);
> + return ret;
> +}
> +

[snip]

> +static const struct of_device_id imxcsi2_dt_ids[] = {
> + { .compatible = "fsl,imx-mipi-csi2", },
> + { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, imxcsi2_dt_ids);
> +
> +static struct platform_driver imxcsi2_driver = {
> + .driver = {
> + .name = DEVICE_NAME,
> + .owner = THIS_MODULE,

Please drop .owner assignment.

> + .of_match_table = imxcsi2_dt_ids,
> + },
> + .probe = imxcsi2_probe,
> + .remove = imxcsi2_remove,
> +};
> +
> +module_platform_driver(imxcsi2_driver);
> +
> +MODULE_DESCRIPTION("i.MX5/6 MIPI CSI-2 Receiver driver");
> +MODULE_AUTHOR("Steve Longerbeam ");
> +MODULE_LICENSE("GPL");
> +
> 

--
With best wishes,
Vladimir
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: greybus: log: Fix line over 80 characters.

2017-01-04 Thread Emmanuil Chatzipetru
Fix coding style issue caught by checkpatch.pl related to the following
warning:
- CHECK: WARNING: line over 80 characters

While at it, drop the redundant cast in the comparison.

Signed-off-by: Emmanuil Chatzipetru 
---
v2: - As Johan suggested, is better to keep the already two-tab indendation
to be persisent.  Therefore, the 80 line characters limit is fixed by removing
the cast and use "%zu" for format specifier, to remove compiler warnings.
- Moreover, the cast in the comparison is redundant and thus, removed.

 drivers/staging/greybus/log.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/log.c b/drivers/staging/greybus/log.c
index 1a18ab1ff8aa..5c5bedaf69a6 100644
--- a/drivers/staging/greybus/log.c
+++ b/drivers/staging/greybus/log.c
@@ -37,9 +37,9 @@ static int gb_log_request_handler(struct gb_operation *op)
}
receive = op->request->payload;
len = le16_to_cpu(receive->len);
-   if (len != (int)(op->request->payload_size - sizeof(*receive))) {
-   dev_err(dev, "log request wrong size %d vs %d\n", len,
-   (int)(op->request->payload_size - 
sizeof(*receive)));
+   if (len != (op->request->payload_size - sizeof(*receive))) {
+   dev_err(dev, "log request wrong size %d vs %zu\n", len,
+   (op->request->payload_size - sizeof(*receive)));
return -EINVAL;
}
if (len == 0) {
-- 
2.1.4

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


Re: [PATCH 1/2] pwm: Remove pwm_can_sleep()

2017-01-04 Thread kbuild test robot
Hi Thierry,

[auto build test ERROR on pwm/for-next]
[also build test ERROR on v4.10-rc2 next-20170104]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Thierry-Reding/pwm-Remove-pwm_can_sleep/20170104-34
base:   
https://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm.git 
for-next
config: x86_64-randconfig-i0-201701 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers/leds/leds-pwm.c: In function 'led_pwm_add':
>> drivers/leds/leds-pwm.c:115:2: error: implicit declaration of function 
>> 'pwm_can_sleep' [-Werror=implicit-function-declaration]
 led_data->can_sleep = pwm_can_sleep(led_data->pwm);
 ^
   cc1: some warnings being treated as errors

vim +/pwm_can_sleep +115 drivers/leds/leds-pwm.c

5f7b03dc Russell King 2014-04-06  109   ret = 
PTR_ERR(led_data->pwm);
5f7b03dc Russell King 2014-04-06  110   dev_err(dev, "unable to 
request PWM for %s: %d\n",
5f7b03dc Russell King 2014-04-06  111   led->name, ret);
5f7b03dc Russell King 2014-04-06  112   return ret;
5f7b03dc Russell King 2014-04-06  113   }
5f7b03dc Russell King 2014-04-06  114  
5f7b03dc Russell King 2014-04-06 @115   led_data->can_sleep = 
pwm_can_sleep(led_data->pwm);
9aa07625 Jacek Anaszewski 2015-08-20  116   if (!led_data->can_sleep)
9aa07625 Jacek Anaszewski 2015-08-20  117   
led_data->cdev.brightness_set = led_pwm_set;
9aa07625 Jacek Anaszewski 2015-08-20  118   else

:: The code at line 115 was first introduced by commit
:: 5f7b03dc2ab5f4ca16e5d6bc3e6dcd2953c6fede leds: leds-pwm: provide a 
common function to setup a single led-pwm device

:: TO: Russell King 
:: CC: Bryan Wu 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 05/19] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors

2017-01-04 Thread Fabio Estevam
On Tue, Jan 3, 2017 at 6:57 PM, Steve Longerbeam  wrote:

> +   camera: ov5642@3c {
> +   compatible = "ovti,ov5642";
> +   pinctrl-names = "default";
> +   pinctrl-0 = <&pinctrl_ov5642>;
> +   clocks = <&clks IMX6QDL_CLK_CKO>;
> +   clock-names = "xclk";
> +   reg = <0x3c>;
> +   xclk = <2400>;
> +   DOVDD-supply = <&vgen4_reg>; /* 1.8v */
> +   AVDD-supply = <&vgen5_reg>;  /* 2.8v, rev C board is VGEN3
> +   rev B board is VGEN5 */

Please use vgen3 so that by default we have the valid AVDD-supply for
revC boards which is more recent and more the users have access to.

> +   mipi_camera: ov5640@3c {
> +   compatible = "ovti,ov5640_mipi";
> +   pinctrl-names = "default";
> +   pinctrl-0 = <&pinctrl_ov5640>;
> +   reg = <0x3c>;
> +   clocks = <&clks IMX6QDL_CLK_CKO>;
> +   clock-names = "xclk";
> +   xclk = <2400>;
> +   DOVDD-supply = <&vgen4_reg>; /* 1.8v */
> +   AVDD-supply = <&vgen5_reg>;  /* 2.8v, rev C board is VGEN3
> +   rev B board is VGEN5 */

Same here.

> +   pinctrl_ov5640: ov5640grp {
> +   fsl,pins = <
> +   MX6QDL_PAD_SD1_DAT2__GPIO1_IO19 0x8000
> +   MX6QDL_PAD_SD1_CLK__GPIO1_IO20  0x8000

Please avoid all the 0x8000 IOMUX settings and replace them by
their real values.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] staging: greybus: log: Fix line over 80 characters.

2017-01-04 Thread Johan Hovold
On Wed, Jan 04, 2017 at 04:14:45PM +0100, Emmanuil Chatzipetru wrote:
> Fix coding style issue caught by checkpatch.pl related to the following
> warning:
>   - CHECK: WARNING: line over 80 characters

This commit message should be expanded to explain how this is done (e.g.
"by dropping a redundant cast") which may not be obvious in this case.

> While at it, drop the redundant cast in the comparison.

This is now also needed to maintain consistency.

> Signed-off-by: Emmanuil Chatzipetru 
> ---
> v2: - As Johan suggested, is better to keep the already two-tab indendation
> to be persisent.  Therefore, the 80 line characters limit is fixed by removing
> the cast and use "%zu" for format specifier, to remove compiler warnings.
> - Moreover, the cast in the comparison is redundant and thus, removed.

When updating a single patch in a series you should resend the whole
series (all with an increased version indicated by the subject prefix).

If you resend both patches, they should now be at v3 for example.

>  drivers/staging/greybus/log.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/greybus/log.c b/drivers/staging/greybus/log.c
> index 1a18ab1ff8aa..5c5bedaf69a6 100644
> --- a/drivers/staging/greybus/log.c
> +++ b/drivers/staging/greybus/log.c
> @@ -37,9 +37,9 @@ static int gb_log_request_handler(struct gb_operation *op)
>   }
>   receive = op->request->payload;
>   len = le16_to_cpu(receive->len);
> - if (len != (int)(op->request->payload_size - sizeof(*receive))) {
> - dev_err(dev, "log request wrong size %d vs %d\n", len,
> - (int)(op->request->payload_size - 
> sizeof(*receive)));
> + if (len != (op->request->payload_size - sizeof(*receive))) {
> + dev_err(dev, "log request wrong size %d vs %zu\n", len,
> + (op->request->payload_size - sizeof(*receive)));
>   return -EINVAL;
>   }
>   if (len == 0) {

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


[RFC PATCH] scsi: scsi_transport_fc: Create a lightweight option for Virtual FC Hosts.

2017-01-04 Thread Cathy Avery
This patch represents an attempt to resurrect the conversation
based on the submission of patch:

[PATCH 1/1] scsi: storvsc: Support manual scan of FC hosts on Hyper-V
K. Y. Srinivasan kys at microsoft.com
Sat Mar 12 21:52:48 UTC 2016

http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2016-March/087116.html

That patch attempted to address the problem of not being able to scan FC
hosts on a Hyper-V guest via sysfs due to the fact that they did not
contain the complete characteristic set associated with a normal FC host
( missing rports, vports, etc ). These new lightweight hosts as they
were subsequently referred to are not consistent with the current FC
transport model.

The patch below provides a method to reconcile the issue by offering
a lightweight option to the current FC transport class. The new option
is selected by a driver when it indicates it wants the lightweight
transport in fc_function_template. I have included the changes for
storvsc_drv.c in this patch as an example of a driver making use of the
lightweight transport option.

Signed-off-by: Cathy Avery 
---
 drivers/scsi/scsi_transport_fc.c | 125 +--
 drivers/scsi/storvsc_drv.c   |   6 +-
 include/scsi/scsi_transport_fc.h |   1 +
 3 files changed, 123 insertions(+), 9 deletions(-)

diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 03577bd..4adc669 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -50,6 +50,15 @@ static int fc_bsg_hostadd(struct Scsi_Host *, struct 
fc_host_attrs *);
 static int fc_bsg_rportadd(struct Scsi_Host *, struct fc_rport *);
 static void fc_bsg_remove(struct request_queue *);
 static void fc_bsg_goose_queue(struct fc_rport *);
+static int fc_host_lw_setup(struct Scsi_Host *, struct fc_host_attrs *);
+static int fc_host_hw_setup(struct Scsi_Host *, struct fc_host_attrs *);
+static int fc_host_hw_remove(struct fc_host_attrs *);
+static struct scsi_transport_template *
+   fc_attach_lw_transport(struct fc_function_template *);
+static struct scsi_transport_template *
+   fc_attach_hw_transport(struct fc_function_template *);
+static void fc_remove_lw_host(struct Scsi_Host *);
+static void fc_remove_hw_host(struct Scsi_Host *, struct fc_host_attrs *);
 
 /*
  * Module Parameters
@@ -352,6 +361,10 @@ struct fc_internal {
 
 #define to_fc_internal(tmpl)   container_of(tmpl, struct fc_internal, t)
 
+
+static void fc_release_lw_transport(struct fc_internal *);
+static void fc_release_hw_transport(struct fc_internal *);
+
 static int fc_target_setup(struct transport_container *tc, struct device *dev,
   struct device *cdev)
 {
@@ -387,7 +400,26 @@ static int fc_host_setup(struct transport_container *tc, 
struct device *dev,
 {
struct Scsi_Host *shost = dev_to_shost(dev);
struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
+   struct fc_internal *i = to_fc_internal(shost->transportt);
+
+   if (i->f->lightweight_transport)
+   return fc_host_lw_setup(shost, fc_host);
+
+   return fc_host_hw_setup(shost, fc_host);
+}
+
+static int fc_host_lw_setup(struct Scsi_Host *shost,
+   struct fc_host_attrs *fc_host)
+{
+   fc_host->node_name = -1;
+   fc_host->port_name = -1;
+
+   return 0;
+}
 
+static int fc_host_hw_setup(struct Scsi_Host *shost,
+   struct fc_host_attrs *fc_host)
+{
/*
 * Set default values easily detected by the midlayer as
 * failure cases.  The scsi lldd is responsible for initializing
@@ -468,7 +500,16 @@ static int fc_host_remove(struct transport_container *tc, 
struct device *dev,
 {
struct Scsi_Host *shost = dev_to_shost(dev);
struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
+   struct fc_internal *i = to_fc_internal(shost->transportt);
+
+   if (i->f->lightweight_transport)
+   return 0;
 
+   return fc_host_hw_remove(fc_host);
+}
+
+static int fc_host_hw_remove(struct fc_host_attrs *fc_host)
+{
fc_bsg_remove(fc_host->rqst_q);
return 0;
 }
@@ -2175,6 +2216,49 @@ static int fc_it_nexus_response(struct Scsi_Host *shost, 
u64 nexus, int result)
 struct scsi_transport_template *
 fc_attach_transport(struct fc_function_template *ft)
 {
+   if (ft->lightweight_transport)
+   return fc_attach_lw_transport(ft);
+
+   return fc_attach_hw_transport(ft);
+}
+EXPORT_SYMBOL(fc_attach_transport);
+
+
+struct scsi_transport_template *
+fc_attach_lw_transport(struct fc_function_template *ft)
+{
+   int count;
+   struct fc_internal *i;
+
+   i = kzalloc(sizeof(struct fc_internal),
+   GFP_KERNEL);
+
+   if (unlikely(!i))
+   return NULL;
+
+   i->t.host_attrs.ac.attrs = &i->host_attrs[0];
+   i->t.host_attrs.ac.class = &fc_host_class.class;
+   i->t.host_attrs.ac.match = fc_host_match;
+   i

Re: [PATCH v2] staging: greybus: log: Fix line over 80 characters.

2017-01-04 Thread Emmanuil Chatzipetru
Hello,

On Wed, Jan 04, 2017 at 04:26:35PM +0100, Johan Hovold wrote:
> On Wed, Jan 04, 2017 at 04:14:45PM +0100, Emmanuil Chatzipetru wrote:
> > Fix coding style issue caught by checkpatch.pl related to the following
> > warning:
> > - CHECK: WARNING: line over 80 characters
> 
> This commit message should be expanded to explain how this is done (e.g.
> "by dropping a redundant cast") which may not be obvious in this case.
> 
> > While at it, drop the redundant cast in the comparison.
> 
> This is now also needed to maintain consistency.
> 
> > Signed-off-by: Emmanuil Chatzipetru 
> > ---
> > v2: - As Johan suggested, is better to keep the already two-tab indendation
> > to be persisent.  Therefore, the 80 line characters limit is fixed by 
> > removing
> > the cast and use "%zu" for format specifier, to remove compiler warnings.
> > - Moreover, the cast in the comparison is redundant and thus, removed.
> 
> When updating a single patch in a series you should resend the whole
> series (all with an increased version indicated by the subject prefix).
> 
> If you resend both patches, they should now be at v3 for example.

I will update the commit message of the second patch accordingly and resend
the v3 of both patches.

> 
> >  drivers/staging/greybus/log.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/staging/greybus/log.c b/drivers/staging/greybus/log.c
> > index 1a18ab1ff8aa..5c5bedaf69a6 100644
> > --- a/drivers/staging/greybus/log.c
> > +++ b/drivers/staging/greybus/log.c
> > @@ -37,9 +37,9 @@ static int gb_log_request_handler(struct gb_operation *op)
> > }
> > receive = op->request->payload;
> > len = le16_to_cpu(receive->len);
> > -   if (len != (int)(op->request->payload_size - sizeof(*receive))) {
> > -   dev_err(dev, "log request wrong size %d vs %d\n", len,
> > -   (int)(op->request->payload_size - 
> > sizeof(*receive)));
> > +   if (len != (op->request->payload_size - sizeof(*receive))) {
> > +   dev_err(dev, "log request wrong size %d vs %zu\n", len,
> > +   (op->request->payload_size - sizeof(*receive)));
> > return -EINVAL;
> > }
> > if (len == 0) {
> 
> Thanks,
> Johan

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


[PATCH v3 2/2] staging: greybus: log: Fix line over 80 characters.

2017-01-04 Thread Emmanuil Chatzipetru
Fix coding style issue caught by checkpatch.pl related to the following
warning:
- CHECK: WARNING: line over 80 characters
This is done by dropping a redundant cast and by replacing the format specifier
in dev_err(); to "%zu" instead of "%d", in order to silence the warnings of the
compiler.

Also, while at it, drop the redundant cast in the comparison as well to maintain
consistency.

Signed-off-by: Emmanuil Chatzipetru 
---
v2: As Johan suggested, is better to keep the already two-tab indendation
to be persisent.  Therefore, the 80 line characters limit is fixed by removing
the cast and use "%zu" for format specifier, to remove compiler warnings.
- Moreover, the cast in the comparison is redundant and thus, removed.
v3: Update the commit message to be more explanatory according to Johan's
comments.
   - Also, resend both patches this time as a series.

 drivers/staging/greybus/log.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/log.c b/drivers/staging/greybus/log.c
index 1a18ab1ff8aa..5c5bedaf69a6 100644
--- a/drivers/staging/greybus/log.c
+++ b/drivers/staging/greybus/log.c
@@ -37,9 +37,9 @@ static int gb_log_request_handler(struct gb_operation *op)
}
receive = op->request->payload;
len = le16_to_cpu(receive->len);
-   if (len != (int)(op->request->payload_size - sizeof(*receive))) {
-   dev_err(dev, "log request wrong size %d vs %d\n", len,
-   (int)(op->request->payload_size - 
sizeof(*receive)));
+   if (len != (op->request->payload_size - sizeof(*receive))) {
+   dev_err(dev, "log request wrong size %d vs %zu\n", len,
+   (op->request->payload_size - sizeof(*receive)));
return -EINVAL;
}
if (len == 0) {
-- 
2.1.4

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


[PATCH v3 1/2] staging: greybus: audio_topology: Fix spaces between operator and string

2017-01-04 Thread Emmanuil Chatzipetru
Fix coding style issue caught by checkpatch.pl related to the following
warning:
- "CHECK: spaces preferred around that '*' (ctx:VxV) "

Signed-off-by: Emmanuil Chatzipetru 
---
 drivers/staging/greybus/audio_topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/greybus/audio_topology.c 
b/drivers/staging/greybus/audio_topology.c
index 8b216ca99cf9..3001a4971c06 100644
--- a/drivers/staging/greybus/audio_topology.c
+++ b/drivers/staging/greybus/audio_topology.c
@@ -1312,7 +1312,7 @@ static int gbaudio_tplg_process_routes(struct 
gbaudio_module_info *module,
goto error;
}
dev_dbg(module->dev, "Route {%s, %s, %s}\n", dapm_routes->sink,
-   (dapm_routes->control) ? dapm_routes->control:"NULL",
+   (dapm_routes->control) ? dapm_routes->control : "NULL",
dapm_routes->source);
dapm_routes++;
curr++;
-- 
2.1.4

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


Re: [PATCH v3 1/2] staging: greybus: audio_topology: Fix spaces between operator and string

2017-01-04 Thread Johan Hovold
On Wed, Jan 04, 2017 at 05:08:18PM +0100, Emmanuil Chatzipetru wrote:
> Fix coding style issue caught by checkpatch.pl related to the following
> warning:
>   - "CHECK: spaces preferred around that '*' (ctx:VxV) "
> 
> Signed-off-by: Emmanuil Chatzipetru 

Acked-by: Johan Hovold 

> ---
>  drivers/staging/greybus/audio_topology.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/audio_topology.c 
> b/drivers/staging/greybus/audio_topology.c
> index 8b216ca99cf9..3001a4971c06 100644
> --- a/drivers/staging/greybus/audio_topology.c
> +++ b/drivers/staging/greybus/audio_topology.c
> @@ -1312,7 +1312,7 @@ static int gbaudio_tplg_process_routes(struct 
> gbaudio_module_info *module,
>   goto error;
>   }
>   dev_dbg(module->dev, "Route {%s, %s, %s}\n", dapm_routes->sink,
> - (dapm_routes->control) ? dapm_routes->control:"NULL",
> + (dapm_routes->control) ? dapm_routes->control : "NULL",
>   dapm_routes->source);
>   dapm_routes++;
>   curr++;
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 2/2] staging: greybus: log: Fix line over 80 characters.

2017-01-04 Thread Johan Hovold
On Wed, Jan 04, 2017 at 05:08:19PM +0100, Emmanuil Chatzipetru wrote:
> Fix coding style issue caught by checkpatch.pl related to the following
> warning:
>   - CHECK: WARNING: line over 80 characters
> This is done by dropping a redundant cast and by replacing the format 
> specifier
> in dev_err(); to "%zu" instead of "%d", in order to silence the warnings of 
> the
> compiler.
> 
> Also, while at it, drop the redundant cast in the comparison as well to 
> maintain
> consistency.
> 
> Signed-off-by: Emmanuil Chatzipetru 

Acked-by: Johan Hovold 

> ---
> v2: As Johan suggested, is better to keep the already two-tab indendation
> to be persisent.  Therefore, the 80 line characters limit is fixed by removing
> the cast and use "%zu" for format specifier, to remove compiler warnings.
> - Moreover, the cast in the comparison is redundant and thus, removed.
> v3: Update the commit message to be more explanatory according to Johan's
> comments.
>- Also, resend both patches this time as a series.
> 
>  drivers/staging/greybus/log.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/greybus/log.c b/drivers/staging/greybus/log.c
> index 1a18ab1ff8aa..5c5bedaf69a6 100644
> --- a/drivers/staging/greybus/log.c
> +++ b/drivers/staging/greybus/log.c
> @@ -37,9 +37,9 @@ static int gb_log_request_handler(struct gb_operation *op)
>   }
>   receive = op->request->payload;
>   len = le16_to_cpu(receive->len);
> - if (len != (int)(op->request->payload_size - sizeof(*receive))) {
> - dev_err(dev, "log request wrong size %d vs %d\n", len,
> - (int)(op->request->payload_size - 
> sizeof(*receive)));
> + if (len != (op->request->payload_size - sizeof(*receive))) {
> + dev_err(dev, "log request wrong size %d vs %zu\n", len,
> + (op->request->payload_size - sizeof(*receive)));
>   return -EINVAL;
>   }
>   if (len == 0) {
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: Designated initializers, struct randomization and addressing?

2017-01-04 Thread Stephen Hemminger
On Tue, 3 Jan 2017 22:35:26 -0800
Kees Cook  wrote:

> For randstruct and constify, the automatic selection is done on
> structures with only function pointers. (Additional structures can be
> added via a compiler attribute marking.)
> 
> See is_pure_ops_struct():

Is there anyway to use this plugin to identify pure_ops structures not already 
marked as const?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging: rtl8188eu: remove unused function _linked_rx_signal_strehgth_display

2017-01-04 Thread Luca Ceresoli
Not referenced anymore since commit 9fe7b29c6cc1 ("staging: rtl8188eu:
remove unused field bRxRSSIDisplay in struct adapter").

Cc: Greg Kroah-Hartman 
Cc: Larry Finger 
Cc: Ivan Safonov 
Cc: de...@driverdev.osuosl.org
Signed-off-by: Luca Ceresoli 

---

Changes v1 -> v2:
 - rebase on current staging/staging-next, fix conflicts
 - mention the commit that removed bRxRSSIDisplay since it's now
   committed on staging
---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c 
b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
index cdf2e19e77da..514a2010502c 100644
--- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c
@@ -4671,24 +4671,6 @@ void mlmeext_sta_del_event_callback(struct adapter 
*padapter)
 Following are the functions for the timer handlers
 
 */
-void _linked_rx_signal_strehgth_display(struct adapter *padapter);
-void _linked_rx_signal_strehgth_display(struct adapter *padapter)
-{
-   struct mlme_ext_priv*pmlmeext = &padapter->mlmeextpriv;
-  struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
-   u8 mac_id;
-   int UndecoratedSmoothedPWDB;
-
-   if ((pmlmeinfo->state&0x03) == WIFI_FW_STATION_STATE)
-   mac_id = 0;
-   else if ((pmlmeinfo->state&0x03) == _HW_STATE_AP_)
-   mac_id = 2;
-
-   rtw_hal_get_def_var(padapter, HW_DEF_RA_INFO_DUMP, &mac_id);
-
-   rtw_hal_get_def_var(padapter, HAL_DEF_UNDERCORATEDSMOOTHEDPWDB, 
&UndecoratedSmoothedPWDB);
-   DBG_88E("UndecoratedSmoothedPWDB:%d\n", UndecoratedSmoothedPWDB);
-}
 
 static u8 chk_ap_is_alive(struct adapter *padapter, struct sta_info *psta)
 {
-- 
2.7.4

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


staging/fbtft: Backward Device Tree compatibility in a drm version

2017-01-04 Thread Noralf Trønnes

Hi,

I'm working on a drivers/gpu/drm version of drivers/staging/fbtft which
are drivers for tiny, usually SPI connected, displays. Now I'm wondering
if I can be backwards compatible and support Device Trees written for the
fbtft drivers. The main obstacle as I understand it, is the init property
which are values to be written to the controller registers to support a
different panel with the same controller. It even has encoded values for
delays... My understanding is that this is not accepted.
It's in fact a display panel description in the form of register values
and delays.

Here is what a binding doc would look like for one of the fbtft drivers:

* Samsung S6D02A1 Framebuffer Driver

Required properties:
  - compatible: Should be "samsung,s6d02a1".

The node for this driver must be a child node of a SPI controller, hence
all mandatory properties described in ../spi/spi-bus.txt must be specified.

Optional properties:
- dc-gpios:D/C pin used with the 4-wire 8-bit data serial interface mode
- reset-gpios:Reset pin
- led-gpios:Backlight control
- width:Panel width in pixels
- height:Panel height in pixels
- rotate:Panel rotation in degrees counter clockwise (0,90,180,270)
- bgr:Panel is wired as BGR565 instead of RGB565
- buswidth:Bit width of the bus, in the case of SPI: 8 (4-wire) or 9 
(3-wire) bits.
- txbuflen:Size of transfer buffer. Used for little-big endian 
conversion.

- debug:Control debug output to the kernel log
- init:Panel initialization sequence overriding the driver default.
Values OR'ed with:
0x100 - Write the following values to this register.
0x200 - Delay in milliseconds

Example:
mz61581: mz61581@0{
compatible = "samsung,s6d02a1";
reg = <0>;
spi-max-frequency = <12800>;
spi-cpol;
spi-cpha;

width = <320>;
height = <480>;
rotate = <270>;
bgr;
buswidth = <8>;
txbuflen = <32768>;

reset-gpios = <&gpio 15 0>;
dc-gpios = <&gpio 25 0>;
led-gpios = <&gpio 18 0>;

init = <0x1b0 00
0x111
0x2ff
0x1b3 0x02 0x00 0x00 0x00
0x1c0 0x13 0x3b 0x00 0x02 0x00 0x01 0x00 0x43
0x1c1 0x08 0x16 0x08 0x08
0x1c4 0x11 0x07 0x03 0x03
0x1c6 0x00
0x1c8 0x03 0x03 0x13 0x5c 0x03 0x07 0x14 0x08 0x00 0x21 
0x08 0x14 0x07 0x53 0x0c 0x13 0x03 0x03 0x21 0x00

0x135 0x00
0x136 0xa0
0x13a 0x55
0x144 0x00 0x01
0x1d0 0x07 0x07 0x1d 0x03
0x1d1 0x03 0x30 0x10
0x1d2 0x03 0x14 0x04
0x129
0x12c>;

/* This is a workaround to make sure the init sequence slows down 
and doesn't fail */

debug = <3>;
};


Noralf.

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


[PATCH v2 0/4] hv_util: adjust system time smoothly

2017-01-04 Thread Vitaly Kuznetsov
Changes since v1:
- do do_settimeofday64() when ICTIMESYNCFLAG_SYNC flag is present in the
  request (Alex Ng)
- add pr_debug() for the case when do_adjtimex() fails (Alex Ng)

Original description:

With TimeSync version 4 protocol support we started updating system time
continuously through the whole lifetime of Hyper-V guests. Every 5 seconds
there is a time sample from the host which triggers do_settimeofday[64]().
While the time from the host is very accurate such adjustments may cause
issues:
- Time is jumping forward and backward, some applications may misbehave.
- In case an NTP client is run in parallel things may go south, e.g. when
  an NTP client tries to adjust tick/frequency with ADJ_TICK/ADJ_FREQUENCY
  the Hyper-V module will not see this changes and time will oscillate and
  never converge.
- Systemd starts annoying you by printing "Time has been changed" every 5
  seconds to the system log.

With this series I suggest to use do_adjtimex() to adjust time. My tests
show that such method gives equally good time convergence but avoids all
the drawbacks described above.

Vitaly Kuznetsov (4):
  timekeeping: export do_adjtimex() to modules
  hv_util: switch to using timespec64
  hv_util: use do_adjtimex() to update system time
  hv_util: improve time adjustment accuracy by disabling interrupts

 drivers/hv/hv_util.c  | 40 
 kernel/time/timekeeping.c |  1 +
 2 files changed, 37 insertions(+), 4 deletions(-)

-- 
2.9.3

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


[PATCH v2 1/4] timekeeping: export do_adjtimex() to modules

2017-01-04 Thread Vitaly Kuznetsov
While do_adjtimex() is available to userspace via adjtimex syscall it is
not available to modules which may want to implement in-kernel 'NTP
clients'. Hyper-V hv_utils is going to be the first one.

Signed-off-by: Vitaly Kuznetsov 
---
 kernel/time/timekeeping.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index da233cd..ae4f24f 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -2312,6 +2312,7 @@ int do_adjtimex(struct timex *txc)
 
return ret;
 }
+EXPORT_SYMBOL_GPL(do_adjtimex);
 
 #ifdef CONFIG_NTP_PPS
 /**
-- 
2.9.3

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


[PATCH v2 2/4] hv_util: switch to using timespec64

2017-01-04 Thread Vitaly Kuznetsov
do_settimeofday() is deprecated, use do_settimeofday64() instead.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/hv_util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index e770774..94719eb 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -184,7 +184,7 @@ static void hv_set_host_time(struct work_struct *work)
struct adj_time_work*wrk;
s64 host_tns;
u64 newtime;
-   struct timespec host_ts;
+   struct timespec64 host_ts;
 
wrk = container_of(work, struct adj_time_work, work);
 
@@ -203,9 +203,9 @@ static void hv_set_host_time(struct work_struct *work)
newtime += (current_tick - wrk->ref_time);
}
host_tns = (newtime - WLTIMEDELTA) * 100;
-   host_ts = ns_to_timespec(host_tns);
+   host_ts = ns_to_timespec64(host_tns);
 
-   do_settimeofday(&host_ts);
+   do_settimeofday64(&host_ts);
 }
 
 /*
-- 
2.9.3

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


[PATCH v2 3/4] hv_util: use do_adjtimex() to update system time

2017-01-04 Thread Vitaly Kuznetsov
With TimeSync version 4 protocol support we started updating system time
continuously through the whole lifetime of Hyper-V guests. Every 5 seconds
there is a time sample from the host which triggers do_settimeofday[64]().
While the time from the host is very accurate such adjustments may cause
issues:
- Time is jumping forward and backward, some applications may misbehave.
- In case an NTP client is run in parallel things may go south, e.g. when
  an NTP client tries to adjust tick/frequency with ADJ_TICK/ADJ_FREQUENCY
  the Hyper-V module will not see this changes and time will oscillate and
  never converge.
- Systemd starts annoying you by printing "Time has been changed" every 5
  seconds to the system log.

Instead of calling do_settimeofday64() we can pretend being an NTP client
and use do_adjtimex(). Do do_settimeofday64() in case the difference is too
big or ICTIMESYNCFLAG_SYNC flag was set in the request.

Signed-off-by: Vitaly Kuznetsov 
---
Changes since v1:
- do do_settimeofday64() when ICTIMESYNCFLAG_SYNC flag is present in the
  request (Alex Ng)
- add pr_debug() for the case when do_adjtimex() fails (Alex Ng)
---
 drivers/hv/hv_util.c | 32 +---
 1 file changed, 29 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 94719eb..7e97231 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -182,9 +182,11 @@ struct adj_time_work {
 static void hv_set_host_time(struct work_struct *work)
 {
struct adj_time_work*wrk;
-   s64 host_tns;
+   s64 host_tns, our_tns, delta;
u64 newtime;
-   struct timespec64 host_ts;
+   struct timespec64 host_ts, our_ts;
+   struct timex txc = {0};
+   int ret;
 
wrk = container_of(work, struct adj_time_work, work);
 
@@ -205,7 +207,31 @@ static void hv_set_host_time(struct work_struct *work)
host_tns = (newtime - WLTIMEDELTA) * 100;
host_ts = ns_to_timespec64(host_tns);
 
-   do_settimeofday64(&host_ts);
+   getnstimeofday64(&our_ts);
+   our_tns = timespec64_to_ns(&our_ts);
+
+   /* Difference between our time and host time */
+   delta = host_tns - our_tns;
+
+   /*
+* Do raw do_settimeofday64() in case delta is too big or we were
+* ordered to sync our time by the host.
+*/
+   if (abs(delta) > MAXPHASE || wrk->flags & ICTIMESYNCFLAG_SYNC) {
+   do_settimeofday64(&host_ts);
+   return;
+   }
+
+   txc.modes = ADJ_TICK | ADJ_FREQUENCY | ADJ_OFFSET | ADJ_NANO |
+   ADJ_STATUS;
+   txc.tick = TICK_USEC;
+   txc.freq = 0;
+   txc.status = STA_PLL;
+   txc.offset = delta;
+
+   ret = do_adjtimex(&txc);
+   if (ret)
+   pr_debug("Failed to adjust system time: %d\n", ret);
 }
 
 /*
-- 
2.9.3

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


[PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts

2017-01-04 Thread Vitaly Kuznetsov
If we happen to receive interrupts during hv_set_host_time() execution
our adjustments may get inaccurate. Make the whole function atomic.
Unfortunately, we can's call do_settimeofday64() with interrupts
disabled as some cross-CPU work is being done but this call happens
very rarely.

Signed-off-by: Vitaly Kuznetsov 
---
 drivers/hv/hv_util.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 7e97231..4e50a42 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -187,6 +187,9 @@ static void hv_set_host_time(struct work_struct *work)
struct timespec64 host_ts, our_ts;
struct timex txc = {0};
int ret;
+   unsigned long flags;
+
+   local_irq_save(flags);
 
wrk = container_of(work, struct adj_time_work, work);
 
@@ -218,6 +221,7 @@ static void hv_set_host_time(struct work_struct *work)
 * ordered to sync our time by the host.
 */
if (abs(delta) > MAXPHASE || wrk->flags & ICTIMESYNCFLAG_SYNC) {
+   local_irq_restore(flags);
do_settimeofday64(&host_ts);
return;
}
@@ -232,6 +236,8 @@ static void hv_set_host_time(struct work_struct *work)
ret = do_adjtimex(&txc);
if (ret)
pr_debug("Failed to adjust system time: %d\n", ret);
+
+   local_irq_restore(flags);
 }
 
 /*
-- 
2.9.3

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


Re: Designated initializers, struct randomization and addressing?

2017-01-04 Thread Julia Lawall


On Wed, 4 Jan 2017, Stephen Hemminger wrote:

> On Tue, 3 Jan 2017 22:35:26 -0800
> Kees Cook  wrote:
>
> > For randstruct and constify, the automatic selection is done on
> > structures with only function pointers. (Additional structures can be
> > added via a compiler attribute marking.)
> >
> > See is_pure_ops_struct():
>
> Is there anyway to use this plugin to identify pure_ops structures not 
> already marked as const?

Here is a list collected with Coccinelle.  The file names and the line
numbers are the instances of non-const structures.

julia

vpbe_device_ops:
   drivers/media/platform/davinci/vpbe.c:797
mbus_hw_ops:
   drivers/misc/mic/host/mic_boot.c:374
   drivers/misc/mic/card/mic_x100.c:237
fcoe_sysfs_function_template:
   drivers/scsi/fcoe/fcoe.c:160
   drivers/scsi/bnx2fc/bnx2fc_fcoe.c:2812
nfc_phy_ops:
   drivers/nfc/st-nci/spi.c:220
   drivers/nfc/st-nci/i2c.c:205
drm_bridge_funcs:
   drivers/gpu/drm/bridge/adv7511/adv7511_drv.c:831
prm_ll_data:
   arch/arm/mach-omap2/prm2xxx.c:214
   arch/arm/mach-omap2/prm33xx.c:374
ptlrpc_sec_cops:
   drivers/staging/lustre/lustre/ptlrpc/sec_plain.c:969
   drivers/staging/lustre/lustre/ptlrpc/sec_null.c:379
cfg80211_ops:
   drivers/net/wireless/intel/ipw2x00/libipw_module.c:66
fc_rport_operations:
   drivers/scsi/fcoe/fcoe_ctlr.c:2165
thermal_zone_of_device_ops:
   drivers/hwmon/scpi-hwmon.c:93
ui_helpline:
   tools/perf/ui/tui/helpline.c:51
skl_dsp_fw_ops:
   sound/soc/intel/skylake/bxt-sst.c:552
iomap_ops:
   fs/ext4/inode.c:3423
   fs/xfs/xfs_iomap.c:1193
   fs/xfs/xfs_iomap.c:1147
   fs/ext2/inode.c:845
fpga_bridge_ops:
   drivers/fpga/altera-freeze-bridge.c:206
qlcnic_nic_template:
   drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c:82
emitter:
   scripts/dtc/flattree.c:107
   scripts/dtc/flattree.c:233
hist_entry_ops:
   tools/perf/builtin-c2c.c:149
pccard_resource_ops:
   drivers/pcmcia/rsrc_mgr.c:61
mcfqspi_cs_control:
   arch/m68k/coldfire/device.c:308
z8530_irqhandler:
   drivers/net/wan/z85230.c:613
   drivers/net/wan/z85230.c:486
   drivers/net/wan/z85230.c:681
   drivers/net/wan/z85230.c:607
snd_soc_dai_ops:
   sound/soc/pxa/mmp-sspa.c:384
   sound/soc/codecs/max9867.c:354
   sound/soc/codecs/msm8916-wcd-digital.c:791
   sound/soc/codecs/rt5663.c:2861
   drivers/staging/greybus/audio_codec.c:672
amba_pl010_data:
   arch/arm/mach-ep93xx/core.c:172
snd_pcm_ops:
   sound/sh/aica.c:439
   sound/ppc/snd_ps3.c:775
   sound/pci/au88x0/au88x0_pcm.c:442
   sound/pci/sis7019.c:875
   sound/pci/sis7019.c:886
   sound/soc/au1x/dbdma2.c:307
   sound/soc/blackfin/bf5xx-ac97-pcm.c:301
   sound/soc/fsl/mpc5200_dma.c:290
   sound/soc/pxa/pxa2xx-pcm.c:48
   sound/arm/aaci.c:638
   sound/arm/aaci.c:741
   sound/arm/pxa2xx-pcm.c:71
   sound/usb/caiaq/audio.c:341
   sound/usb/line6/playback.c:396
   sound/usb/hiface/pcm.c:516
   sound/atmel/ac97c.c:628
   sound/atmel/ac97c.c:639
   sound/isa/sb/sb8_main.c:575
   sound/isa/sb/sb8_main.c:586
   sound/sparc/cs4231.c:1206
   sound/sparc/cs4231.c:1217
   sound/drivers/vx/vx_pcm.c:876
   sound/drivers/vx/vx_pcm.c:1096
nfc_llc_ops:
   net/nfc/hci/llc_nop.c:85
xpc_interface:
   drivers/misc/sgi-xp/xp_main.c:80
intel_gvt_mpt:
   drivers/gpu/drm/i915/gvt/kvmgt.c:1455
i40iw_device_uk_ops:
   drivers/infiniband/hw/i40iw/i40iw_uk.c:936
radeon_audio_basic_funcs:
   drivers/gpu/drm/radeon/radeon_audio.c:128
   drivers/gpu/drm/radeon/radeon_audio.c:146
   drivers/gpu/drm/radeon/radeon_audio.c:140
   drivers/gpu/drm/radeon/radeon_audio.c:134
vop_hw_ops:
   drivers/misc/mic/card/mic_device.c:312
imx_pwm_data:
   drivers/pwm/pwm-imx.c:261
   drivers/pwm/pwm-imx.c:256
pv_time_ops:
   arch/x86/kernel/paravirt.c:310
smp_ops_t:
   arch/powerpc/platforms/pasemi/setup.c:108
   arch/powerpc/platforms/chrp/smp.c:46
drm_framebuffer_funcs:
   drivers/gpu/drm/drm_fb_cma_helper.c:123
snd_compr_ops:
   sound/soc/soc-compress.c:683
   sound/soc/soc-compress.c:698
   sound/soc/codecs/wm5110.c:2367
drm_plane_funcs:
   drivers/gpu/drm/exynos/exynos_drm_plane.c:172
qed_selftest_ops:
   drivers/net/ethernet/qlogic/qed/qed_main.c:1568
mipi_dsi_host_ops:
   drivers/gpu/drm/msm/dsi/dsi_host.c:1527
i40iw_pd_ops:
   drivers/infiniband/hw/i40iw/i40iw_ctrl.c:4892
m48t86_ops:
   arch/arm/mach-orion5x/ts78xx-setup.c:98
sdhci_ops:
   drivers/mmc/host/sdhci-s3c.c:384
cpu_pm_ops:
   arch/arm/mach-omap2/omap-mpuss-lowpower.c:110
abx500_ops:
   drivers/mfd/ab3100-core.c:392
nfnl_ct_hook:
   net/netfilter/nf_conntrack_netlink.c:2392
md_cluster_operations:
   drivers/md/md-cluster.c:1265
intel_gvt_irq_ops:
   drivers/gpu/drm/i915/gvt/interrupt.c:629
isp_operations:
   drivers/scsi/qla2xxx/qla_os.c:2262
   drivers/scsi/qla2xxx/qla_os.c:2223
   drivers/scsi/qla2xxx/qla_os.c:2145
   drivers/scsi/qla2xxx/qla_os.c:2106
   drivers/scsi/qla2xxx/qla_os.c:2184
   drivers/scsi/qla2xxx/qla_os.c:2301
   drivers/scsi/qla2xxx/qla_os.c:2067
   drivers/scsi/qla2xxx/qla_os.c:2028
   drivers/scsi/qla2xxx/qla_os.c:1989
   drivers/scsi/qla2xxx/qla_os.c:1950
mmp_overlay_ops

Re: [PATCH net-next] net/hyperv: remove use of VLAN_TAG_PRESENT

2017-01-04 Thread Stephen Hemminger
On Wed,  4 Jan 2017 01:07:58 +0100 (CET)
Michał Mirosław  wrote:

> Signed-off-by: Michał Mirosław 

I have a cleaner way of handling this in the receive path for hyperv.
Rather than passing vlan_tci, pass the vlan info
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2 3/4] hv_util: use do_adjtimex() to update system time

2017-01-04 Thread Stephen Hemminger
On Wed,  4 Jan 2017 18:24:38 +0100
Vitaly Kuznetsov  wrote:

> With TimeSync version 4 protocol support we started updating system time
> continuously through the whole lifetime of Hyper-V guests. Every 5 seconds
> there is a time sample from the host which triggers do_settimeofday[64]().
> While the time from the host is very accurate such adjustments may cause
> issues:
> - Time is jumping forward and backward, some applications may misbehave.
> - In case an NTP client is run in parallel things may go south, e.g. when
>   an NTP client tries to adjust tick/frequency with ADJ_TICK/ADJ_FREQUENCY
>   the Hyper-V module will not see this changes and time will oscillate and
>   never converge.
> - Systemd starts annoying you by printing "Time has been changed" every 5
>   seconds to the system log.
> 
> Instead of calling do_settimeofday64() we can pretend being an NTP client
> and use do_adjtimex(). Do do_settimeofday64() in case the difference is too
> big or ICTIMESYNCFLAG_SYNC flag was set in the request.
> 
> Signed-off-by: Vitaly Kuznetsov 
> ---
> Changes since v1:
> - do do_settimeofday64() when ICTIMESYNCFLAG_SYNC flag is present in the
>   request (Alex Ng)
> - add pr_debug() for the case when do_adjtimex() fails (Alex Ng)
> ---
>  drivers/hv/hv_util.c | 32 +---
>  1 file changed, 29 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
> index 94719eb..7e97231 100644
> --- a/drivers/hv/hv_util.c
> +++ b/drivers/hv/hv_util.c
> @@ -182,9 +182,11 @@ struct adj_time_work {
>  static void hv_set_host_time(struct work_struct *work)
>  {
>   struct adj_time_work*wrk;
> - s64 host_tns;
> + s64 host_tns, our_tns, delta;
>   u64 newtime;
> - struct timespec64 host_ts;
> + struct timespec64 host_ts, our_ts;
> + struct timex txc = {0};
> + int ret;
>  
>   wrk = container_of(work, struct adj_time_work, work);
>  
> @@ -205,7 +207,31 @@ static void hv_set_host_time(struct work_struct *work)
>   host_tns = (newtime - WLTIMEDELTA) * 100;
>   host_ts = ns_to_timespec64(host_tns);
>  
> - do_settimeofday64(&host_ts);
> + getnstimeofday64(&our_ts);
> + our_tns = timespec64_to_ns(&our_ts);
> +
> + /* Difference between our time and host time */
> + delta = host_tns - our_tns;

This looks correct to me.
Did you consider using ktime? It provides a cleaner abstraction for handling
nanosecond time resolution.


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


Re: [PATCH v2 4/4] hv_util: improve time adjustment accuracy by disabling interrupts

2017-01-04 Thread Stephen Hemminger
On Wed,  4 Jan 2017 18:24:39 +0100
Vitaly Kuznetsov  wrote:

> If we happen to receive interrupts during hv_set_host_time() execution
> our adjustments may get inaccurate. Make the whole function atomic.
> Unfortunately, we can's call do_settimeofday64() with interrupts
> disabled as some cross-CPU work is being done but this call happens
> very rarely.
> 
> Signed-off-by: Vitaly Kuznetsov 

Ok, the race is between timer interrupts and calling do_adjtimex().
NTP has the same issue already.

The getnstimeofday64() (or ktime_get) return an atomic value.
If a clock tick interrupt happens during this code, then the value
is still correct just old.

If you want to avoid all races here, it looks like it would
be better to get timekeeper_lock and call __do_adjtimex. The existing
code in do_adjtimex() is expecting to be called from a system call
and changing it's assumptions is probably not a good idea.

Rather than calling system call from user space. Maybe better
to provide real kernel API in time subsystem for this use case.
What does KVM do?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Retry infinitely for hypercall

2017-01-04 Thread Long Li
From: Long Li 

Hyper-v host guarantees that a hypercall will succeed. Retry infinitely to 
avoid returning transient failures to upper layer.

Signed-off-by: Long Li 
---
 drivers/hv/connection.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 6ce8b87..4bcb099 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -439,7 +439,6 @@ int vmbus_post_msg(void *buffer, size_t buflen)
 {
union hv_connection_id conn_id;
int ret = 0;
-   int retries = 0;
u32 usec = 1;
 
conn_id.asu32 = 0;
@@ -447,10 +446,10 @@ int vmbus_post_msg(void *buffer, size_t buflen)
 
/*
 * hv_post_message() can have transient failures because of
-* insufficient resources. Retry the operation a couple of
-* times before giving up.
+* insufficient resources. We retry infinitely on these failures
+* because host guarantees hypercall will eventually succeed.
 */
-   while (retries < 20) {
+   while (1) {
ret = hv_post_message(conn_id, 1, buffer, buflen);
 
switch (ret) {
@@ -459,11 +458,11 @@ int vmbus_post_msg(void *buffer, size_t buflen)
 * We could get this if we send messages too
 * frequently.
 */
-   ret = -EAGAIN;
-   break;
case HV_STATUS_INSUFFICIENT_MEMORY:
case HV_STATUS_INSUFFICIENT_BUFFERS:
-   ret = -ENOMEM;
+   /*
+* Temporary failure out of resources
+*/
break;
case HV_STATUS_SUCCESS:
return ret;
@@ -472,12 +471,12 @@ int vmbus_post_msg(void *buffer, size_t buflen)
return -EINVAL;
}
 
-   retries++;
udelay(usec);
if (usec < 2048)
usec *= 2;
}
-   return ret;
+   /* Impossible to get here */
+   BUG_ON(1);
 }
 
 /*
-- 
2.7.4

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


Re: [PATCH] Retry infinitely for hypercall

2017-01-04 Thread Greg KH
On Wed, Jan 04, 2017 at 02:39:31PM -0800, Long Li wrote:
> From: Long Li 
> 
> Hyper-v host guarantees that a hypercall will succeed. Retry infinitely to 
> avoid returning transient failures to upper layer.

Please wrap your changelog at the proper column.

And what happens when the hypercall does not succeed?  How is the kernel
going to recover from that?

> 
> Signed-off-by: Long Li 
> ---
>  drivers/hv/connection.c | 17 -
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index 6ce8b87..4bcb099 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -439,7 +439,6 @@ int vmbus_post_msg(void *buffer, size_t buflen)
>  {
>   union hv_connection_id conn_id;
>   int ret = 0;
> - int retries = 0;
>   u32 usec = 1;
>  
>   conn_id.asu32 = 0;
> @@ -447,10 +446,10 @@ int vmbus_post_msg(void *buffer, size_t buflen)
>  
>   /*
>* hv_post_message() can have transient failures because of
> -  * insufficient resources. Retry the operation a couple of
> -  * times before giving up.
> +  * insufficient resources. We retry infinitely on these failures
> +  * because host guarantees hypercall will eventually succeed.
>*/
> - while (retries < 20) {
> + while (1) {
>   ret = hv_post_message(conn_id, 1, buffer, buflen);
>  
>   switch (ret) {
> @@ -459,11 +458,11 @@ int vmbus_post_msg(void *buffer, size_t buflen)
>* We could get this if we send messages too
>* frequently.
>*/
> - ret = -EAGAIN;
> - break;

Document you are falling through please, otherwise someone will "fix"
this later.

>   case HV_STATUS_INSUFFICIENT_MEMORY:
>   case HV_STATUS_INSUFFICIENT_BUFFERS:
> - ret = -ENOMEM;
> + /*
> +  * Temporary failure out of resources
> +  */
>   break;
>   case HV_STATUS_SUCCESS:
>   return ret;
> @@ -472,12 +471,12 @@ int vmbus_post_msg(void *buffer, size_t buflen)
>   return -EINVAL;
>   }
>  
> - retries++;
>   udelay(usec);
>   if (usec < 2048)
>   usec *= 2;
>   }
> - return ret;
> + /* Impossible to get here */
> + BUG_ON(1);

If it is impossible, why do you have this line at all?

What is this trying to solve?  Do you need to increase the time spent
waiting?  We all know things break, please allow the kernel to stay
alive if at all possible.

thanks,

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


Re: [PATCH] Retry infinitely for hypercall

2017-01-04 Thread Dan Carpenter
Fix the subsystem prefix in the subject.

On Wed, Jan 04, 2017 at 02:39:31PM -0800, Long Li wrote:
> From: Long Li 
> 
> Hyper-v host guarantees that a hypercall will succeed. Retry infinitely to 
> avoid returning transient failures to upper layer.
> 
> Signed-off-by: Long Li 
> ---
>  drivers/hv/connection.c | 17 -
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index 6ce8b87..4bcb099 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -439,7 +439,6 @@ int vmbus_post_msg(void *buffer, size_t buflen)
>  {
>   union hv_connection_id conn_id;
>   int ret = 0;

Btw, when you disable GCC's uninitialized variable checking by storing
bogus values in "ret", it's eventually going to bite you in the bum.
Eventually you're going to get a bug that should have been detected
through static analysis if only you hadn't disabled it.

> - int retries = 0;
>   u32 usec = 1;
>  
>   conn_id.asu32 = 0;
> @@ -447,10 +446,10 @@ int vmbus_post_msg(void *buffer, size_t buflen)
>  
>   /*
>* hv_post_message() can have transient failures because of
> -  * insufficient resources. Retry the operation a couple of
> -  * times before giving up.
> +  * insufficient resources. We retry infinitely on these failures
> +  * because host guarantees hypercall will eventually succeed.
>*/
> - while (retries < 20) {
> + while (1) {
>   ret = hv_post_message(conn_id, 1, buffer, buflen);
>  
>   switch (ret) {
> @@ -459,11 +458,11 @@ int vmbus_post_msg(void *buffer, size_t buflen)
>* We could get this if we send messages too
>* frequently.
>*/

Move the comment above the code it's commenting about.

/* 
 * We could get INVALID_CONNECTION_ID if we flood the
 * host with too many messages.
 */
case HV_STATUS_INVALID_CONNECTION_ID:
case HV_STATUS_INSUFFICIENT_MEMORY:
case HV_STATUS_INSUFFICIENT_BUFFERS:
break;



> - ret = -EAGAIN;
> - break;
>   case HV_STATUS_INSUFFICIENT_MEMORY:
>   case HV_STATUS_INSUFFICIENT_BUFFERS:
> - ret = -ENOMEM;
> + /*
> +  * Temporary failure out of resources
> +  */
>   break;
>   case HV_STATUS_SUCCESS:
>   return ret;

return 0;

Better to be more explicit.  When I looked at this I got briefly
confused if this function was supposed to return HV_ statuses or
standard kernel error codes.  It turns out that HV_STATUS_SUCCESS is
zero the success returns map directly to linux kernel code for success
but it's clearer to be explicit.

> @@ -472,12 +471,12 @@ int vmbus_post_msg(void *buffer, size_t buflen)
>   return -EINVAL;
>   }
  
> - retries++;
>   udelay(usec);
>   if (usec < 2048)
>   usec *= 2;
>   }
> - return ret;
> + /* Impossible to get here */
> + BUG_ON(1);

Remove the comment and the BUG_ON().

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


RE: [PATCH] Retry infinitely for hypercall

2017-01-04 Thread Long Li


> -Original Message-
> From: Greg KH [mailto:g...@kroah.com]
> Sent: Wednesday, January 4, 2017 12:51 PM
> To: Long Li 
> Cc: KY Srinivasan ; Haiyang Zhang
> ; de...@linuxdriverproject.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] Retry infinitely for hypercall
> 
> On Wed, Jan 04, 2017 at 02:39:31PM -0800, Long Li wrote:
> > From: Long Li 
> >
> > Hyper-v host guarantees that a hypercall will succeed. Retry infinitely to
> avoid returning transient failures to upper layer.
> 
> Please wrap your changelog at the proper column.

Will do in V2.
> 
> And what happens when the hypercall does not succeed?  How is the kernel
> going to recover from that?

Sorry I should have used better wording in the patch. It should be "Retry 
infinitely on transient failures for hypercall". The host guarantees that it 
will return something other than transient failures in a reasonable small time 
frame. I will fix the comment in V2.

> 
> >
> > Signed-off-by: Long Li 
> > ---
> >  drivers/hv/connection.c | 17 -
> >  1 file changed, 8 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index
> > 6ce8b87..4bcb099 100644
> > --- a/drivers/hv/connection.c
> > +++ b/drivers/hv/connection.c
> > @@ -439,7 +439,6 @@ int vmbus_post_msg(void *buffer, size_t buflen)  {
> > union hv_connection_id conn_id;
> > int ret = 0;
> > -   int retries = 0;
> > u32 usec = 1;
> >
> > conn_id.asu32 = 0;
> > @@ -447,10 +446,10 @@ int vmbus_post_msg(void *buffer, size_t buflen)
> >
> > /*
> >  * hv_post_message() can have transient failures because of
> > -* insufficient resources. Retry the operation a couple of
> > -* times before giving up.
> > +* insufficient resources. We retry infinitely on these failures
> > +* because host guarantees hypercall will eventually succeed.
> >  */
> > -   while (retries < 20) {
> > +   while (1) {
> > ret = hv_post_message(conn_id, 1, buffer, buflen);
> >
> > switch (ret) {
> > @@ -459,11 +458,11 @@ int vmbus_post_msg(void *buffer, size_t buflen)
> >  * We could get this if we send messages too
> >  * frequently.
> >  */
> > -   ret = -EAGAIN;
> > -   break;
> 
> Document you are falling through please, otherwise someone will "fix"
> this later.
Will add comment in V2.

> 
> > case HV_STATUS_INSUFFICIENT_MEMORY:
> > case HV_STATUS_INSUFFICIENT_BUFFERS:
> > -   ret = -ENOMEM;
> > +   /*
> > +* Temporary failure out of resources
> > +*/
> > break;
> > case HV_STATUS_SUCCESS:
> > return ret;
> > @@ -472,12 +471,12 @@ int vmbus_post_msg(void *buffer, size_t buflen)
> > return -EINVAL;
> > }
> >
> > -   retries++;
> > udelay(usec);
> > if (usec < 2048)
> > usec *= 2;
> > }
> > -   return ret;
> > +   /* Impossible to get here */
> > +   BUG_ON(1);
> 
> If it is impossible, why do you have this line at all?

I will remove this line. There is no way for the code to get here.

> 
> What is this trying to solve?  Do you need to increase the time spent waiting?
> We all know things break, please allow the kernel to stay alive if at all
> possible.

The purpose is to wait until the host returns a non-transient status code for a 
hypercall. However, we don't know how many transient failures we are getting 
before the host returns a final status code. So use the infinite loop to wait 
until the host returns the final status code.

Thanks for reviewing. I will send V2 to address the comment.

Long

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


RE: [PATCH] Retry infinitely for hypercall

2017-01-04 Thread Long Li


> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Wednesday, January 4, 2017 1:48 PM
> To: Long Li 
> Cc: KY Srinivasan ; Haiyang Zhang
> ; de...@linuxdriverproject.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] Retry infinitely for hypercall
> 
> Fix the subsystem prefix in the subject.
> 
> On Wed, Jan 04, 2017 at 02:39:31PM -0800, Long Li wrote:
> > From: Long Li 
> >
> > Hyper-v host guarantees that a hypercall will succeed. Retry infinitely to
> avoid returning transient failures to upper layer.
> >
> > Signed-off-by: Long Li 
> > ---
> >  drivers/hv/connection.c | 17 -
> >  1 file changed, 8 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index
> > 6ce8b87..4bcb099 100644
> > --- a/drivers/hv/connection.c
> > +++ b/drivers/hv/connection.c
> > @@ -439,7 +439,6 @@ int vmbus_post_msg(void *buffer, size_t buflen)  {
> > union hv_connection_id conn_id;
> > int ret = 0;
> 
> Btw, when you disable GCC's uninitialized variable checking by storing bogus
> values in "ret", it's eventually going to bite you in the bum.
> Eventually you're going to get a bug that should have been detected through
> static analysis if only you hadn't disabled it.
> 
> > -   int retries = 0;
> > u32 usec = 1;
> >
> > conn_id.asu32 = 0;
> > @@ -447,10 +446,10 @@ int vmbus_post_msg(void *buffer, size_t buflen)
> >
> > /*
> >  * hv_post_message() can have transient failures because of
> > -* insufficient resources. Retry the operation a couple of
> > -* times before giving up.
> > +* insufficient resources. We retry infinitely on these failures
> > +* because host guarantees hypercall will eventually succeed.
> >  */
> > -   while (retries < 20) {
> > +   while (1) {
> > ret = hv_post_message(conn_id, 1, buffer, buflen);
> >
> > switch (ret) {
> > @@ -459,11 +458,11 @@ int vmbus_post_msg(void *buffer, size_t buflen)
> >  * We could get this if we send messages too
> >  * frequently.
> >  */
> 
> Move the comment above the code it's commenting about.
> 
>   /*
>* We could get INVALID_CONNECTION_ID if we flood the
>* host with too many messages.
>*/
>   case HV_STATUS_INVALID_CONNECTION_ID:
>   case HV_STATUS_INSUFFICIENT_MEMORY:
>   case HV_STATUS_INSUFFICIENT_BUFFERS:
>   break;
> 
> 
> 
> > -   ret = -EAGAIN;
> > -   break;
> > case HV_STATUS_INSUFFICIENT_MEMORY:
> > case HV_STATUS_INSUFFICIENT_BUFFERS:
> > -   ret = -ENOMEM;
> > +   /*
> > +* Temporary failure out of resources
> > +*/
> > break;
> > case HV_STATUS_SUCCESS:
> > return ret;
> 
>   return 0;
> 
> Better to be more explicit.  When I looked at this I got briefly confused if 
> this
> function was supposed to return HV_ statuses or standard kernel error
> codes.  It turns out that HV_STATUS_SUCCESS is zero the success returns
> map directly to linux kernel code for success but it's clearer to be explicit.
> 
> > @@ -472,12 +471,12 @@ int vmbus_post_msg(void *buffer, size_t buflen)
> > return -EINVAL;
> > }
> 
> > -   retries++;
> > udelay(usec);
> > if (usec < 2048)
> > usec *= 2;
> > }
> > -   return ret;
> > +   /* Impossible to get here */
> > +   BUG_ON(1);
> 
> Remove the comment and the BUG_ON().
> 
> regards,
> dan carpenter

Thanks, I will fix those in V2.

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


Re: Designated initializers, struct randomization and addressing?

2017-01-04 Thread Kees Cook
On Wed, Jan 4, 2017 at 8:55 AM, Stephen Hemminger
 wrote:
> On Tue, 3 Jan 2017 22:35:26 -0800
> Kees Cook  wrote:
>
>> For randstruct and constify, the automatic selection is done on
>> structures with only function pointers. (Additional structures can be
>> added via a compiler attribute marking.)
>>
>> See is_pure_ops_struct():
>
> Is there anyway to use this plugin to identify pure_ops structures not 
> already marked as const?

That's what the constify plugin does, yes. Though to deal with cases
where something rarely written to, the
pax_open_kernel/pax_close_kernel annotations are needed, which is why
I don't have a sane port of the constify plugin yet. We need to build
upstream-acceptable infrastructure for the write-rarely case. But, as
Julia replied, yes, there's a huge list. :)

-Kees

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


[PATCH] Staging: ks7010: style fix, long lines

2017-01-04 Thread Derek Robson
Debug code had very long lines.
Reworked code to use several prints rather than one big print.

Signed-off-by: Derek Robson 
---
 drivers/staging/ks7010/ks_hostif.c | 32 +---
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/ks7010/ks_hostif.c 
b/drivers/staging/ks7010/ks_hostif.c
index 1fbd495e5e63..70f8565acbeb 100644
--- a/drivers/staging/ks7010/ks_hostif.c
+++ b/drivers/staging/ks7010/ks_hostif.c
@@ -190,13 +190,31 @@ int get_current_ap(struct ks_wlan_private *priv, struct 
link_ap_info_t *ap_info)
wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL);
}
DPRINTK(4, "\nLink AP\n");
-   DPRINTK(4, "bssid=%02X:%02X:%02X:%02X:%02X:%02X\n \
-   essid=%s\nrate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n
channel=%d\n \
-   rssi=%d\nsq=%d\ncapability=%04X\n", ap->bssid[0], ap->bssid[1], 
ap->bssid[2], ap->bssid[3], ap->bssid[4], ap->bssid[5], &(ap->ssid.body[0]), 
ap->rate_set.body[0], ap->rate_set.body[1], ap->rate_set.body[2], 
ap->rate_set.body[3], ap->rate_set.body[4], ap->rate_set.body[5], 
ap->rate_set.body[6], ap->rate_set.body[7], ap->channel, ap->rssi, ap->sq, 
ap->capability);
-   DPRINTK(4, "\nLink AP\nrsn.mode=%d\nrsn.size=%d\n",
-   ap_info->rsn_mode, ap_info->rsn.size);
-   DPRINTK(4, "\next_rate_set_size=%d\nrate_set_size=%d\n",
-   ap_info->ext_rate_set.size, ap_info->rate_set.size);
+   DPRINTK(4, "bssid=");
+   DPRINTK(4, "%02X:", ap->bssid[0]);
+   DPRINTK(4, "%02X:", ap->bssid[1]);
+   DPRINTK(4, "%02X:", ap->bssid[2]);
+   DPRINTK(4, "%02X:", ap->bssid[3]);
+   DPRINTK(4, "%02X:", ap->bssid[4]);
+   DPRINTK(4, "%02X\n", ap->bssid[5]);
+   DPRINTK(4, "essid=%s\n", &ap->ssid.body[0]);
+   DPRINTK(4, "rate_set=");
+   DPRINTK(4, "%02X:", ap->rate_set.body[0]);
+   DPRINTK(4, "%02X:", ap->rate_set.body[1]);
+   DPRINTK(4, "%02X:", ap->rate_set.body[2]);
+   DPRINTK(4, "%02X:", ap->rate_set.body[3]);
+   DPRINTK(4, "%02X:", ap->rate_set.body[4]);
+   DPRINTK(4, "%02X:", ap->rate_set.body[5]);
+   DPRINTK(4, "%02X:", ap->rate_set.body[6]);
+   DPRINTK(4, "%02X\n", ap->rate_set.body[7]);
+   DPRINTK(4, "channel=%d\n", ap->channel);
+   DPRINTK(4, "rssi=%d\n", ap->rssi);
+   DPRINTK(4, "sq=%d\n", ap->sq);
+   DPRINTK(4, "capability=%04X\n\n", ap->capability);
+   DPRINTK(4, "Link AP\nrsn.mode=%d\n", ap_info->rsn_mode);
+   DPRINTK(4, "rsn.size=%d\n\n", ap_info->rsn.size);
+   DPRINTK(4, "ext_rate_set_size=%d\n", ap_info->ext_rate_set.size);
+   DPRINTK(4, "rate_set_size=%d\n", ap_info->rate_set.size);
 
return rc;
 }
-- 
2.11.0

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


[PATCH v2] hv: retry infinitely on hypercall transient failures

2017-01-04 Thread Long Li
From: Long Li 

Hyper-v host guarantees that a hypercall will finish in reasonable time.
Retry infinitely on transient failures to avoid returning error to upper layer.

Signed-off-by: Long Li 
---
 drivers/hv/connection.c | 30 ++
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index 6ce8b87..4b3cfde 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -438,46 +438,44 @@ void vmbus_on_event(unsigned long data)
 int vmbus_post_msg(void *buffer, size_t buflen)
 {
union hv_connection_id conn_id;
-   int ret = 0;
-   int retries = 0;
+   int ret;
u32 usec = 1;
 
conn_id.asu32 = 0;
conn_id.u.id = VMBUS_MESSAGE_CONNECTION_ID;
 
/*
-* hv_post_message() can have transient failures because of
-* insufficient resources. Retry the operation a couple of
-* times before giving up.
+* hv_post_message() can have transient failures. We retry infinitely
+* on these failures because host guarantees hypercall will finish.
 */
-   while (retries < 20) {
+   while (1) {
ret = hv_post_message(conn_id, 1, buffer, buflen);
 
switch (ret) {
+   /*
+* Retry on transient failures:
+* 1. HV_STATUS_INVALID_CONNECTION_ID:
+*We send messages too frequently.
+*
+* 2. HV_STATUS_INSUFFICIENT_MEMORY and
+*HV_STATUS_INSUFFICIENT_BUFFERS:
+*The host is temporariliy running out of resources.
+*/
case HV_STATUS_INVALID_CONNECTION_ID:
-   /*
-* We could get this if we send messages too
-* frequently.
-*/
-   ret = -EAGAIN;
-   break;
case HV_STATUS_INSUFFICIENT_MEMORY:
case HV_STATUS_INSUFFICIENT_BUFFERS:
-   ret = -ENOMEM;
break;
case HV_STATUS_SUCCESS:
-   return ret;
+   return 0;
default:
pr_err("hv_post_msg() failed; error code:%d\n", ret);
return -EINVAL;
}
 
-   retries++;
udelay(usec);
if (usec < 2048)
usec *= 2;
}
-   return ret;
 }
 
 /*
-- 
2.7.4

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


[PATCH 0/2] Fixes coding style

2017-01-04 Thread Scott Matheina
The patch series addresses some coding style issues contained within the file.

Scott Matheina (2):
  drivers/staging/rtl8188eu/core/rtw_ap.c un-necessary parenthesis
  drivers/staging/rtl8188eu/core/rtw_ap.c Alignment should match open
parenthesis

 drivers/staging/rtl8188eu/core/rtw_ap.c | 144 
 1 file changed, 71 insertions(+), 73 deletions(-)

--
2.7.4

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


[PATCH 1/2] drivers/staging/rtl8188eu/core/rtw_ap.c un-necessary parenthesis

2017-01-04 Thread Scott Matheina
Fixed coding style issue, un-necessary parenthesis present

Signed-off-by: Scott Matheina 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 106 
 1 file changed, 53 insertions(+), 53 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 553e8d5..396b948 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -26,7 +26,7 @@
 
 void init_mlme_ap_info(struct adapter *padapter)
 {
-   struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct sta_priv *pstapriv = &padapter->stapriv;
struct wlan_acl_pool *pacl_list = &pstapriv->acl_list;
 
@@ -43,7 +43,7 @@ void free_mlme_ap_info(struct adapter *padapter)
 {
struct sta_info *psta = NULL;
struct sta_priv *pstapriv = &padapter->stapriv;
-   struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
 
@@ -59,17 +59,17 @@ void free_mlme_ap_info(struct adapter *padapter)
 
/* free bc/mc sta_info */
psta = rtw_get_bcmc_stainfo(padapter);
-   spin_lock_bh(&(pstapriv->sta_hash_lock));
+   spin_lock_bh(&pstapriv->sta_hash_lock);
rtw_free_stainfo(padapter, psta);
-   spin_unlock_bh(&(pstapriv->sta_hash_lock));
+   spin_unlock_bh(&pstapriv->sta_hash_lock);
 }
 
 static void update_BCNTIM(struct adapter *padapter)
 {
struct sta_priv *pstapriv = &padapter->stapriv;
-   struct mlme_ext_priv *pmlmeext = &(padapter->mlmeextpriv);
-   struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
-   struct wlan_bssid_ex *pnetwork_mlmeext = &(pmlmeinfo->network);
+   struct mlme_ext_priv *pmlmeext = &padapter->mlmeextpriv;
+   struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info;
+   struct wlan_bssid_ex *pnetwork_mlmeext = &pmlmeinfo->network;
unsigned char *pie = pnetwork_mlmeext->IEs;
u8 *p, *dst_ie, *premainder_ie = NULL;
u8 *pbackup_remainder_ie = NULL;
@@ -310,9 +310,9 @@ voidexpire_timeout_chk(struct adapter *padapter)
 
spin_unlock_bh(&pstapriv->auth_list_lock);
 
-   spin_lock_bh(&(pstapriv->sta_hash_lock));
+   spin_lock_bh(&pstapriv->sta_hash_lock);
rtw_free_stainfo(padapter, psta);
-   spin_unlock_bh(&(pstapriv->sta_hash_lock));
+   spin_unlock_bh(&pstapriv->sta_hash_lock);
 
spin_lock_bh(&pstapriv->auth_list_lock);
}
@@ -456,7 +456,7 @@ void add_RATid(struct adapter *padapter, struct sta_info 
*psta, u8 rssi_level)
unsigned char limit;
unsigned int tx_ra_bitmap = 0;
struct ht_priv  *psta_ht = NULL;
-   struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex 
*)&pmlmepriv->cur_network.network;
 
if (psta)
@@ -548,7 +548,7 @@ static void update_bmc_sta(struct adapter *padapter)
unsigned char   network_type, raid;
int i, supportRateNum = 0;
unsigned int tx_ra_bitmap = 0;
-   struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *pcur_network = (struct wlan_bssid_ex 
*)&pmlmepriv->cur_network.network;
struct sta_info *psta = rtw_get_bcmc_stainfo(padapter);
 
@@ -630,9 +630,9 @@ static void update_bmc_sta(struct adapter *padapter)
 
 void update_sta_info_apmode(struct adapter *padapter, struct sta_info *psta)
 {
-   struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+   struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct security_priv *psecuritypriv = &padapter->securitypriv;
-   struct mlme_ext_priv*pmlmeext = &(padapter->mlmeextpriv);
+   struct mlme_ext_priv*pmlmeext = &padapter->mlmeextpriv;
struct ht_priv  *phtpriv_ap = &pmlmepriv->htpriv;
struct ht_priv  *phtpriv_sta = &psta->htpriv;
 
@@ -700,7 +700,7 @@ static void update_hw_ht_param(struct adapter *padapter)
unsigned char   max_AMPDU_len;
unsigned char   min_MPDU_spacing;
struct mlme_ext_priv*pmlmeext = &padapter->mlmeextpriv;
-   struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info);
+   struct mlme_ext_info*pmlmeinfo = &pmlmeext->mlmext_info;
 
DBG_88E("%s\n", __func__);
 
@@ -733,12 +733,12 @@ static void start_bss_network(struct adapter *padapter, 
u8 *pbuf)
u32 acparm;
int ie_len;
struct registry_priv *pregpriv = &padap

[PATCH 2/2] drivers/staging/rtl8188eu/core/rtw_ap.c Alignment should match open parenthesis

2017-01-04 Thread Scott Matheina
Fixed style issue: Alignment should match open parenthesis throughout file

Signed-off-by: Scott Matheina 
---
 drivers/staging/rtl8188eu/core/rtw_ap.c | 38 -
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c 
b/drivers/staging/rtl8188eu/core/rtw_ap.c
index 396b948..1c8fa3a 100644
--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
+++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
@@ -94,10 +94,9 @@ static void update_BCNTIM(struct adapter *padapter)
offset += pnetwork_mlmeext->Ssid.SsidLength + 2;
 
/*  get supported rates len */
-   p = rtw_get_ie(pie + _BEACON_IE_OFFSET_,
-   _SUPPORTEDRATES_IE_, &tmp_len,
-   (pnetwork_mlmeext->IELength -
-   _BEACON_IE_OFFSET_));
+   p = rtw_get_ie(pie + _BEACON_IE_OFFSET_, _SUPPORTEDRATES_IE_,
+  &tmp_len, (pnetwork_mlmeext->IELength -
+ _BEACON_IE_OFFSET_));
if (p)
offset += tmp_len+2;
 
@@ -116,13 +115,12 @@ static void update_BCNTIM(struct adapter *padapter)
if (remainder_ielen > 0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
-   memcpy(pbackup_remainder_ie,
-   premainder_ie, remainder_ielen);
+   memcpy(pbackup_remainder_ie, premainder_ie,
+  remainder_ielen);
}
*dst_ie++ = _TIM_IE_;
 
-   if ((pstapriv->tim_bitmap&0xff00) &&
-   (pstapriv->tim_bitmap&0x00fc))
+   if ((pstapriv->tim_bitmap&0xff00) && (pstapriv->tim_bitmap&0x00fc))
tim_ielen = 5;
else
tim_ielen = 4;
@@ -157,7 +155,7 @@ static void update_BCNTIM(struct adapter *padapter)
 }
 
 void rtw_add_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex *pnetwork,
-   u8 index, u8 *data, u8 len)
+   u8 index, u8 *data, u8 len)
 {
struct ndis_802_11_var_ie *pIE;
u8 bmatch = false;
@@ -201,8 +199,8 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct 
wlan_bssid_ex *pnetwork,
if (remainder_ielen > 0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
-   memcpy(pbackup_remainder_ie,
-   premainder_ie, remainder_ielen);
+   memcpy(pbackup_remainder_ie, premainder_ie,
+  remainder_ielen);
}
 
*dst_ie++ = index;
@@ -223,7 +221,7 @@ void rtw_add_bcn_ie(struct adapter *padapter, struct 
wlan_bssid_ex *pnetwork,
 }
 
 void rtw_remove_bcn_ie(struct adapter *padapter, struct wlan_bssid_ex 
*pnetwork,
-   u8 index)
+  u8 index)
 {
u8 *p, *dst_ie = NULL, *premainder_ie = NULL;
u8 *pbackup_remainder_ie = NULL;
@@ -247,8 +245,8 @@ void rtw_remove_bcn_ie(struct adapter *padapter, struct 
wlan_bssid_ex *pnetwork,
if (remainder_ielen > 0) {
pbackup_remainder_ie = rtw_malloc(remainder_ielen);
if (pbackup_remainder_ie && premainder_ie)
-   memcpy(pbackup_remainder_ie,
-   premainder_ie, remainder_ielen);
+   memcpy(pbackup_remainder_ie, premainder_ie,
+  remainder_ielen);
}
 
/* copy remainder IE */
@@ -361,8 +359,8 @@ voidexpire_timeout_chk(struct adapter *padapter)
 * for this station
 */
pstapriv->tim_bitmap |= BIT(psta->aid);
-   update_beacon(padapter, _TIM_IE_,
-   NULL, false);
+   update_beacon(padapter, _TIM_IE_, NULL,
+ false);
 
if (!pmlmeext->active_keep_alive_check)
continue;
@@ -1573,8 +1571,8 @@ void bss_cap_update_on_sta_join(struct adapter *padapter, 
struct sta_info *psta)
pmlmepriv->num_sta_ht_no_gf++;
}
DBG_88E("%s STA %pM - no greenfield, num of non-gf 
stations %d\n",
-  __func__, (psta->hwaddr),
-  pmlmepriv->num_sta_ht_no_gf);
+   __func__, (psta->hwaddr),
+   pmlmepriv->num_sta_ht_no_gf);
}
 
if ((ht_capab & IEEE

[PATCH] hv: use substraction to update ring buffer index

2017-01-04 Thread Long Li
From: Long Li 

The ring buffer code uses %= to calculate index. For x86/64, %= compiles to
div, more than 10 times slower than sub.

Replace div with sub for this data heavy code path.

Signed-off-by: Long Li 
---
 drivers/hv/ring_buffer.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c
index cd49cb1..f8eee6e 100644
--- a/drivers/hv/ring_buffer.c
+++ b/drivers/hv/ring_buffer.c
@@ -135,7 +135,8 @@ hv_get_next_readlocation_withoffset(struct 
hv_ring_buffer_info *ring_info,
u32 next = ring_info->ring_buffer->read_index;
 
next += offset;
-   next %= ring_info->ring_datasize;
+   if (next >= ring_info->ring_datasize)
+   next -= ring_info->ring_datasize;
 
return next;
 }
@@ -179,7 +180,8 @@ static u32 hv_copyfrom_ringbuffer(
memcpy(dest, ring_buffer + start_read_offset, destlen);
 
start_read_offset += destlen;
-   start_read_offset %= ring_buffer_size;
+   if (start_read_offset >= ring_buffer_size)
+   start_read_offset -= ring_buffer_size;
 
return start_read_offset;
 }
@@ -201,7 +203,8 @@ static u32 hv_copyto_ringbuffer(
memcpy(ring_buffer + start_write_offset, src, srclen);
 
start_write_offset += srclen;
-   start_write_offset %= ring_buffer_size;
+   if (start_write_offset >= ring_buffer_size)
+   start_write_offset -= ring_buffer_size;
 
return start_write_offset;
 }
-- 
2.7.4

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


[PATCH] Staging: lustre: lustre: lmv: Compress return logic into one line.

2017-01-04 Thread Gustavo A. R. Silva
Simplify return logic to avoid unnecessary variable assignments.
These issues were detected using Coccinelle and the following semantic patch:

@@
local idexpression ret;
expression e;
@@

-ret =
+return
 e;
-return ret;

Signed-off-by: Gustavo A. R. Silva 
---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c | 58 -
 1 file changed, 16 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c 
b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index f124f6c..76a0306 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -771,7 +771,6 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, 
unsigned int cmd, int len,
 struct lustre_kernelcomm *lk,
 void __user *uarg)
 {
-   int rc = 0;
__u32 i;
 
/* unregister request (call from llapi_hsm_copytool_fini) */
@@ -791,9 +790,7 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, 
unsigned int cmd, int len,
 * Unreached coordinators will get EPIPE on next requests
 * and will unregister automatically.
 */
-   rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group);
-
-   return rc;
+   return libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group);
 }
 
 static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
@@ -1425,8 +1422,7 @@ static int lmv_getstatus(struct obd_export *exp,
if (rc)
return rc;
 
-   rc = md_getstatus(lmv->tgts[0]->ltd_exp, fid);
-   return rc;
+   return md_getstatus(lmv->tgts[0]->ltd_exp, fid);
 }
 
 static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
@@ -1447,10 +1443,8 @@ static int lmv_getxattr(struct obd_export *exp, const 
struct lu_fid *fid,
if (IS_ERR(tgt))
return PTR_ERR(tgt);
 
-   rc = md_getxattr(tgt->ltd_exp, fid, valid, name, input,
+   return md_getxattr(tgt->ltd_exp, fid, valid, name, input,
 input_size, output_size, flags, request);
-
-   return rc;
 }
 
 static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid,
@@ -1472,11 +1466,9 @@ static int lmv_setxattr(struct obd_export *exp, const 
struct lu_fid *fid,
if (IS_ERR(tgt))
return PTR_ERR(tgt);
 
-   rc = md_setxattr(tgt->ltd_exp, fid, valid, name, input,
+   return md_setxattr(tgt->ltd_exp, fid, valid, name, input,
 input_size, output_size, flags, suppgid,
 request);
-
-   return rc;
 }
 
 static int lmv_getattr(struct obd_export *exp, struct md_op_data *op_data,
@@ -1500,9 +1492,7 @@ static int lmv_getattr(struct obd_export *exp, struct 
md_op_data *op_data,
return 0;
}
 
-   rc = md_getattr(tgt->ltd_exp, op_data, request);
-
-   return rc;
+   return md_getattr(tgt->ltd_exp, op_data, request);
 }
 
 static int lmv_null_inode(struct obd_export *exp, const struct lu_fid *fid)
@@ -1549,8 +1539,7 @@ static int lmv_close(struct obd_export *exp, struct 
md_op_data *op_data,
return PTR_ERR(tgt);
 
CDEBUG(D_INODE, "CLOSE "DFID"\n", PFID(&op_data->op_fid1));
-   rc = md_close(tgt->ltd_exp, op_data, mod, request);
-   return rc;
+   return md_close(tgt->ltd_exp, op_data, mod, request);
 }
 
 /**
@@ -1743,10 +1732,8 @@ lmv_enqueue(struct obd_export *exp, struct 
ldlm_enqueue_info *einfo,
CDEBUG(D_INODE, "ENQUEUE '%s' on " DFID " -> mds #%u\n",
   LL_IT2STR(it), PFID(&op_data->op_fid1), tgt->ltd_idx);
 
-   rc = md_enqueue(tgt->ltd_exp, einfo, policy, it, op_data, lockh,
+   return md_enqueue(tgt->ltd_exp, einfo, policy, it, op_data, lockh,
extra_lock_flags);
-
-   return rc;
 }
 
 static int
@@ -1894,9 +1881,7 @@ static int lmv_link(struct obd_export *exp, struct 
md_op_data *op_data,
if (rc != 0)
return rc;
 
-   rc = md_link(tgt->ltd_exp, op_data, request);
-
-   return rc;
+   return md_link(tgt->ltd_exp, op_data, request);
 }
 
 static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data,
@@ -2109,8 +2094,7 @@ static int lmv_sync(struct obd_export *exp, const struct 
lu_fid *fid,
if (IS_ERR(tgt))
return PTR_ERR(tgt);
 
-   rc = md_sync(tgt->ltd_exp, fid, request);
-   return rc;
+   return md_sync(tgt->ltd_exp, fid, request);
 }
 
 /**
@@ -2428,17 +2412,14 @@ static int lmv_read_page(struct obd_export *exp, struct 
md_op_data *op_data,
return rc;
 
if (unlikely(lsm)) {
-   rc = lmv_read_striped_page(exp, op_data, cb_op, offset, ppage);
-   return rc;
+   return lmv_read_striped_page(exp, op_data, cb_op, offset, 
ppage);
}
 
tgt = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt))
return PTR_ERR(tgt);
 
- 

[PATCH] staging: wilc1000: Connect to highest RSSI value for required SSID

2017-01-04 Thread Aditya Shankar
Connect to the highest rssi with the required SSID in the shadow
table if the connection criteria is based only on the SSID.
For the first matching SSID, an index to the table is saved.
Later the index is updated if matching SSID has a higher
RSSI value than the last saved index.

However if decision is made based on BSSID, there is only one match
in the table and corresponding index is used.

Signed-off-by: Aditya Shankar 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index c1a24f7..32206b8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -665,6 +665,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
 {
s32 s32Error = 0;
u32 i;
+   u32 sel_bssi_idx = last_scanned_cnt + 1;
u8 u8security = NO_ENCRYPT;
enum AUTHTYPE tenuAuth_type = ANY;
 
@@ -688,18 +689,25 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
memcmp(last_scanned_shadow[i].ssid,
   sme->ssid,
   sme->ssid_len) == 0) {
-   if (!sme->bssid)
-   break;
-   else
+   if (!sme->bssid) {
+   if (sel_bssi_idx == (last_scanned_cnt + 1))
+   sel_bssi_idx = i;
+   else if (last_scanned_shadow[i].rssi >
+last_scanned_shadow[sel_bssi_idx].rssi)
+   sel_bssi_idx = i;
+   } else {
if (memcmp(last_scanned_shadow[i].bssid,
   sme->bssid,
-  ETH_ALEN) == 0)
+  ETH_ALEN) == 0){
+   sel_bssi_idx = i;
break;
+   }
+   }
}
}
 
-   if (i < last_scanned_cnt) {
-   pstrNetworkInfo = &last_scanned_shadow[i];
+   if (sel_bssi_idx < last_scanned_cnt) {
+   pstrNetworkInfo = &last_scanned_shadow[sel_bssi_idx];
} else {
s32Error = -ENOENT;
wilc_connecting = 0;
-- 
2.7.4

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


Re: [PATCH v2] hv: retry infinitely on hypercall transient failures

2017-01-04 Thread Greg KH
On Wed, Jan 04, 2017 at 06:12:20PM -0800, Long Li wrote:
> From: Long Li 
> 
> Hyper-v host guarantees that a hypercall will finish in reasonable time.
> Retry infinitely on transient failures to avoid returning error to upper 
> layer.

Again, never retry "forever", always have a way out, otherwise you will
crash.

And again, why are you making this change?  What problem does it solve?

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