Re: [PATCH] lustre: check copy_from_iter/copy_to_iter return code

2017-07-13 Thread Al Viro
On Thu, Jul 13, 2017 at 10:57:59PM +0200, Arnd Bergmann wrote:

> Thanks for testing it!
> 
> That means we did not copy any data and the kernel continues with
> an uninitialized buffer, right? The problem may be the definition of
> 
> struct kib_immediate_msg {
> struct lnet_hdr ibim_hdr;/* portals header */
> char ibim_payload[0]; /* piggy-backed payload */
> } WIRE_ATTR;
> 
> The check that Al added will try to ensure that we don't write
> beyond the size of the ibim_payload[] array, which unfortunately
> is defined as a zero-byte array, so I can see why it will now
> fail. However, it's already broken in mainline now, with or without
> my patch.
> 
> Are you able to come up with a fix that avoids the warning in
> 'allmodconfig' and makes the function do something reasonable
> again?

Might make sense to try and use valid C99 for "array of indefinite
size as the last member", i.e.
struct kib_immediate_msg {
 struct lnet_hdr ibim_hdr;/* portals header */
 char ibim_payload[]; /* piggy-backed payload */
} WIRE_ATTR;

Zero-sized array as the last member is gcc hack predating that;
looks like gcc gets confused into deciding that it knows the distance
from the end of object...

Said that, are we really guaranteed the IBLND_MSG_SIZE bytes
in there?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [media] staging: media: davinci_vpfe: fix spelling mistake in variable

2017-07-13 Thread Laurent Pinchart
Hi Colin,

Thank you for the patch.

On Thursday 13 Jul 2017 23:34:16 Colin King wrote:
> From: Colin Ian King 
> 
> Trivial fix to spelling mistake, rename the function name
> resizer_configure_in_continious_mode to
> resizer_configure_in_continuous_mode and also remove an extraneous space.
> 
> Signed-off-by: Colin Ian King 

Reviewed-by: Laurent Pinchart 

> ---
>  drivers/staging/media/davinci_vpfe/dm365_resizer.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
> b/drivers/staging/media/davinci_vpfe/dm365_resizer.c index
> 857b0e847c5e..d751d590a894 100644
> --- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
> +++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
> @@ -480,7 +480,7 @@ resizer_configure_common_in_params(struct
> vpfe_resizer_device *resizer) return 0;
>  }
>  static int
> -resizer_configure_in_continious_mode(struct vpfe_resizer_device *resizer)
> +resizer_configure_in_continuous_mode(struct vpfe_resizer_device *resizer)
>  {
>   struct device *dev = resizer->crop_resizer.subdev.v4l2_dev->dev;
>   struct resizer_params *param = >config;
> @@ -1242,7 +1242,7 @@ static int resizer_do_hw_setup(struct
> vpfe_resizer_device *resizer) ipipeif_source == IPIPEIF_OUTPUT_RESIZER)
>   ret = resizer_configure_in_single_shot_mode(resizer);
>   else
> - ret =  resizer_configure_in_continious_mode(resizer);
> + ret = resizer_configure_in_continuous_mode(resizer);
>   if (ret)
>   return ret;
>   ret = config_rsz_hw(resizer, param);

-- 
Regards,

Laurent Pinchart

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


[PATCH] [media] staging: media: davinci_vpfe: fix spelling mistake in variable

2017-07-13 Thread Colin King
From: Colin Ian King 

Trivial fix to spelling mistake, rename the function name
resizer_configure_in_continious_mode to
resizer_configure_in_continuous_mode and also remove an extraneous space.

Signed-off-by: Colin Ian King 
---
 drivers/staging/media/davinci_vpfe/dm365_resizer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/dm365_resizer.c 
b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
index 857b0e847c5e..d751d590a894 100644
--- a/drivers/staging/media/davinci_vpfe/dm365_resizer.c
+++ b/drivers/staging/media/davinci_vpfe/dm365_resizer.c
@@ -480,7 +480,7 @@ resizer_configure_common_in_params(struct 
vpfe_resizer_device *resizer)
return 0;
 }
 static int
-resizer_configure_in_continious_mode(struct vpfe_resizer_device *resizer)
+resizer_configure_in_continuous_mode(struct vpfe_resizer_device *resizer)
 {
struct device *dev = resizer->crop_resizer.subdev.v4l2_dev->dev;
struct resizer_params *param = >config;
@@ -1242,7 +1242,7 @@ static int resizer_do_hw_setup(struct vpfe_resizer_device 
*resizer)
ipipeif_source == IPIPEIF_OUTPUT_RESIZER)
ret = resizer_configure_in_single_shot_mode(resizer);
else
-   ret =  resizer_configure_in_continious_mode(resizer);
+   ret = resizer_configure_in_continuous_mode(resizer);
if (ret)
return ret;
ret = config_rsz_hw(resizer, param);
-- 
2.11.0

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


Re: [PATCH] Coding style fix - quoted string split across lines

2017-07-13 Thread Frans Klaver
On Thu, Jul 13, 2017 at 5:50 PM, PY  wrote:
> From: Pavlenko Yurii 
>
> ---
>  drivers/staging/fbtft/fbtft_device.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/fbtft/fbtft_device.c 
> b/drivers/staging/fbtft/fbtft_device.c
> index 0d97473..c2d5dbb 100644
> --- a/drivers/staging/fbtft/fbtft_device.c
> +++ b/drivers/staging/fbtft/fbtft_device.c
> @@ -898,14 +898,14 @@ static void adafruit18_green_tab_set_addr_win(struct 
> fbtft_par *par,
> { "dc", 25 },
> {},
> },
> -   .gamma ="0 2 2 2 2 2 2 2 "
> -   "2 2 2 2 2 2 2 2 "
> -   "2 2 2 2 2 2 2 2 "
> -   "2 2 2 2 2 2 2 3 "
> -   "3 3 3 3 3 3 3 3 "
> -   "3 3 3 3 3 3 3 3 "
> -   "3 3 3 4 4 4 4 4 "
> -   "4 4 4 4 4 4 4"
> +   .gamma = "0 2 2 2 2 2 2 2 " /
> +"2 2 2 2 2 2 2 2 " /
> +"2 2 2 2 2 2 2 2 " /
> +"2 2 2 2 2 2 2 3 " /
> +"3 3 3 3 3 3 3 3 " /
> +"3 3 3 3 3 3 3 3 " /
> +"3 3 3 4 4 4 4 4 " /
> +"4 4 4 4 4 4 4"

Are you trying to escape newlines with forward slashes? This might
have some unexpected results :(.

The checkpatch warning is for lines that are going to end up visible
to the user (to enable easy grepping).
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] lustre: check copy_from_iter/copy_to_iter return code

2017-07-13 Thread Arnd Bergmann
On Thu, Jul 13, 2017 at 7:07 PM, James Simmons  wrote:
>
>> We now get a helpful warning for code that calls copy_{from,to}_iter
>> without checking the return value, introduced by commit aa28de275a24
>> ("iov_iter/hardening: move object size checks to inlined part").
>>
>> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function 
>> 'kiblnd_send':
>> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1643:2: error: 
>> ignoring return value of 'copy_from_iter', declared with attribute 
>> warn_unused_result [-Werror=unused-result]
>> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function 
>> 'kiblnd_recv':
>> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1744:3: error: 
>> ignoring return value of 'copy_to_iter', declared with attribute 
>> warn_unused_result [-Werror=unused-result]
>>
>> In case we get short copies here, we may get incorrect behavior.
>> I've added failure handling for both rx and tx now, returning
>> -EFAULT as expected.
>>
>> Cc: sta...@vger.kernel.org
>> Signed-off-by: Arnd Bergmann 
>> ---
>> This warning now shows up in 'allmodconfig' builds, so it would be
>> good to get it fixed quickly for 4.13, but my patch should not go
>> in without careful review since I'm not familiar with with code
>> and the error handling is a bit tricky here.
>>
>> I added 'Cc: stable' since this is a preexisting condition that we
>> only started warning about now.
>> ---
>>  drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 15 +--
>>  1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c 
>> b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
>> index 85b242ec5f9b..70256a0ffd2e 100644
>> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
>> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
>> @@ -1640,8 +1640,13 @@ kiblnd_send(struct lnet_ni *ni, void *private, struct 
>> lnet_msg *lntmsg)
>>   ibmsg = tx->tx_msg;
>>   ibmsg->ibm_u.immediate.ibim_hdr = *hdr;
>>
>> - copy_from_iter(>ibm_u.immediate.ibim_payload, IBLND_MSG_SIZE,
>> + rc = copy_from_iter(>ibm_u.immediate.ibim_payload, 
>> IBLND_MSG_SIZE,
>>  );
>
> I have to Nak this to prevent it from landing but for some reason in my
> testing its returning zero from copy_from_iter.

Thanks for testing it!

That means we did not copy any data and the kernel continues with
an uninitialized buffer, right? The problem may be the definition of

struct kib_immediate_msg {
struct lnet_hdr ibim_hdr;/* portals header */
char ibim_payload[0]; /* piggy-backed payload */
} WIRE_ATTR;

The check that Al added will try to ensure that we don't write
beyond the size of the ibim_payload[] array, which unfortunately
is defined as a zero-byte array, so I can see why it will now
fail. However, it's already broken in mainline now, with or without
my patch.

Are you able to come up with a fix that avoids the warning in
'allmodconfig' and makes the function do something reasonable
again?

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


Re: Coding style fix - quoted string split across lines for fbtft_device.c

2017-07-13 Thread Frans Klaver
On Thu, Jul 13, 2017 at 10:41 PM, Frans Klaver  wrote:
> On Thu, Jul 13, 2017 at 5:50 PM, PY  wrote:
>> Hello,
>>
>> I found some coding style warnings for fbtft_device.c
>> I fixed it in the patch.
>
> What patch?

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


Re: Coding style fix - quoted string split across lines for fbtft_device.c

2017-07-13 Thread Frans Klaver
On Thu, Jul 13, 2017 at 5:50 PM, PY  wrote:
> Hello,
>
> I found some coding style warnings for fbtft_device.c
> I fixed it in the patch.

What patch?

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


Re: [PATCH] lustre: check copy_from_iter/copy_to_iter return code

2017-07-13 Thread James Simmons

> We now get a helpful warning for code that calls copy_{from,to}_iter
> without checking the return value, introduced by commit aa28de275a24
> ("iov_iter/hardening: move object size checks to inlined part").
> 
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function 
> 'kiblnd_send':
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1643:2: error: 
> ignoring return value of 'copy_from_iter', declared with attribute 
> warn_unused_result [-Werror=unused-result]
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c: In function 
> 'kiblnd_recv':
> drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c:1744:3: error: 
> ignoring return value of 'copy_to_iter', declared with attribute 
> warn_unused_result [-Werror=unused-result]
> 
> In case we get short copies here, we may get incorrect behavior.
> I've added failure handling for both rx and tx now, returning
> -EFAULT as expected.
> 
> Cc: sta...@vger.kernel.org
> Signed-off-by: Arnd Bergmann 
> ---
> This warning now shows up in 'allmodconfig' builds, so it would be
> good to get it fixed quickly for 4.13, but my patch should not go
> in without careful review since I'm not familiar with with code
> and the error handling is a bit tricky here.
> 
> I added 'Cc: stable' since this is a preexisting condition that we
> only started warning about now.
> ---
>  drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 15 +--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c 
> b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
> index 85b242ec5f9b..70256a0ffd2e 100644
> --- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
> +++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c
> @@ -1640,8 +1640,13 @@ kiblnd_send(struct lnet_ni *ni, void *private, struct 
> lnet_msg *lntmsg)
>   ibmsg = tx->tx_msg;
>   ibmsg->ibm_u.immediate.ibim_hdr = *hdr;
>  
> - copy_from_iter(>ibm_u.immediate.ibim_payload, IBLND_MSG_SIZE,
> + rc = copy_from_iter(>ibm_u.immediate.ibim_payload, 
> IBLND_MSG_SIZE,
>  );

I have to Nak this to prevent it from landing but for some reason in my 
testing its returning zero from copy_from_iter.


> + if (rc != IBLND_MSG_SIZE) {
> + kiblnd_pool_free_node(>tx_pool->tpo_pool, >tx_list);
> + return -EFAULT;
> + }
> +
>   nob = offsetof(struct kib_immediate_msg, ibim_payload[payload_nob]);
>   kiblnd_init_tx_msg(ni, tx, IBLND_MSG_IMMEDIATE, nob);
>  
> @@ -1741,8 +1746,14 @@ kiblnd_recv(struct lnet_ni *ni, void *private, struct 
> lnet_msg *lntmsg,
>   break;
>   }
>  
> - copy_to_iter(>ibm_u.immediate.ibim_payload,
> + rc = copy_to_iter(>ibm_u.immediate.ibim_payload,
>IBLND_MSG_SIZE, to);
> + if (rc != IBLND_MSG_SIZE) {
> + rc = -EFAULT;
> + break;
> + }
> +
> + rc = 0;
>   lnet_finalize(ni, lntmsg, 0);
>   break;
>  
> -- 
> 2.9.0
> 
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v3] staging: lirc_zilog: Clean up lirc zilog error codes

2017-07-13 Thread Yves Lemée
According the coding style guidelines, the ENOSYS error code must be returned
in case of a non existent system call. This code has been replaced with
the ENOTTY error code indicating a missing functionality.

Signed-off-by: Yves Lemée 
---
v3: Fixed patch subject
Fixed patch revision description

v2: Improved punctuation

 drivers/staging/media/lirc/lirc_zilog.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
b/drivers/staging/media/lirc/lirc_zilog.c
index 015e41bd036e..26dd32d5b5b2 100644
--- a/drivers/staging/media/lirc/lirc_zilog.c
+++ b/drivers/staging/media/lirc/lirc_zilog.c
@@ -1249,7 +1249,7 @@ static long ioctl(struct file *filep, unsigned int cmd, 
unsigned long arg)
break;
case LIRC_GET_REC_MODE:
if (!(features & LIRC_CAN_REC_MASK))
-   return -ENOSYS;
+   return -ENOTTY;
 
result = put_user(LIRC_REC2MODE
  (features & LIRC_CAN_REC_MASK),
@@ -1257,21 +1257,21 @@ static long ioctl(struct file *filep, unsigned int cmd, 
unsigned long arg)
break;
case LIRC_SET_REC_MODE:
if (!(features & LIRC_CAN_REC_MASK))
-   return -ENOSYS;
+   return -ENOTTY;
 
result = get_user(mode, uptr);
if (!result && !(LIRC_MODE2REC(mode) & features))
-   result = -EINVAL;
+   result = -ENOTTY;
break;
case LIRC_GET_SEND_MODE:
if (!(features & LIRC_CAN_SEND_MASK))
-   return -ENOSYS;
+   return -ENOTTY;
 
result = put_user(LIRC_MODE_PULSE, uptr);
break;
case LIRC_SET_SEND_MODE:
if (!(features & LIRC_CAN_SEND_MASK))
-   return -ENOSYS;
+   return -ENOTTY;
 
result = get_user(mode, uptr);
if (!result && mode != LIRC_MODE_PULSE)
-- 
2.13.2

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


[PATCH v2] staging: wlan-ng: Use little-endian type

2017-07-13 Thread Aviv Palivoda
Fix the following sparse warning:
drivers/staging//wlan-ng/prism2sta.c:1691:20: warning: incorrect type in 
assignment (different base types)

The authantication data is in little endian order. Change the types to little 
endian order:
(a) Change struct hfa384x_authenticate_station_data status, algorithm members 
type to __le16.
(b) Change struct hfa384x_auth_request algorithm member type to __le16.
(c) All assignment to status are converted to little-endian prior to assignment.

Signed-off-by: Aviv Palivoda 
---
Changes for v2:
- Changed algorithm field to __le16.
- Explaind the reason for the change in the commit message.
---
 drivers/staging/wlan-ng/hfa384x.h   |  6 +++---
 drivers/staging/wlan-ng/prism2sta.c | 17 -
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x.h 
b/drivers/staging/wlan-ng/hfa384x.h
index 018db22..f2c5cbd 100644
--- a/drivers/staging/wlan-ng/hfa384x.h
+++ b/drivers/staging/wlan-ng/hfa384x.h
@@ -413,8 +413,8 @@ struct hfa384x_join_request_data {
 /*-- Configuration Record: authenticateStation (data portion only) --*/
 struct hfa384x_authenticate_station_data {
u8 address[ETH_ALEN];
-   u16 status;
-   u16 algorithm;
+   __le16 status;
+   __le16 algorithm;
 } __packed;
 
 /*-- Configuration Record: WPAData   (data portion only) --*/
@@ -733,7 +733,7 @@ struct hfa384x_assoc_status {
 
 struct hfa384x_auth_request {
u8 sta_addr[ETH_ALEN];
-   u16 algorithm;
+   __le16 algorithm;
 } __packed;
 
 /*--  Unsolicited Frame, MAC Mgmt: PSUserCount (AP Only) --*/
diff --git a/drivers/staging/wlan-ng/prism2sta.c 
b/drivers/staging/wlan-ng/prism2sta.c
index e16da34..250af0d 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -1561,7 +1561,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice 
*wlandev,
 */
 
ether_addr_copy(rec.address, inf->info.authreq.sta_addr);
-   rec.status = P80211ENUM_status_unspec_failure;
+   rec.status = cpu_to_le16(P80211ENUM_status_unspec_failure);
 
/*
 * Authenticate based on the access mode.
@@ -1578,7 +1578,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice 
*wlandev,
for (i = 0; i < hw->authlist.cnt; i++)
if (ether_addr_equal(rec.address,
 hw->authlist.addr[i])) {
-   rec.status = P80211ENUM_status_successful;
+   rec.status = 
cpu_to_le16(P80211ENUM_status_successful);
break;
}
 
@@ -1590,7 +1590,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice 
*wlandev,
 * Allow all authentications.
 */
 
-   rec.status = P80211ENUM_status_successful;
+   rec.status = cpu_to_le16(P80211ENUM_status_successful);
break;
 
case WLAN_ACCESS_ALLOW:
@@ -1615,7 +1615,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice 
*wlandev,
 
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
if (ether_addr_equal(rec.address, addr)) {
-   rec.status = P80211ENUM_status_successful;
+   rec.status = 
cpu_to_le16(P80211ENUM_status_successful);
break;
}
 
@@ -1641,11 +1641,11 @@ static void prism2sta_inf_authreq_defer(struct 
wlandevice *wlandev,
addr = hw->deny.addr1[0];
}
 
-   rec.status = P80211ENUM_status_successful;
+   rec.status = cpu_to_le16(P80211ENUM_status_successful);
 
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
if (ether_addr_equal(rec.address, addr)) {
-   rec.status = P80211ENUM_status_unspec_failure;
+   rec.status = 
cpu_to_le16(P80211ENUM_status_unspec_failure);
break;
}
 
@@ -1663,7 +1663,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice 
*wlandev,
 
added = 0;
 
-   if (rec.status == P80211ENUM_status_successful) {
+   if (rec.status == cpu_to_le16(P80211ENUM_status_successful)) {
for (i = 0; i < hw->authlist.cnt; i++)
if (ether_addr_equal(rec.address,
 hw->authlist.addr[i]))
@@ -1671,7 +1671,7 @@ static void prism2sta_inf_authreq_defer(struct wlandevice 
*wlandev,
 
if (i >= hw->authlist.cnt) {
if (hw->authlist.cnt >= WLAN_AUTH_MAX) {
-   rec.status = P80211ENUM_status_ap_full;
+   rec.status = 
cpu_to_le16(P80211ENUM_status_ap_full);
} else {
 

Re: [PATCH] Coding style fix - quoted string split across lines

2017-07-13 Thread Greg KH
On Thu, Jul 13, 2017 at 05:50:11PM +0200, PY wrote:
> From: Pavlenko Yurii 
> 
> ---
>  drivers/staging/fbtft/fbtft_device.c | 16 
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/fbtft/fbtft_device.c 
> b/drivers/staging/fbtft/fbtft_device.c
> index 0d97473..c2d5dbb 100644
> --- a/drivers/staging/fbtft/fbtft_device.c
> +++ b/drivers/staging/fbtft/fbtft_device.c
> @@ -898,14 +898,14 @@ static void adafruit18_green_tab_set_addr_win(struct 
> fbtft_par *par,
>   { "dc", 25 },
>   {},
>   },
> - .gamma ="0 2 2 2 2 2 2 2 "
> - "2 2 2 2 2 2 2 2 "
> - "2 2 2 2 2 2 2 2 "
> - "2 2 2 2 2 2 2 3 "
> - "3 3 3 3 3 3 3 3 "
> - "3 3 3 3 3 3 3 3 "
> - "3 3 3 4 4 4 4 4 "
> - "4 4 4 4 4 4 4"
> + .gamma = "0 2 2 2 2 2 2 2 " /
> +  "2 2 2 2 2 2 2 2 " /
> +  "2 2 2 2 2 2 2 2 " /
> +  "2 2 2 2 2 2 2 3 " /
> +  "3 3 3 3 3 3 3 3 " /
> +  "3 3 3 3 3 3 3 3 " /
> +  "3 3 3 4 4 4 4 4 " /
> +  "4 4 4 4 4 4 4"
>   }
>   }
>   }, {
> -- 
> 1.9.1

Hi,

This is the friendly patch-bot of Greg Kroah-Hartman.  You have sent him
a patch that has triggered this response.  He used to manually respond
to these common problems, but in order to save his sanity (he kept
writing the same thing over and over, yet to different people), I was
created.  Hopefully you will not take offence and will fix the problem
in your patch and resubmit it so that it can be accepted into the Linux
kernel tree.

You are receiving this message because of the following common error(s)
as indicated below:

- Your patch does not have a Signed-off-by: line.  Please read the
  kernel file, Documentation/SubmittingPatches and resend it after
  adding that line.  Note, the line needs to be in the body of the
  email, before the patch, not at the bottom of the patch or in the
  email signature.

- You did not specify a description of why the patch is needed, or
  possibly, any description at all, in the email body.  Please read the
  section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what is needed in order to
  properly describe the change.

- You did not write a descriptive Subject: for the patch, allowing Greg,
  and everyone else, to know what this patch is all about.  Please read
  the section entitled "The canonical patch format" in the kernel file,
  Documentation/SubmittingPatches for what a proper Subject: line should
  look like.

- You did not use your real name.  Signed-off-by: and From: has to have
  a real name associated with it.  Use whatever you sign legal documents
  with, no anonymous patches are allowed.

If you wish to discuss this problem further, or you have questions about
how to resolve this issue, please feel free to respond to this email and
Greg will reply once he has dug out from the pending patches received
from other developers.

thanks,

greg k-h's patch email bot
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] [media] staging/atomisp: fix minor coding style issue

2017-07-13 Thread Shy More
Below was the minor issue flagged by checkpatch.pl:
- ERROR: space prohibited after that open parenthesis '('

Signed-off-by: Shy More 
---
 .../atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
index 76d9142..4e61cb7 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
@@ -131,7 +131,7 @@ void ia_css_isys_ibuf_rmgr_release(
for (i = 0; i < ibuf_rsrc.num_allocated; i++) {
handle = getHandle(i);
if ((handle->start_addr == *start_addr)
-   && ( true == handle->active)) {
+   && (true == handle->active)) {
handle->active = false;
ibuf_rsrc.num_active--;
break;
-- 
1.9.1

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


[PATCH] Coding style fix - quoted string split across lines

2017-07-13 Thread PY
From: Pavlenko Yurii 

---
 drivers/staging/fbtft/fbtft_device.c | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft_device.c 
b/drivers/staging/fbtft/fbtft_device.c
index 0d97473..c2d5dbb 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -898,14 +898,14 @@ static void adafruit18_green_tab_set_addr_win(struct 
fbtft_par *par,
{ "dc", 25 },
{},
},
-   .gamma ="0 2 2 2 2 2 2 2 "
-   "2 2 2 2 2 2 2 2 "
-   "2 2 2 2 2 2 2 2 "
-   "2 2 2 2 2 2 2 3 "
-   "3 3 3 3 3 3 3 3 "
-   "3 3 3 3 3 3 3 3 "
-   "3 3 3 4 4 4 4 4 "
-   "4 4 4 4 4 4 4"
+   .gamma = "0 2 2 2 2 2 2 2 " /
+"2 2 2 2 2 2 2 2 " /
+"2 2 2 2 2 2 2 2 " /
+"2 2 2 2 2 2 2 3 " /
+"3 3 3 3 3 3 3 3 " /
+"3 3 3 3 3 3 3 3 " /
+"3 3 3 4 4 4 4 4 " /
+"4 4 4 4 4 4 4"
}
}
}, {
-- 
1.9.1

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


Coding style fix - quoted string split across lines for fbtft_device.c

2017-07-13 Thread PY
Hello,

I found some coding style warnings for fbtft_device.c
I fixed it in the patch.

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


Re: [PATCH v2 2/2] staging: atomisp2: hmm: Alignment code (rebased)

2017-07-13 Thread Sakari Ailus
On Thu, Jul 13, 2017 at 08:55:43AM +0200, Philipp Guendisch wrote:
> This patch fixed code alignment to open paranthesis.
> Semantic should not be affected by this patch.
> 
> It has been rebased on top of media_tree atomisp branch
> 
> Signed-off-by: Philipp Guendisch 
> Signed-off-by: Chris Baller 

Hi Philipp,

Neither of the patches still applies?

Are you sure you rebased them on the atomisp branch?

-- 
Regards,

Sakari Ailus
e-mail: sakari.ai...@iki.fi XMPP: sai...@retiisi.org.uk
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] [media] staging/atomisp: fix minor coding style warnings

2017-07-13 Thread Greg KH
On Thu, Jul 13, 2017 at 08:06:21AM -0700, smklearn wrote:
> Below were the minor issues flagged by checkpatch.pl:
> - WARNING: Block comments use * on subsequent lines
> - ERROR: space prohibited after that open parenthesis '('

Don't do multiple things in the same patch please, this should be
multiple patches.

> Signed-off-by: Shy More 

This name doesn't match your "From:" name in the email :(

thanks,

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


[PATCH] [media] staging/atomisp: fix minor coding style warnings

2017-07-13 Thread smklearn
Below were the minor issues flagged by checkpatch.pl:
- WARNING: Block comments use * on subsequent lines
- ERROR: space prohibited after that open parenthesis '('

Signed-off-by: Shy More 
---
 .../css2400/runtime/isys/src/ibuf_ctrl_rmgr.c  | 26 +++---
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
index 76d9142..856fb6e 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
@@ -14,18 +14,18 @@
  */
 #else
 /**
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
+ * Support for Intel Camera Imaging ISP subsystem.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
+
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
 #endif
 
 #include "system_global.h"
@@ -131,7 +131,7 @@ void ia_css_isys_ibuf_rmgr_release(
for (i = 0; i < ibuf_rsrc.num_allocated; i++) {
handle = getHandle(i);
if ((handle->start_addr == *start_addr)
-   && ( true == handle->active)) {
+   && (true == handle->active)) {
handle->active = false;
ibuf_rsrc.num_active--;
break;
-- 
1.9.1

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


Re: [PATCH] staging drivers fixed coding style error

2017-07-13 Thread Greg KH
On Thu, Jul 13, 2017 at 07:17:56AM -0700, smklearn wrote:
> Fixed coding style error flagged checkpatch.pl:
>   - ERROR: space prohibited after that open parenthesis '('
>   - WARNING: Block comments use * on subsequent lines
> 
> Signed-off-by: Shy More 
> 
> Output after fixing coding style issues:
> 
> $KERN/scripts/checkpatch.pl -f
>   ./media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
> 
> total: 0 errors, 0 warnings, 141 lines checked

Please don't put anything below the Signed-off-by: line, you will note
that all other commits are written that way.

Also, your subject: needs a lot of work, again, look at other commits
for the driver you are modifying to get it right.

good luck!

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


[PATCH] staging drivers fixed coding style error

2017-07-13 Thread smklearn
Fixed coding style error flagged checkpatch.pl:
- ERROR: space prohibited after that open parenthesis '('
- WARNING: Block comments use * on subsequent lines

Signed-off-by: Shy More 

Output after fixing coding style issues:

$KERN/scripts/checkpatch.pl -f
./media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c

total: 0 errors, 0 warnings, 141 lines checked
---
 .../css2400/runtime/isys/src/ibuf_ctrl_rmgr.c  | 26 +++---
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
index 76d9142..856fb6e 100644
--- 
a/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
+++ 
b/drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/isys/src/ibuf_ctrl_rmgr.c
@@ -14,18 +14,18 @@
  */
 #else
 /**
-Support for Intel Camera Imaging ISP subsystem.
-Copyright (c) 2010 - 2015, Intel Corporation.
-
-This program is free software; you can redistribute it and/or modify it
-under the terms and conditions of the GNU General Public License,
-version 2, as published by the Free Software Foundation.
-
-This program is distributed in the hope it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-more details.
-*/
+ * Support for Intel Camera Imaging ISP subsystem.
+ * Copyright (c) 2010 - 2015, Intel Corporation.
+
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
 #endif
 
 #include "system_global.h"
@@ -131,7 +131,7 @@ void ia_css_isys_ibuf_rmgr_release(
for (i = 0; i < ibuf_rsrc.num_allocated; i++) {
handle = getHandle(i);
if ((handle->start_addr == *start_addr)
-   && ( true == handle->active)) {
+   && (true == handle->active)) {
handle->active = false;
ibuf_rsrc.num_active--;
break;
-- 
1.9.1

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


Re: [PATCH v3 08/10] x86/hyper-v: use hypercall for remote TLB flush

2017-07-13 Thread Vitaly Kuznetsov
Andy Lutomirski  writes:

> On Tue, May 23, 2017 at 5:36 AM, Vitaly Kuznetsov  wrote:
>> Andy Lutomirski  writes:
>>
>>>
>>> Also, can you share the benchmark you used for these patches?
>>
>> I didn't do much while writing the patchset, mostly I was running the
>> attached dumb trasher (32 pthreads doing mmap/munmap). On a 16 vCPU
>> Hyper-V 2016 guest I get the following (just re-did the test with
>> 4.12-rc1):
>>
>> Before the patchset:
>> # time ./pthread_mmap ./randfile
>>
>> real3m33.118s
>> user0m3.698s
>> sys 3m16.624s
>>
>> After the patchset:
>> # time ./pthread_mmap ./randfile
>>
>> real2m19.920s
>> user0m2.662s
>> sys 2m9.948s
>>
>> K. Y.'s guys at Microsoft did additional testing for the patchset on
>> different Hyper-V deployments including Azure, they may share their
>> findings too.
>
> I ran this benchmark on my big TLB patchset, mainly to make sure I
> didn't regress your test.  I seem to have sped it up by 30% or so
> instead.  I need to study this a little bit to figure out why to make
> sure that the reason isn't that I'm failing to do flushes I need to
> do.

Got back to this and tested everything on WS2016 Hyper-V guest (24
vCPUs) with my slightly modified benchmark. The numbers are:

1) pre-patch:

real1m15.775s
user0m0.850s
sys 1m31.515s

2) your 'x86/pcid' series (PCID feature is not passed to the guest so this
is mainly your lazy tlb optimization):

real0m55.135s
user0m1.168s
sys 1m3.810s

3) My 'pv tlb shootdown' patchset on top of your 'x86/pcid' series:

real0m48.891s
user0m1.052s
sys 0m52.591s

As far as I understand I need to add
'setup_clear_cpu_cap(X86_FEATURE_PCID)' to my series to make things work
properly if this feature appears in the guest.

Other than that there is an additional room for optimization:
tlb_single_page_flush_ceiling, I'm not sure that with Hyper-V's PV the
default value of 33 is optimal. But the investigation can be done
separately.

AFAIU with your TLB preparatory work which got into 4.13 our series
become untangled and can go through different trees. I'll rebase mine
and send it to K. Y. to push through Greg's char-misc tree.

Is there anything blocking your PCID series from going into 4.14? It
seems to big a huge improvement for some workloads.

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


Re: [patch 0/3] Re: tty contention resulting from tty_open_by_device export

2017-07-13 Thread Okash Khawaja
On Wed, Jul 12, 2017 at 07:20:28PM +0100, Alan Cox wrote:
> 
> > When opening from kernel, we don't use file pointer. The count mismatch
> > is between tty->count and #fd's. So opening from kernel leads to #fd's
> > being less than tty->count. I thought this difference is relevant to
> > user-space opening of tty, and not to kernel opening of tty. Can you
> > suggest how to address this mismatch?
> 
> Your kernel reference is the same as having a file open reference so I
> think this actually needs addressing in the maths. In other words count
> the number of kernel references and also add that into the test for
> check_tty_count (kernel references + #fds == count).
> 
> I'd really like to keep this right because that check has a long history
> of catching really nasty race conditions in the tty code. The
> open/close/hangup code is really fragile so worth the debugability.

I see. Okay based this, check_tty_count can be easily updated to take
into account kernel references.

> 
> > Ah may be I didn't notice the active bit. Is it one of the #defines in
> > tty.h? Can usage count and active bit be used to differentiate between
> > whether the tty was opened by kernel or user?
> 
> It only tells you whether the port is currently active for some purpose,
> not which. If you still want to implement exclusivity between kernel and
> user then it needs another flag, but I think that flag should be in
> port->flags as it is a property of the physical interface.
> 
> (Take a look at tty_port_open for example)
Okay I can add TTY_PORT_KOPENED to port->flags and that should work too.

However, can you please help me understand this:
Our use case requires kernel access to tty_struct and accordingly
tty_kopen returns tty_struct. The exclusivity between user and kernel
space is also meant to prevent one side from opening tty_struct while
another has it opened. In all this, it is tty_struct and not tty_port
which is the key resource we are concerned with. So shouldn't the
exclusivity flag belong to tty_struct?

Adding a the flag to port->flags but controlling it from code for
opening and closing tty will also mean we have tty_port_kopened,
tty_port_set_kopen etc inside tty open/close code.

Am I viewing this problem incorrectly?

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


Re: [patch] staging: speakup: safely close tty

2017-07-13 Thread Okash Khawaja
On Wed, Jul 12, 2017 at 07:25:22PM +0100, Alan Cox wrote:
> > spk_ttyio_initialise_ldisc is called separately for each module (e.g.
> > speakup_apollo, speakup_ltlk etc) when it is loaded. spk_ttyio_release
> > is also called separately for each module when it is unloaded. The ldisc
> > stays around until the last of the modules is unloaded.
> 
> What guarantees that someone hasn't decided to set the ldisc on unrelated
> hardware to speakup (eg on a pty/tty pair).
> > 
> > > 
> > > I'd also btw strongly recommend putting the ldisc and the speakup tty
> > > driver as different modules.  
> > Sure, that makes sense. I will do that following these patches.
> 
> If the ldisc is just unregistered when the module implementing it is
> unloaded then the ref counts on the ldisc module should do everything
> needed if the above isn't correctly handled, and if it is will still be
> cleaner.

Right, I understand now. Thanks. I will update and resend this patch.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 11/12] staging: ccree: kmalloc by sizeof var not type

2017-07-13 Thread Gilad Ben-Yossef
Change places where we alloc memory by sizeof type to sizeof var.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c| 4 ++--
 drivers/staging/ccree/ssi_cipher.c  | 4 ++--
 drivers/staging/ccree/ssi_driver.c  | 2 +-
 drivers/staging/ccree/ssi_hash.c| 4 ++--
 drivers/staging/ccree/ssi_ivgen.c   | 2 +-
 drivers/staging/ccree/ssi_request_mgr.c | 2 +-
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index aa94839..15d05af 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -2659,7 +2659,7 @@ static struct ssi_crypto_alg *ssi_aead_create_alg(struct 
ssi_alg_template *templ
struct ssi_crypto_alg *t_alg;
struct aead_alg *alg;
 
-   t_alg = kzalloc(sizeof(struct ssi_crypto_alg), GFP_KERNEL);
+   t_alg = kzalloc(sizeof(*t_alg), GFP_KERNEL);
if (!t_alg) {
SSI_LOG_ERR("failed to allocate t_alg\n");
return ERR_PTR(-ENOMEM);
@@ -2714,7 +2714,7 @@ int ssi_aead_alloc(struct ssi_drvdata *drvdata)
int rc = -ENOMEM;
int alg;
 
-   aead_handle = kmalloc(sizeof(struct ssi_aead_handle), GFP_KERNEL);
+   aead_handle = kmalloc(sizeof(*aead_handle), GFP_KERNEL);
if (!aead_handle) {
rc = -ENOMEM;
goto fail0;
diff --git a/drivers/staging/ccree/ssi_cipher.c 
b/drivers/staging/ccree/ssi_cipher.c
index 3402022..06e6a89 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -1214,7 +1214,7 @@ struct ssi_crypto_alg *ssi_ablkcipher_create_alg(struct 
ssi_alg_template *templa
struct ssi_crypto_alg *t_alg;
struct crypto_alg *alg;
 
-   t_alg = kzalloc(sizeof(struct ssi_crypto_alg), GFP_KERNEL);
+   t_alg = kzalloc(sizeof(*t_alg), GFP_KERNEL);
if (!t_alg) {
SSI_LOG_ERR("failed to allocate t_alg\n");
return ERR_PTR(-ENOMEM);
@@ -1275,7 +1275,7 @@ int ssi_ablkcipher_alloc(struct ssi_drvdata *drvdata)
int rc = -ENOMEM;
int alg;
 
-   ablkcipher_handle = kmalloc(sizeof(struct ssi_blkcipher_handle),
+   ablkcipher_handle = kmalloc(sizeof(*ablkcipher_handle),
GFP_KERNEL);
if (!ablkcipher_handle)
return -ENOMEM;
diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index d104dbd..1cae2b7 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -223,7 +223,7 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
struct resource *req_mem_cc_regs = NULL;
void __iomem *cc_base = NULL;
bool irq_registered = false;
-   struct ssi_drvdata *new_drvdata = kzalloc(sizeof(struct ssi_drvdata), 
GFP_KERNEL);
+   struct ssi_drvdata *new_drvdata = kzalloc(sizeof(*new_drvdata), 
GFP_KERNEL);
struct device *dev = _dev->dev;
struct device_node *np = dev->of_node;
u32 signature_val;
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 292250e..11bbbc3 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -2060,7 +2060,7 @@ ssi_hash_create_alg(struct ssi_hash_template *template, 
bool keyed)
struct crypto_alg *alg;
struct ahash_alg *halg;
 
-   t_crypto_alg = kzalloc(sizeof(struct ssi_hash_alg), GFP_KERNEL);
+   t_crypto_alg = kzalloc(sizeof(*t_crypto_alg), GFP_KERNEL);
if (!t_crypto_alg) {
SSI_LOG_ERR("failed to allocate t_alg\n");
return ERR_PTR(-ENOMEM);
@@ -2224,7 +2224,7 @@ int ssi_hash_alloc(struct ssi_drvdata *drvdata)
int rc = 0;
int alg;
 
-   hash_handle = kzalloc(sizeof(struct ssi_hash_handle), GFP_KERNEL);
+   hash_handle = kzalloc(sizeof(*hash_handle), GFP_KERNEL);
if (!hash_handle) {
SSI_LOG_ERR("kzalloc failed to allocate %zu B\n",
sizeof(struct ssi_hash_handle));
diff --git a/drivers/staging/ccree/ssi_ivgen.c 
b/drivers/staging/ccree/ssi_ivgen.c
index c6f400f..8d6f8ad 100644
--- a/drivers/staging/ccree/ssi_ivgen.c
+++ b/drivers/staging/ccree/ssi_ivgen.c
@@ -191,7 +191,7 @@ int ssi_ivgen_init(struct ssi_drvdata *drvdata)
int rc;
 
/* Allocate "this" context */
-   drvdata->ivgen_handle = kzalloc(sizeof(struct ssi_ivgen_ctx), 
GFP_KERNEL);
+   drvdata->ivgen_handle = kzalloc(sizeof(*drvdata->ivgen_handle), 
GFP_KERNEL);
if (!drvdata->ivgen_handle) {
SSI_LOG_ERR("Not enough memory to allocate IVGEN context (%zu 
B)\n",
sizeof(struct ssi_ivgen_ctx));
diff --git a/drivers/staging/ccree/ssi_request_mgr.c 
b/drivers/staging/ccree/ssi_request_mgr.c
index 9a4bb5c..cae9904 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ 

[PATCH 12/12] staging: ccree: remove whitespace before a quoted newline

2017-07-13 Thread Gilad Ben-Yossef
Remove unnecessary whitespace before a quoted newline in strings.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_cipher.c |  6 +++---
 drivers/staging/ccree/ssi_hash.c   |  2 +-
 drivers/staging/ccree/ssi_sysfs.c  | 10 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/ccree/ssi_cipher.c 
b/drivers/staging/ccree/ssi_cipher.c
index 06e6a89..e09fe03 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -614,14 +614,14 @@ ssi_blkcipher_create_data_desc(
break;
 #endif /*SSI_CC_HAS_MULTI2*/
default:
-   SSI_LOG_ERR("invalid flow mode, flow_mode = %d \n", flow_mode);
+   SSI_LOG_ERR("invalid flow mode, flow_mode = %d\n", flow_mode);
return;
}
/* Process */
if (likely(req_ctx->dma_buf_type == SSI_DMA_BUF_DLLI)) {
-   SSI_LOG_DEBUG(" data params addr %pad length 0x%X \n",
+   SSI_LOG_DEBUG(" data params addr %pad length 0x%X\n",
  sg_dma_address(src), nbytes);
-   SSI_LOG_DEBUG(" data params addr %pad length 0x%X \n",
+   SSI_LOG_DEBUG(" data params addr %pad length 0x%X\n",
  sg_dma_address(dst), nbytes);
hw_desc_init([*seq_size]);
set_din_type([*seq_size], DMA_DLLI, sg_dma_address(src),
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 11bbbc3..713be20 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -1552,7 +1552,7 @@ static int ssi_mac_finup(struct ahash_request *req)
 
SSI_LOG_DEBUG("= finup xcbc(%d) \n", req->nbytes);
if (state->xcbc_count > 0 && req->nbytes == 0) {
-   SSI_LOG_DEBUG("No data to update. Call to fdx_mac_final \n");
+   SSI_LOG_DEBUG("No data to update. Call to fdx_mac_final\n");
return ssi_mac_final(req);
}
 
diff --git a/drivers/staging/ccree/ssi_sysfs.c 
b/drivers/staging/ccree/ssi_sysfs.c
index 802fd49..0655658 100644
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -287,15 +287,15 @@ static ssize_t ssi_sys_regdump_show(struct kobject *kobj,
int offset = 0;
 
register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, 
HOST_SIGNATURE));
-   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X  \n", "HOST_SIGNATURE   ", DX_HOST_SIGNATURE_REG_OFFSET, 
register_value);
+   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X\n", "HOST_SIGNATURE   ", DX_HOST_SIGNATURE_REG_OFFSET, 
register_value);
register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, 
HOST_IRR));
-   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X  \n", "HOST_IRR ", DX_HOST_IRR_REG_OFFSET, register_value);
+   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X\n", "HOST_IRR ", DX_HOST_IRR_REG_OFFSET, register_value);
register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, 
HOST_POWER_DOWN_EN));
-   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X  \n", "HOST_POWER_DOWN_EN   ", DX_HOST_POWER_DOWN_EN_REG_OFFSET, 
register_value);
+   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X\n", "HOST_POWER_DOWN_EN   ", DX_HOST_POWER_DOWN_EN_REG_OFFSET, 
register_value);
register_value =  CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, 
AXIM_MON_ERR));
-   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X  \n", "AXIM_MON_ERR ", DX_AXIM_MON_ERR_REG_OFFSET, 
register_value);
+   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X\n", "AXIM_MON_ERR ", DX_AXIM_MON_ERR_REG_OFFSET, register_value);
register_value = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, 
DSCRPTR_QUEUE_CONTENT));
-   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X  \n", "DSCRPTR_QUEUE_CONTENT", DX_DSCRPTR_QUEUE_CONTENT_REG_OFFSET, 
register_value);
+   offset += scnprintf(buf + offset, PAGE_SIZE - offset, "%s \t(0x%lX)\t 
0x%08X\n", "DSCRPTR_QUEUE_CONTENT", DX_DSCRPTR_QUEUE_CONTENT_REG_OFFSET, 
register_value);
return offset;
 }
 
-- 
2.1.4

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


[PATCH 10/12] staging: ccree: remove func name from log messages

2017-07-13 Thread Gilad Ben-Yossef
The SSI_LOG macros already add __func__ to log messages, so remove
log message that add them a second time in the log message itself.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c   |  4 ++--
 drivers/staging/ccree/ssi_cipher.c | 14 +++---
 drivers/staging/ccree/ssi_driver.c |  2 +-
 drivers/staging/ccree/ssi_hash.c   |  2 +-
 drivers/staging/ccree/ssi_pm.c |  4 ++--
 5 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index c6edef0..aa94839 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -2269,7 +2269,7 @@ static int ssi_gcm_setauthsize(struct crypto_aead 
*authenc,
 static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead *authenc,
   unsigned int authsize)
 {
-   SSI_LOG_DEBUG("ssi_rfc4106_gcm_setauthsize()  authsize %d\n", authsize);
+   SSI_LOG_DEBUG("authsize %d\n", authsize);
 
switch (authsize) {
case 8:
@@ -2286,7 +2286,7 @@ static int ssi_rfc4106_gcm_setauthsize(struct crypto_aead 
*authenc,
 static int ssi_rfc4543_gcm_setauthsize(struct crypto_aead *authenc,
   unsigned int authsize)
 {
-   SSI_LOG_DEBUG("ssi_rfc4543_gcm_setauthsize()  authsize %d\n", authsize);
+   SSI_LOG_DEBUG("authsize %d\n", authsize);
 
if (authsize != 16)
return -EINVAL;
diff --git a/drivers/staging/ccree/ssi_cipher.c 
b/drivers/staging/ccree/ssi_cipher.c
index 7e34236..3402022 100644
--- a/drivers/staging/ccree/ssi_cipher.c
+++ b/drivers/staging/ccree/ssi_cipher.c
@@ -304,7 +304,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm,
  ctx_p, crypto_tfm_alg_name(tfm), keylen);
dump_byte_array("key", (u8 *)key, keylen);
 
-   SSI_LOG_DEBUG("ssi_blkcipher_setkey: after FIPS check");
+   SSI_LOG_DEBUG("after FIPS check");
 
/* STAT_PHASE_0: Init and sanity checks */
 
@@ -350,7 +350,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm,
}
 
ctx_p->keylen = keylen;
-   SSI_LOG_DEBUG("ssi_blkcipher_setkey: ssi_is_hw_key ret 0");
+   SSI_LOG_DEBUG("ssi_is_hw_key ret 0");
 
return 0;
}
@@ -360,19 +360,19 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm,
if (unlikely(!des_ekey(tmp, key)) &&
(crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_WEAK_KEY)) {
tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY;
-   SSI_LOG_DEBUG("ssi_blkcipher_setkey:  weak DES key");
+   SSI_LOG_DEBUG("weak DES key");
return -EINVAL;
}
}
if ((ctx_p->cipher_mode == DRV_CIPHER_XTS) &&
xts_check_key(tfm, key, keylen) != 0) {
-   SSI_LOG_DEBUG("ssi_blkcipher_setkey: weak XTS key");
+   SSI_LOG_DEBUG("weak XTS key");
return -EINVAL;
}
if ((ctx_p->flow_mode == S_DIN_to_DES) &&
(keylen == DES3_EDE_KEY_SIZE) &&
ssi_verify_3des_keys(key, keylen) != 0) {
-   SSI_LOG_DEBUG("ssi_blkcipher_setkey: weak 3DES key");
+   SSI_LOG_DEBUG("weak 3DES key");
return -EINVAL;
}
 
@@ -387,7 +387,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm,
if (ctx_p->key_round_number < CC_MULTI2_MIN_NUM_ROUNDS ||
ctx_p->key_round_number > CC_MULTI2_MAX_NUM_ROUNDS) {
crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
-   SSI_LOG_DEBUG("ssi_blkcipher_setkey: SSI_CC_HAS_MULTI2 
einval");
+   SSI_LOG_DEBUG("SSI_CC_HAS_MULTI2 einval");
return -EINVAL;
 #endif /*SSI_CC_HAS_MULTI2*/
} else {
@@ -414,7 +414,7 @@ static int ssi_blkcipher_setkey(struct crypto_tfm *tfm,
   max_key_buf_size, DMA_TO_DEVICE);
ctx_p->keylen = keylen;
 
-SSI_LOG_DEBUG("ssi_blkcipher_setkey: return safely");
+SSI_LOG_DEBUG("return safely");
return 0;
 }
 
diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index c07a028..d104dbd 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -81,7 +81,7 @@ void dump_byte_array(const char *name, const u8 *the_array, 
unsigned long size)
char line_buf[80];
 
if (!the_array) {
-   SSI_LOG_ERR("cannot dump_byte_array - NULL pointer\n");
+   SSI_LOG_ERR("cannot dump array - NULL pointer\n");
return;
}
 
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index 9c9c48b..292250e 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -974,7 +974,7 @@ static int 

[PATCH 09/12] staging: ccree: avoid unnecessary line continuation

2017-07-13 Thread Gilad Ben-Yossef
Avoid unnecessary line continuation in log function call.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 8a1c408..c6edef0 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -1864,8 +1864,9 @@ static inline void ssi_aead_dump_gcm(
SSI_LOG_DEBUG("%s\n", title);
}
 
-   SSI_LOG_DEBUG("cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, 
cryptlen %d\n", \
-ctx->cipher_mode, ctx->authsize, 
ctx->enc_keylen, req->assoclen, req_ctx->cryptlen);
+   SSI_LOG_DEBUG("cipher_mode %d, authsize %d, enc_keylen %d, assoclen %d, 
cryptlen %d\n",
+ ctx->cipher_mode, ctx->authsize, ctx->enc_keylen,
+ req->assoclen, req_ctx->cryptlen);
 
if (ctx->enckey)
dump_byte_array("mac key", ctx->enckey, 16);
-- 
2.1.4

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


[PATCH 07/12] staging: ccree: CamelCase to snake_case in aead struct

2017-07-13 Thread Gilad Ben-Yossef
Rename aead_req_struct fields from CamelCase to snake_case.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c   | 26 ++--
 drivers/staging/ccree/ssi_aead.h   | 12 +++---
 drivers/staging/ccree/ssi_buffer_mgr.c | 78 +-
 3 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 6d5cf02..dab4914 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -251,8 +251,8 @@ static void ssi_aead_complete(struct device *dev, void 
*ssi_req, void __iomem *c
} else { /*ENCRYPT*/
if (unlikely(areq_ctx->is_icv_fragmented))
ssi_buffer_mgr_copy_scatterlist_portion(
-   areq_ctx->mac_buf, areq_ctx->dstSgl, 
areq->cryptlen + areq_ctx->dstOffset,
-   areq->cryptlen + areq_ctx->dstOffset + 
ctx->authsize, SSI_SG_FROM_BUF);
+   areq_ctx->mac_buf, areq_ctx->dst_sgl, 
areq->cryptlen + areq_ctx->dst_offset,
+   areq->cryptlen + areq_ctx->dst_offset + 
ctx->authsize, SSI_SG_FROM_BUF);
 
/* If an IV was generated, copy it back to the user provided 
buffer. */
if (areq_ctx->backup_giv) {
@@ -777,11 +777,11 @@ ssi_aead_process_authenc_data_desc(
{
struct scatterlist *cipher =
(direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ?
-   areq_ctx->dstSgl : areq_ctx->srcSgl;
+   areq_ctx->dst_sgl : areq_ctx->src_sgl;
 
unsigned int offset =
(direct == DRV_CRYPTO_DIRECTION_ENCRYPT) ?
-   areq_ctx->dstOffset : areq_ctx->srcOffset;
+   areq_ctx->dst_offset : areq_ctx->src_offset;
SSI_LOG_DEBUG("AUTHENC: SRC/DST buffer type DLLI\n");
hw_desc_init([idx]);
set_din_type([idx], DMA_DLLI,
@@ -843,11 +843,11 @@ ssi_aead_process_cipher_data_desc(
SSI_LOG_DEBUG("CIPHER: SRC/DST buffer type DLLI\n");
hw_desc_init([idx]);
set_din_type([idx], DMA_DLLI,
-(sg_dma_address(areq_ctx->srcSgl) +
- areq_ctx->srcOffset), areq_ctx->cryptlen, NS_BIT);
+(sg_dma_address(areq_ctx->src_sgl) +
+ areq_ctx->src_offset), areq_ctx->cryptlen, 
NS_BIT);
set_dout_dlli([idx],
- (sg_dma_address(areq_ctx->dstSgl) +
-  areq_ctx->dstOffset),
+ (sg_dma_address(areq_ctx->dst_sgl) +
+  areq_ctx->dst_offset),
  areq_ctx->cryptlen, NS_BIT, 0);
set_flow_mode([idx], flow_mode);
break;
@@ -1880,7 +1880,7 @@ static inline void ssi_aead_dump_gcm(
 
dump_byte_array("mac_buf", req_ctx->mac_buf, AES_BLOCK_SIZE);
 
-   dump_byte_array("gcm_len_block", req_ctx->gcm_len_block.lenA, 
AES_BLOCK_SIZE);
+   dump_byte_array("gcm_len_block", req_ctx->gcm_len_block.len_a, 
AES_BLOCK_SIZE);
 
if (req->src && req->cryptlen)
dump_byte_array("req->src", sg_virt(req->src), req->cryptlen + 
req->assoclen);
@@ -1919,16 +1919,16 @@ static int config_gcm_context(struct aead_request *req)
__be64 temp64;
 
temp64 = cpu_to_be64(req->assoclen * 8);
-   memcpy(_ctx->gcm_len_block.lenA, , sizeof(temp64));
+   memcpy(_ctx->gcm_len_block.len_a, , sizeof(temp64));
temp64 = cpu_to_be64(cryptlen * 8);
-   memcpy(_ctx->gcm_len_block.lenC, , 8);
+   memcpy(_ctx->gcm_len_block.len_c, , 8);
} else { //rfc4543=>  all data(AAD,IV,Plain) are considered additional 
data that is nothing is encrypted.
__be64 temp64;
 
temp64 = cpu_to_be64((req->assoclen + GCM_BLOCK_RFC4_IV_SIZE + 
cryptlen) * 8);
-   memcpy(_ctx->gcm_len_block.lenA, , sizeof(temp64));
+   memcpy(_ctx->gcm_len_block.len_a, , sizeof(temp64));
temp64 = 0;
-   memcpy(_ctx->gcm_len_block.lenC, , 8);
+   memcpy(_ctx->gcm_len_block.len_c, , 8);
}
 
return 0;
diff --git a/drivers/staging/ccree/ssi_aead.h b/drivers/staging/ccree/ssi_aead.h
index 39cc633..e85bcd9 100644
--- a/drivers/staging/ccree/ssi_aead.h
+++ b/drivers/staging/ccree/ssi_aead.h
@@ -69,8 +69,8 @@ struct aead_req_ctx {
u8 gcm_iv_inc2[AES_BLOCK_SIZE] cacheline_aligned;
u8 hkey[AES_BLOCK_SIZE] cacheline_aligned;
struct {
-   u8 lenA[GCM_BLOCK_LEN_SIZE] cacheline_aligned;
-   u8 lenC[GCM_BLOCK_LEN_SIZE];
+   u8 len_a[GCM_BLOCK_LEN_SIZE] cacheline_aligned;
+  

[PATCH 03/12] staging: ccree: use proper printk format for dma_addr_t

2017-07-13 Thread Gilad Ben-Yossef
Fix needless casting to unsigned long long in printk for
DMA addresses by using proper %pad format.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c| 16 
 drivers/staging/ccree/ssi_buffer_mgr.c  | 48 
 drivers/staging/ccree/ssi_cipher.c  | 20 +-
 drivers/staging/ccree/ssi_driver.c  |  6 +--
 drivers/staging/ccree/ssi_hash.c| 65 -
 drivers/staging/ccree/ssi_request_mgr.c |  8 ++--
 6 files changed, 81 insertions(+), 82 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index fd37dde..43455b9 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -102,8 +102,8 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
/* Unmap enckey buffer */
if (ctx->enckey) {
dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, 
ctx->enckey_dma_addr);
-   SSI_LOG_DEBUG("Freed enckey DMA buffer 
enckey_dma_addr=0x%llX\n",
-   (unsigned long long)ctx->enckey_dma_addr);
+   SSI_LOG_DEBUG("Freed enckey DMA buffer enckey_dma_addr=%pad\n",
+ ctx->enckey_dma_addr);
ctx->enckey_dma_addr = 0;
ctx->enckey = NULL;
}
@@ -116,8 +116,8 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
  xcbc->xcbc_keys,
  xcbc->xcbc_keys_dma_addr);
}
-   SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer 
xcbc_keys_dma_addr=0x%llX\n",
- (unsigned long long)xcbc->xcbc_keys_dma_addr);
+   SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer 
xcbc_keys_dma_addr=%pad\n",
+ xcbc->xcbc_keys_dma_addr);
xcbc->xcbc_keys_dma_addr = 0;
xcbc->xcbc_keys = NULL;
} else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */
@@ -127,8 +127,8 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
dma_free_coherent(dev, 2 * MAX_HMAC_DIGEST_SIZE,
  hmac->ipad_opad,
  hmac->ipad_opad_dma_addr);
-   SSI_LOG_DEBUG("Freed ipad_opad DMA buffer 
ipad_opad_dma_addr=0x%llX\n",
- (unsigned long 
long)hmac->ipad_opad_dma_addr);
+   SSI_LOG_DEBUG("Freed ipad_opad DMA buffer 
ipad_opad_dma_addr=%pad\n",
+ hmac->ipad_opad_dma_addr);
hmac->ipad_opad_dma_addr = 0;
hmac->ipad_opad = NULL;
}
@@ -136,8 +136,8 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
dma_free_coherent(dev, MAX_HMAC_BLOCK_SIZE,
  hmac->padded_authkey,
  hmac->padded_authkey_dma_addr);
-   SSI_LOG_DEBUG("Freed padded_authkey DMA buffer 
padded_authkey_dma_addr=0x%llX\n",
-   (unsigned long 
long)hmac->padded_authkey_dma_addr);
+   SSI_LOG_DEBUG("Freed padded_authkey DMA buffer 
padded_authkey_dma_addr=%pad\n",
+ hmac->padded_authkey_dma_addr);
hmac->padded_authkey_dma_addr = 0;
hmac->padded_authkey = NULL;
}
diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index 4127f9f..dcd78f6 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -259,9 +259,9 @@ static int ssi_buffer_mgr_generate_mlli(
mlli_params->mlli_len = (total_nents * LLI_ENTRY_BYTE_SIZE);
 
SSI_LOG_DEBUG("MLLI params: "
-"virt_addr=%pK dma_addr=0x%llX mlli_len=0x%X\n",
+"virt_addr=%pK dma_addr=%pad mlli_len=0x%X\n",
   mlli_params->mlli_virt_addr,
-  (unsigned long long)mlli_params->mlli_dma_addr,
+  mlli_params->mlli_dma_addr,
   mlli_params->mlli_len);
 
 build_mlli_exit:
@@ -275,9 +275,9 @@ static inline void ssi_buffer_mgr_add_buffer_entry(
 {
unsigned int index = sgl_data->num_of_buffers;
 
-   SSI_LOG_DEBUG("index=%u single_buff=0x%llX "
+   SSI_LOG_DEBUG("index=%u single_buff=%pad "
 "buffer_len=0x%08X is_last=%d\n",
-index, (unsigned long long)buffer_dma, buffer_len, 
is_last_entry);
+index, buffer_dma, buffer_len, is_last_entry);
sgl_data->nents[index] = 1;
sgl_data->entry[index].buffer_dma = buffer_dma;
sgl_data->offset[index] = 0;
@@ -358,10 +358,10 @@ static int ssi_buffer_mgr_map_scatterlist(
SSI_LOG_ERR("dma_map_sg() 

[PATCH 05/12] staging: ccree: fix split strings

2017-07-13 Thread Gilad Ben-Yossef
Fix strings in log messages being split across lines and the resulting
alignment issues when being fixed.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c|  9 ++--
 drivers/staging/ccree/ssi_buffer_mgr.c  | 86 ++---
 drivers/staging/ccree/ssi_cipher.c  | 27 +--
 drivers/staging/ccree/ssi_driver.c  |  4 +-
 drivers/staging/ccree/ssi_hash.c| 43 -
 drivers/staging/ccree/ssi_ivgen.c   |  8 +--
 drivers/staging/ccree/ssi_request_mgr.c | 13 ++---
 7 files changed, 81 insertions(+), 109 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 51a2b73..2d6ba8d 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -240,9 +240,8 @@ static void ssi_aead_complete(struct device *dev, void 
*ssi_req, void __iomem *c
if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
if (memcmp(areq_ctx->mac_buf, areq_ctx->icv_virt_addr,
   ctx->authsize) != 0) {
-   SSI_LOG_DEBUG("Payload authentication failure, "
-   "(auth-size=%d, cipher=%d).\n",
-   ctx->authsize, ctx->cipher_mode);
+   SSI_LOG_DEBUG("Payload authentication failure, 
(auth-size=%d, cipher=%d).\n",
+ ctx->authsize, ctx->cipher_mode);
/* In case of payload authentication failure, MUST NOT
 * revealed the decrypted message --> zero its memory.
 */
@@ -455,8 +454,8 @@ ssi_get_plain_hmac_key(struct crypto_aead *tfm, const u8 
*key, unsigned int keyl
if (likely(keylen != 0)) {
key_dma_addr = dma_map_single(dev, (void *)key, keylen, 
DMA_TO_DEVICE);
if (unlikely(dma_mapping_error(dev, key_dma_addr))) {
-   SSI_LOG_ERR("Mapping key va=0x%p len=%u for"
-  " DMA failed\n", key, keylen);
+   SSI_LOG_ERR("Mapping key va=0x%p len=%u for DMA 
failed\n",
+   key, keylen);
return -ENOMEM;
}
if (keylen > blocksize) {
diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index c3960d1..ed3945b 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -82,8 +82,8 @@ static unsigned int ssi_buffer_mgr_get_sgl_nents(
 
while (nbytes != 0) {
if (sg_is_chain(sg_list)) {
-   SSI_LOG_ERR("Unexpected chained entry "
-  "in sg (entry =0x%X)\n", nents);
+   SSI_LOG_ERR("Unexpected chained entry in sg (entry 
=0x%X)\n",
+   nents);
BUG();
}
if (sg_list->length != 0) {
@@ -258,11 +258,9 @@ static int ssi_buffer_mgr_generate_mlli(
/* Set MLLI size for the bypass operation */
mlli_params->mlli_len = (total_nents * LLI_ENTRY_BYTE_SIZE);
 
-   SSI_LOG_DEBUG("MLLI params: "
-"virt_addr=%pK dma_addr=%pad mlli_len=0x%X\n",
-  mlli_params->mlli_virt_addr,
-  mlli_params->mlli_dma_addr,
-  mlli_params->mlli_len);
+   SSI_LOG_DEBUG("MLLI params: virt_addr=%pK dma_addr=%pad 
mlli_len=0x%X\n",
+ mlli_params->mlli_virt_addr, mlli_params->mlli_dma_addr,
+ mlli_params->mlli_len);
 
 build_mlli_exit:
return rc;
@@ -275,9 +273,8 @@ static inline void ssi_buffer_mgr_add_buffer_entry(
 {
unsigned int index = sgl_data->num_of_buffers;
 
-   SSI_LOG_DEBUG("index=%u single_buff=%pad "
-"buffer_len=0x%08X is_last=%d\n",
-index, buffer_dma, buffer_len, is_last_entry);
+   SSI_LOG_DEBUG("index=%u single_buff=%pad buffer_len=0x%08X 
is_last=%d\n",
+ index, buffer_dma, buffer_len, is_last_entry);
sgl_data->nents[index] = 1;
sgl_data->entry[index].buffer_dma = buffer_dma;
sgl_data->offset[index] = 0;
@@ -358,8 +355,7 @@ static int ssi_buffer_mgr_map_scatterlist(
SSI_LOG_ERR("dma_map_sg() single buffer failed\n");
return -ENOMEM;
}
-   SSI_LOG_DEBUG("Mapped sg: dma_address=%pad "
-"page=%p addr=%pK offset=%u "
+   SSI_LOG_DEBUG("Mapped sg: dma_address=%pad page=%p addr=%pK 
offset=%u "
 "length=%u\n",
 sg_dma_address(sg),
 sg_page(sg),
@@ -418,12 +414,10 @@ ssi_aead_handle_config_buf(struct device *dev,
sg_init_one(_ctx->ccm_adata_sg, config_data, AES_BLOCK_SIZE + 

[PATCH 06/12] staging: ccree: CamelCase to snake_case in func vars

2017-07-13 Thread Gilad Ben-Yossef
Turn local vars and function parameters names in CamelCase
to snake_case.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c   | 26 +-
 drivers/staging/ccree/ssi_buffer_mgr.c | 15 ---
 drivers/staging/ccree/ssi_hash.c   | 29 +++--
 3 files changed, 36 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 2d6ba8d..6d5cf02 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -307,7 +307,7 @@ static int xcbc_setkey(struct cc_hw_desc *desc, struct 
ssi_aead_ctx *ctx)
 
 static int hmac_setkey(struct cc_hw_desc *desc, struct ssi_aead_ctx *ctx)
 {
-   unsigned int hmacPadConst[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST };
+   unsigned int hmac_pad_const[2] = { HMAC_IPAD_CONST, HMAC_OPAD_CONST };
unsigned int digest_ofs = 0;
unsigned int hash_mode = (ctx->auth_mode == DRV_HASH_SHA1) ?
DRV_HASH_HW_SHA1 : DRV_HASH_HW_SHA256;
@@ -341,7 +341,7 @@ static int hmac_setkey(struct cc_hw_desc *desc, struct 
ssi_aead_ctx *ctx)
 
/* Prepare ipad key */
hw_desc_init([idx]);
-   set_xor_val([idx], hmacPadConst[i]);
+   set_xor_val([idx], hmac_pad_const[i]);
set_cipher_mode([idx], hash_mode);
set_flow_mode([idx], S_DIN_to_HASH);
set_setup_mode([idx], SETUP_LOAD_STATE1);
@@ -1381,27 +1381,27 @@ static int validate_data_size(struct ssi_aead_ctx *ctx,
 }
 
 #if SSI_CC_HAS_AES_CCM
-static unsigned int format_ccm_a0(u8 *pA0Buff, u32 headerSize)
+static unsigned int format_ccm_a0(u8 *pa0_buff, u32 header_size)
 {
unsigned int len = 0;
 
-   if (headerSize == 0)
+   if (header_size == 0)
return 0;
 
-   if (headerSize < ((1UL << 16) - (1UL << 8))) {
+   if (header_size < ((1UL << 16) - (1UL << 8))) {
len = 2;
 
-   pA0Buff[0] = (headerSize >> 8) & 0xFF;
-   pA0Buff[1] = headerSize & 0xFF;
+   pa0_buff[0] = (header_size >> 8) & 0xFF;
+   pa0_buff[1] = header_size & 0xFF;
} else {
len = 6;
 
-   pA0Buff[0] = 0xFF;
-   pA0Buff[1] = 0xFE;
-   pA0Buff[2] = (headerSize >> 24) & 0xFF;
-   pA0Buff[3] = (headerSize >> 16) & 0xFF;
-   pA0Buff[4] = (headerSize >> 8) & 0xFF;
-   pA0Buff[5] = headerSize & 0xFF;
+   pa0_buff[0] = 0xFF;
+   pa0_buff[1] = 0xFE;
+   pa0_buff[2] = (header_size >> 24) & 0xFF;
+   pa0_buff[3] = (header_size >> 16) & 0xFF;
+   pa0_buff[4] = (header_size >> 8) & 0xFF;
+   pa0_buff[5] = header_size & 0xFF;
}
 
return len;
diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index ed3945b..b707cbc 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -182,8 +182,8 @@ static inline int ssi_buffer_mgr_render_buff_to_mlli(
 }
 
 static inline int ssi_buffer_mgr_render_scatterlist_to_mlli(
-   struct scatterlist *sgl, u32 sgl_data_len, u32 sglOffset, u32 
*curr_nents,
-   u32 **mlli_entry_pp)
+   struct scatterlist *sgl, u32 sgl_data_len, u32 sgl_offset,
+   u32 *curr_nents, u32 **mlli_entry_pp)
 {
struct scatterlist *curr_sgl = sgl;
u32 *mlli_entry_p = *mlli_entry_pp;
@@ -192,16 +192,17 @@ static inline int 
ssi_buffer_mgr_render_scatterlist_to_mlli(
for ( ; (curr_sgl) && (sgl_data_len != 0);
  curr_sgl = sg_next(curr_sgl)) {
u32 entry_data_len =
-   (sgl_data_len > sg_dma_len(curr_sgl) - sglOffset) ?
-   sg_dma_len(curr_sgl) - sglOffset : sgl_data_len;
+   (sgl_data_len > sg_dma_len(curr_sgl) - sgl_offset) ?
+   sg_dma_len(curr_sgl) - sgl_offset :
+   sgl_data_len;
sgl_data_len -= entry_data_len;
rc = ssi_buffer_mgr_render_buff_to_mlli(
-   sg_dma_address(curr_sgl) + sglOffset, entry_data_len, 
curr_nents,
-   _entry_p);
+   sg_dma_address(curr_sgl) + sgl_offset, entry_data_len,
+   curr_nents, _entry_p);
if (rc != 0)
return rc;
 
-   sglOffset = 0;
+   sgl_offset = 0;
}
*mlli_entry_pp = mlli_entry_p;
return 0;
diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c
index d0c8a8d..9c9c48b 100644
--- a/drivers/staging/ccree/ssi_hash.c
+++ b/drivers/staging/ccree/ssi_hash.c
@@ -965,7 +965,7 @@ static int ssi_hash_setkey(void *hash,
   unsigned int keylen,
 

[PATCH 08/12] staging: ccree: avoid constant comparison

2017-07-13 Thread Gilad Ben-Yossef
Re-write predicate to avoid constant comparison.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index dab4914..8a1c408 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -1573,7 +1573,7 @@ static int config_ccm_adata(struct aead_request *req)
 
/* taken from crypto/ccm.c */
/* 2 <= L <= 8, so 1 <= L' <= 7. */
-   if (2 > l || l > 8) {
+   if (l < 2 || l > 8) {
SSI_LOG_ERR("illegal iv value %X\n", req->iv[0]);
return -EINVAL;
}
-- 
2.1.4

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


[PATCH 04/12] staging: ccree: fix parenthesis alignment

2017-07-13 Thread Gilad Ben-Yossef
Fix various remaining parenthesis alignment issues.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c| 46 +
 drivers/staging/ccree/ssi_buffer_mgr.c  | 30 ++-
 drivers/staging/ccree/ssi_cipher.c  |  2 +-
 drivers/staging/ccree/ssi_hash.c| 88 +
 drivers/staging/ccree/ssi_ivgen.c   |  5 +-
 drivers/staging/ccree/ssi_request_mgr.c |  4 +-
 6 files changed, 96 insertions(+), 79 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 43455b9..51a2b73 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -96,7 +96,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
 
SSI_LOG_DEBUG("Clearing context @%p for %s\n",
-   crypto_aead_ctx(tfm), crypto_tfm_alg_name(>base));
+ crypto_aead_ctx(tfm), crypto_tfm_alg_name(>base));
 
dev = >drvdata->plat_dev->dev;
/* Unmap enckey buffer */
@@ -163,7 +163,7 @@ static int ssi_aead_init(struct crypto_aead *tfm)
 
/* Allocate key buffer, cache line aligned */
ctx->enckey = dma_alloc_coherent(dev, AES_MAX_KEY_SIZE,
-   >enckey_dma_addr, GFP_KERNEL);
+>enckey_dma_addr, GFP_KERNEL);
if (!ctx->enckey) {
SSI_LOG_ERR("Failed allocating key buffer\n");
goto init_failed;
@@ -239,7 +239,7 @@ static void ssi_aead_complete(struct device *dev, void 
*ssi_req, void __iomem *c
 
if (areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT) {
if (memcmp(areq_ctx->mac_buf, areq_ctx->icv_virt_addr,
-   ctx->authsize) != 0) {
+  ctx->authsize) != 0) {
SSI_LOG_DEBUG("Payload authentication failure, "
"(auth-size=%d, cipher=%d).\n",
ctx->authsize, ctx->cipher_mode);
@@ -378,7 +378,7 @@ static int hmac_setkey(struct cc_hw_desc *desc, struct 
ssi_aead_ctx *ctx)
 static int validate_keys_sizes(struct ssi_aead_ctx *ctx)
 {
SSI_LOG_DEBUG("enc_keylen=%u  authkeylen=%u\n",
-   ctx->enc_keylen, ctx->auth_keylen);
+ ctx->enc_keylen, ctx->auth_keylen);
 
switch (ctx->auth_mode) {
case DRV_HASH_SHA1:
@@ -402,7 +402,7 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx)
if (unlikely(ctx->flow_mode == S_DIN_to_DES)) {
if (ctx->enc_keylen != DES3_EDE_KEY_SIZE) {
SSI_LOG_ERR("Invalid cipher(3DES) key size: %u\n",
-   ctx->enc_keylen);
+   ctx->enc_keylen);
return -EINVAL;
}
} else { /* Default assumed to be AES ciphers */
@@ -410,7 +410,7 @@ static int validate_keys_sizes(struct ssi_aead_ctx *ctx)
(ctx->enc_keylen != AES_KEYSIZE_192) &&
(ctx->enc_keylen != AES_KEYSIZE_256)) {
SSI_LOG_ERR("Invalid cipher(AES) key size: %u\n",
-   ctx->enc_keylen);
+   ctx->enc_keylen);
return -EINVAL;
}
}
@@ -553,7 +553,8 @@ ssi_aead_setkey(struct crypto_aead *tfm, const u8 *key, 
unsigned int keylen)
int seq_len = 0, rc = -EINVAL;
 
SSI_LOG_DEBUG("Setting key in context @%p for %s. key=%p keylen=%u\n",
-   ctx, crypto_tfm_alg_name(crypto_aead_tfm(tfm)), key, keylen);
+ ctx, crypto_tfm_alg_name(crypto_aead_tfm(tfm)), key,
+ keylen);
 
/* STAT_PHASE_0: Init and sanity checks */
 
@@ -684,7 +685,7 @@ static int ssi_aead_setauthsize(
 
 #if SSI_CC_HAS_AES_CCM
 static int ssi_rfc4309_ccm_setauthsize(struct crypto_aead *authenc,
- unsigned int authsize)
+  unsigned int authsize)
 {
switch (authsize) {
case 8:
@@ -699,7 +700,7 @@ static int ssi_rfc4309_ccm_setauthsize(struct crypto_aead 
*authenc,
 }
 
 static int ssi_ccm_setauthsize(struct crypto_aead *authenc,
- unsigned int authsize)
+  unsigned int authsize)
 {
switch (authsize) {
case 4:
@@ -1183,7 +1184,7 @@ static inline void ssi_aead_load_mlli_to_sram(
(req_ctx->data_buff_type == SSI_DMA_BUF_MLLI) ||
!req_ctx->is_single_pass)) {
SSI_LOG_DEBUG("Copy-to-sram: mlli_dma=%08x, mlli_size=%u\n",
-   (unsigned int)ctx->drvdata->mlli_sram_addr,
+ (unsigned int)ctx->drvdata->mlli_sram_addr,
req_ctx->mlli_params.mlli_len);
/* Copy MLLI table host-to-sram */

[PATCH 01/12] staging: ccree remove unnecessary parentheses

2017-07-13 Thread Gilad Ben-Yossef
Remove unnecessary parentheses from ccree driver code.

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c| 4 ++--
 drivers/staging/ccree/ssi_buffer_mgr.c  | 8 
 drivers/staging/ccree/ssi_driver.c  | 2 +-
 drivers/staging/ccree/ssi_ivgen.c   | 2 +-
 drivers/staging/ccree/ssi_request_mgr.c | 2 +-
 drivers/staging/ccree/ssi_sysfs.c   | 8 
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 3a10c31..99eeeda 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -92,7 +92,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
 
SSI_LOG_DEBUG("Clearing context @%p for %s\n",
-   crypto_aead_ctx(tfm), crypto_tfm_alg_name(&(tfm->base)));
+   crypto_aead_ctx(tfm), crypto_tfm_alg_name(>base));
 
dev = >drvdata->plat_dev->dev;
/* Unmap enckey buffer */
@@ -143,7 +143,7 @@ static int ssi_aead_init(struct crypto_aead *tfm)
struct ssi_aead_ctx *ctx = crypto_aead_ctx(tfm);
struct ssi_crypto_alg *ssi_alg =
container_of(alg, struct ssi_crypto_alg, aead_alg);
-   SSI_LOG_DEBUG("Initializing context @%p for %s\n", ctx, 
crypto_tfm_alg_name(&(tfm->base)));
+   SSI_LOG_DEBUG("Initializing context @%p for %s\n", ctx, 
crypto_tfm_alg_name(>base));
 
/* Initialize modes in instance */
ctx->cipher_mode = ssi_alg->cipher_mode;
diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c 
b/drivers/staging/ccree/ssi_buffer_mgr.c
index feeaf8d..4127f9f 100644
--- a/drivers/staging/ccree/ssi_buffer_mgr.c
+++ b/drivers/staging/ccree/ssi_buffer_mgr.c
@@ -221,7 +221,7 @@ static int ssi_buffer_mgr_generate_mlli(
/* Allocate memory from the pointed pool */
mlli_params->mlli_virt_addr = dma_pool_alloc(
mlli_params->curr_pool, GFP_KERNEL,
-   &(mlli_params->mlli_dma_addr));
+   _params->mlli_dma_addr);
if (unlikely(!mlli_params->mlli_virt_addr)) {
SSI_LOG_ERR("dma_pool_alloc() failed\n");
rc = -ENOMEM;
@@ -249,7 +249,7 @@ static int ssi_buffer_mgr_generate_mlli(
/*Calculate the current MLLI table length for the
 *length field in the descriptor
 */
-   *(sg_data->mlli_nents[i]) +=
+   *sg_data->mlli_nents[i] +=
(total_nents - prev_total_nents);
prev_total_nents = total_nents;
}
@@ -1176,7 +1176,7 @@ static inline int ssi_buffer_mgr_aead_chain_data(
 
rc = ssi_buffer_mgr_map_scatterlist(dev, req->dst, size_for_map,
DMA_BIDIRECTIONAL,
-   &(areq_ctx->dst.nents),
+   _ctx->dst.nents,
LLI_MAX_NUM_OF_DATA_ENTRIES,
_last_bytes,
_mapped_nents);
@@ -1407,7 +1407,7 @@ int ssi_buffer_mgr_map_aead_request(
if (is_gcm4543)
size_to_map += crypto_aead_ivsize(tfm);
rc = ssi_buffer_mgr_map_scatterlist(dev, req->src,
-   size_to_map, DMA_BIDIRECTIONAL, 
&(areq_ctx->src.nents),
+   size_to_map, DMA_BIDIRECTIONAL, 
_ctx->src.nents,
LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES + 
LLI_MAX_NUM_OF_DATA_ENTRIES, , _nents);
if (unlikely(rc != 0)) {
rc = -ENOMEM;
diff --git a/drivers/staging/ccree/ssi_driver.c 
b/drivers/staging/ccree/ssi_driver.c
index afb7c48..4246c9b 100644
--- a/drivers/staging/ccree/ssi_driver.c
+++ b/drivers/staging/ccree/ssi_driver.c
@@ -327,7 +327,7 @@ static int init_cc_resources(struct platform_device 
*plat_dev)
}
 
 #ifdef ENABLE_CC_SYSFS
-   rc = ssi_sysfs_init(&(plat_dev->dev.kobj), new_drvdata);
+   rc = ssi_sysfs_init(_dev->dev.kobj, new_drvdata);
if (unlikely(rc != 0)) {
SSI_LOG_ERR("init_stat_db failed\n");
goto init_cc_res_err;
diff --git a/drivers/staging/ccree/ssi_ivgen.c 
b/drivers/staging/ccree/ssi_ivgen.c
index 5ff3368..025bff5 100644
--- a/drivers/staging/ccree/ssi_ivgen.c
+++ b/drivers/staging/ccree/ssi_ivgen.c
@@ -158,7 +158,7 @@ int ssi_ivgen_init_sram_pool(struct ssi_drvdata *drvdata)
 void ssi_ivgen_fini(struct ssi_drvdata *drvdata)
 {
struct ssi_ivgen_ctx *ivgen_ctx = drvdata->ivgen_handle;
-   struct device *device = &(drvdata->plat_dev->dev);
+   struct device *device = >plat_dev->dev;
 
if (!ivgen_ctx)
  

[PATCH 02/12] staging: ccree: clean up struct ssi_aead_ctx

2017-07-13 Thread Gilad Ben-Yossef
struct ssi_aead_ctx has some nested structure defined, resulting
in code accessing them to be very unreadable.

Move out the nested structure definitions out of the struct
and use the change to make the code accessing it more readable
and better coding style compliant by shortening lines and
properly matching alignment,

Signed-off-by: Gilad Ben-Yossef 
---
 drivers/staging/ccree/ssi_aead.c | 108 +++
 1 file changed, 64 insertions(+), 44 deletions(-)

diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c
index 99eeeda..fd37dde 100644
--- a/drivers/staging/ccree/ssi_aead.c
+++ b/drivers/staging/ccree/ssi_aead.c
@@ -56,22 +56,26 @@ struct ssi_aead_handle {
struct list_head aead_list;
 };
 
+struct cc_hmac_s {
+   u8 *padded_authkey;
+   u8 *ipad_opad; /* IPAD, OPAD*/
+   dma_addr_t padded_authkey_dma_addr;
+   dma_addr_t ipad_opad_dma_addr;
+};
+
+struct cc_xcbc_s {
+   u8 *xcbc_keys; /* K1,K2,K3 */
+   dma_addr_t xcbc_keys_dma_addr;
+};
+
 struct ssi_aead_ctx {
struct ssi_drvdata *drvdata;
u8 ctr_nonce[MAX_NONCE_SIZE]; /* used for ctr3686 iv and aes ccm */
u8 *enckey;
dma_addr_t enckey_dma_addr;
union {
-   struct {
-   u8 *padded_authkey;
-   u8 *ipad_opad; /* IPAD, OPAD*/
-   dma_addr_t padded_authkey_dma_addr;
-   dma_addr_t ipad_opad_dma_addr;
-   } hmac;
-   struct {
-   u8 *xcbc_keys; /* K1,K2,K3 */
-   dma_addr_t xcbc_keys_dma_addr;
-   } xcbc;
+   struct cc_hmac_s hmac;
+   struct cc_xcbc_s xcbc;
} auth_state;
unsigned int enc_keylen;
unsigned int auth_keylen;
@@ -105,33 +109,37 @@ static void ssi_aead_exit(struct crypto_aead *tfm)
}
 
if (ctx->auth_mode == DRV_HASH_XCBC_MAC) { /* XCBC authetication */
-   if (ctx->auth_state.xcbc.xcbc_keys) {
+   struct cc_xcbc_s *xcbc = >auth_state.xcbc;
+
+   if (xcbc->xcbc_keys) {
dma_free_coherent(dev, CC_AES_128_BIT_KEY_SIZE * 3,
-   ctx->auth_state.xcbc.xcbc_keys,
-   ctx->auth_state.xcbc.xcbc_keys_dma_addr);
+ xcbc->xcbc_keys,
+ xcbc->xcbc_keys_dma_addr);
}
SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer 
xcbc_keys_dma_addr=0x%llX\n",
-   (unsigned long 
long)ctx->auth_state.xcbc.xcbc_keys_dma_addr);
-   ctx->auth_state.xcbc.xcbc_keys_dma_addr = 0;
-   ctx->auth_state.xcbc.xcbc_keys = NULL;
+ (unsigned long long)xcbc->xcbc_keys_dma_addr);
+   xcbc->xcbc_keys_dma_addr = 0;
+   xcbc->xcbc_keys = NULL;
} else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */
-   if (ctx->auth_state.hmac.ipad_opad) {
+   struct cc_hmac_s *hmac = >auth_state.hmac;
+
+   if (hmac->ipad_opad) {
dma_free_coherent(dev, 2 * MAX_HMAC_DIGEST_SIZE,
-   ctx->auth_state.hmac.ipad_opad,
-   ctx->auth_state.hmac.ipad_opad_dma_addr);
+ hmac->ipad_opad,
+ hmac->ipad_opad_dma_addr);
SSI_LOG_DEBUG("Freed ipad_opad DMA buffer 
ipad_opad_dma_addr=0x%llX\n",
-   (unsigned long 
long)ctx->auth_state.hmac.ipad_opad_dma_addr);
-   ctx->auth_state.hmac.ipad_opad_dma_addr = 0;
-   ctx->auth_state.hmac.ipad_opad = NULL;
+ (unsigned long 
long)hmac->ipad_opad_dma_addr);
+   hmac->ipad_opad_dma_addr = 0;
+   hmac->ipad_opad = NULL;
}
-   if (ctx->auth_state.hmac.padded_authkey) {
+   if (hmac->padded_authkey) {
dma_free_coherent(dev, MAX_HMAC_BLOCK_SIZE,
-   ctx->auth_state.hmac.padded_authkey,
-   ctx->auth_state.hmac.padded_authkey_dma_addr);
+ hmac->padded_authkey,
+ hmac->padded_authkey_dma_addr);
SSI_LOG_DEBUG("Freed padded_authkey DMA buffer 
padded_authkey_dma_addr=0x%llX\n",
-   (unsigned long 
long)ctx->auth_state.hmac.padded_authkey_dma_addr);
-   ctx->auth_state.hmac.padded_authkey_dma_addr = 0;
-   ctx->auth_state.hmac.padded_authkey = NULL;
+   (unsigned long 
long)hmac->padded_authkey_dma_addr);
+   

[PATCH 00/12] staging: ccree: coding style fixes

2017-07-13 Thread Gilad Ben-Yossef
Another batch of ccree coding style fixes.

These goes on top of commit a8c4ae12 ("staging: ccree: Fix alignment issues in 
ssi_sysfs.c")
in staging-testing.

Gilad Ben-Yossef (12):
  staging: ccree remove unnecessary parentheses
  staging: ccree: clean up struct ssi_aead_ctx
  staging: ccree: use proper printk format for dma_addr_t
  staging: ccree: fix parenthesis alignment
  staging: ccree: fix split strings
  staging: ccree: CamelCase to snake_case in func vars
  staging: ccree: CamelCase to snake_case in aead struct
  staging: ccree: avoid constant comparison
  staging: ccree: avoid unnecessary line continuation
  staging: ccree: remove func name from log messages
  staging: ccree: kmalloc by sizeof var not type
  staging: ccree: remove whitespace before a quoted newline

 drivers/staging/ccree/ssi_aead.c| 242 +--
 drivers/staging/ccree/ssi_aead.h|  12 +-
 drivers/staging/ccree/ssi_buffer_mgr.c  | 247 +++-
 drivers/staging/ccree/ssi_cipher.c  |  65 -
 drivers/staging/ccree/ssi_driver.c  |  16 +--
 drivers/staging/ccree/ssi_hash.c| 209 ++-
 drivers/staging/ccree/ssi_ivgen.c   |  17 +--
 drivers/staging/ccree/ssi_pm.c  |   4 +-
 drivers/staging/ccree/ssi_request_mgr.c |  29 ++--
 drivers/staging/ccree/ssi_sysfs.c   |  18 +--
 10 files changed, 435 insertions(+), 424 deletions(-)

-- 
2.1.4

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


Re: [PATCH v2] [media] lirc_zilog: Clean up lirc zilog error codes

2017-07-13 Thread Frans Klaver
Almost there on the subject. Stuff between brackets is removed by git,
so you should rather use something like

[PATCH v2] staging: lirc: Clean up zilog error codes

On Wed, Jul 12, 2017 at 9:17 PM, Yves Lemée  wrote:
> According the coding style guidelines, the ENOSYS error code must be returned
> in case of a non existent system call. This code has been replaced with
> the ENOTTY error code indicating a missing functionality.
>
> v2: Improved punctuation
> Fixed patch subject

This change info goes below the --- line and just above the diffstat.


> Signed-off-by: Yves Lemée 
> ---
>  drivers/staging/media/lirc/lirc_zilog.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/staging/media/lirc/lirc_zilog.c 
> b/drivers/staging/media/lirc/lirc_zilog.c
> index 015e41bd036e..26dd32d5b5b2 100644
> --- a/drivers/staging/media/lirc/lirc_zilog.c
> +++ b/drivers/staging/media/lirc/lirc_zilog.c
> @@ -1249,7 +1249,7 @@ static long ioctl(struct file *filep, unsigned int cmd, 
> unsigned long arg)
> break;
> case LIRC_GET_REC_MODE:
> if (!(features & LIRC_CAN_REC_MASK))
> -   return -ENOSYS;
> +   return -ENOTTY;
>
> result = put_user(LIRC_REC2MODE
>   (features & LIRC_CAN_REC_MASK),
> @@ -1257,21 +1257,21 @@ static long ioctl(struct file *filep, unsigned int 
> cmd, unsigned long arg)
> break;
> case LIRC_SET_REC_MODE:
> if (!(features & LIRC_CAN_REC_MASK))
> -   return -ENOSYS;
> +   return -ENOTTY;
>
> result = get_user(mode, uptr);
> if (!result && !(LIRC_MODE2REC(mode) & features))
> -   result = -EINVAL;
> +   result = -ENOTTY;
> break;
> case LIRC_GET_SEND_MODE:
> if (!(features & LIRC_CAN_SEND_MASK))
> -   return -ENOSYS;
> +   return -ENOTTY;
>
> result = put_user(LIRC_MODE_PULSE, uptr);
> break;
> case LIRC_SET_SEND_MODE:
> if (!(features & LIRC_CAN_SEND_MASK))
> -   return -ENOSYS;
> +   return -ENOTTY;
>
> result = get_user(mode, uptr);
> if (!result && mode != LIRC_MODE_PULSE)
> --
> 2.13.2
>
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 2/2] staging: atomisp2: hmm: Alignment code (rebased)

2017-07-13 Thread Philipp Guendisch
This patch fixed code alignment to open paranthesis.
Semantic should not be affected by this patch.

It has been rebased on top of media_tree atomisp branch

Signed-off-by: Philipp Guendisch 
Signed-off-by: Chris Baller 
---
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   | 93 +++---
 1 file changed, 45 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c 
b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
index b345025..b8aae4b 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
@@ -55,7 +55,7 @@ struct _hmm_mem_stat hmm_mem_stat;
 static const char hmm_bo_type_string[] = "psui";
 
 static ssize_t bo_show(struct device *dev, struct device_attribute *attr,
-   char *buf, struct list_head *bo_list, bool active)
+  char *buf, struct list_head *bo_list, bool active)
 {
ssize_t ret = 0;
struct hmm_buffer_object *bo;
@@ -75,10 +75,10 @@ static ssize_t bo_show(struct device *dev, struct 
device_attribute *attr,
spin_lock_irqsave(_device.list_lock, flags);
list_for_each_entry(bo, bo_list, list) {
if ((active && (bo->status & HMM_BO_ALLOCED)) ||
-   (!active && !(bo->status & HMM_BO_ALLOCED))) {
+   (!active && !(bo->status & HMM_BO_ALLOCED))) {
ret = scnprintf(buf + index1, PAGE_SIZE - index1,
-   "%c %d\n",
-   hmm_bo_type_string[bo->type], bo->pgnr);
+   "%c %d\n",
+   hmm_bo_type_string[bo->type], bo->pgnr);
 
total[bo->type] += bo->pgnr;
count[bo->type]++;
@@ -91,9 +91,10 @@ static ssize_t bo_show(struct device *dev, struct 
device_attribute *attr,
for (i = 0; i < HMM_BO_LAST; i++) {
if (count[i]) {
ret = scnprintf(buf + index1 + index2,
-   PAGE_SIZE - index1 - index2,
-   "%ld %c buffer objects: %ld KB\n",
-   count[i], hmm_bo_type_string[i], total[i] * 4);
+   PAGE_SIZE - index1 - index2,
+   "%ld %c buffer objects: %ld KB\n",
+   count[i], hmm_bo_type_string[i],
+   total[i] * 4);
if (ret > 0)
index2 += ret;
}
@@ -103,23 +104,21 @@ static ssize_t bo_show(struct device *dev, struct 
device_attribute *attr,
return index1 + index2 + 1;
 }
 
-static ssize_t active_bo_show(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+static ssize_t active_bo_show(struct device *dev, struct device_attribute 
*attr,
+ char *buf)
 {
return bo_show(dev, attr, buf, _device.entire_bo_list, true);
 }
 
-static ssize_t free_bo_show(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+static ssize_t free_bo_show(struct device *dev, struct device_attribute *attr,
+   char *buf)
 {
return bo_show(dev, attr, buf, _device.entire_bo_list, false);
 }
 
 static ssize_t reserved_pool_show(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+ struct device_attribute *attr,
+ char *buf)
 {
ssize_t ret = 0;
 
@@ -131,7 +130,7 @@ static ssize_t reserved_pool_show(struct device *dev,
 
spin_lock_irqsave(>list_lock, flags);
ret = scnprintf(buf, PAGE_SIZE, "%d out of %d pages available\n",
-   pinfo->index, pinfo->pgnr);
+   pinfo->index, pinfo->pgnr);
spin_unlock_irqrestore(>list_lock, flags);
 
if (ret > 0)
@@ -141,8 +140,8 @@ static ssize_t reserved_pool_show(struct device *dev,
 };
 
 static ssize_t dynamic_pool_show(struct device *dev,
-   struct device_attribute *attr,
-   char *buf)
+struct device_attribute *attr,
+char *buf)
 {
ssize_t ret = 0;
 
@@ -154,7 +153,7 @@ static ssize_t dynamic_pool_show(struct device *dev,
 
spin_lock_irqsave(>list_lock, flags);
ret = scnprintf(buf, PAGE_SIZE, "%d (max %d) pages available\n",
-   pinfo->pgnr, pinfo->pool_size);
+   pinfo->pgnr, pinfo->pool_size);
spin_unlock_irqrestore(>list_lock, flags);
 
if (ret > 0)
@@ -202,7 +201,7 @@ int hmm_init(void)
 
if (!ret) {
ret = 

[PATCH v2 1/2] staging: atomisp2: hmm: Fixed comment style

2017-07-13 Thread Philipp Guendisch
This patch fixed comment style. Semantic should not be affected.
There are also two warnings left about too long lines, which
reduce readability if changed.

Signed-off-by: Philipp Guendisch 
Signed-off-by: Chris Baller 
---
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   | 44 +++---
 1 file changed, 23 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c 
b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
index de0426b..b345025 100644
--- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
@@ -46,10 +46,12 @@ static ia_css_ptr dummy_ptr;
 static bool hmm_initialized;
 struct _hmm_mem_stat hmm_mem_stat;
 
-/* p: private
-   s: shared
-   u: user
-   i: ion */
+/*
+ * p: private
+ * s: shared
+ * u: user
+ * i: ion
+ */
 static const char hmm_bo_type_string[] = "psui";
 
 static ssize_t bo_show(struct device *dev, struct device_attribute *attr,
@@ -213,9 +215,7 @@ void hmm_cleanup(void)
 {
sysfs_remove_group(_dev->kobj, atomisp_attribute_group);
 
-   /*
-* free dummy memory first
-*/
+   /* free dummy memory first */
hmm_free(dummy_ptr);
dummy_ptr = 0;
 
@@ -230,22 +230,24 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
struct hmm_buffer_object *bo;
int ret;
 
-   /* Check if we are initialized. In the ideal world we wouldn't need
-  this but we can tackle it once the driver is a lot cleaner */
+   /*
+* Check if we are initialized. In the ideal world we wouldn't need
+* this but we can tackle it once the driver is a lot cleaner
+*/
 
if (!hmm_initialized)
hmm_init();
-   /*Get page number from size*/
+   /* Get page number from size */
pgnr = size_to_pgnr_ceil(bytes);
 
-   /*Buffer object structure init*/
+   /* Buffer object structure init */
bo = hmm_bo_alloc(_device, pgnr);
if (!bo) {
dev_err(atomisp_dev, "hmm_bo_create failed.\n");
goto create_bo_err;
}
 
-   /*Allocate pages for memory*/
+   /* Allocate pages for memory */
ret = hmm_bo_alloc_pages(bo, type, from_highmem, userptr, cached);
if (ret) {
dev_err(atomisp_dev,
@@ -253,7 +255,7 @@ ia_css_ptr hmm_alloc(size_t bytes, enum hmm_bo_type type,
goto alloc_page_err;
}
 
-   /*Combind the virtual address and pages togather*/
+   /* Combind the virtual address and pages togather */
ret = hmm_bo_bind(bo);
if (ret) {
dev_err(atomisp_dev, "hmm_bo_bind failed.\n");
@@ -319,7 +321,7 @@ static inline int hmm_check_bo(struct hmm_buffer_object 
*bo, unsigned int ptr)
return 0;
 }
 
-/*Read function in ISP memory management*/
+/* Read function in ISP memory management */
 static int load_and_flush_by_kmap(ia_css_ptr virt, void *data, unsigned int 
bytes)
 {
struct hmm_buffer_object *bo;
@@ -362,7 +364,7 @@ static int load_and_flush_by_kmap(ia_css_ptr virt, void 
*data, unsigned int byte
return 0;
 }
 
-/*Read function in ISP memory management*/
+/* Read function in ISP memory management */
 static int load_and_flush(ia_css_ptr virt, void *data, unsigned int bytes)
 {
struct hmm_buffer_object *bo;
@@ -397,7 +399,7 @@ static int load_and_flush(ia_css_ptr virt, void *data, 
unsigned int bytes)
return 0;
 }
 
-/*Read function in ISP memory management*/
+/* Read function in ISP memory management */
 int hmm_load(ia_css_ptr virt, void *data, unsigned int bytes)
 {
if (!data) {
@@ -408,13 +410,13 @@ int hmm_load(ia_css_ptr virt, void *data, unsigned int 
bytes)
return load_and_flush(virt, data, bytes);
 }
 
-/*Flush hmm data from the data cache*/
+/* Flush hmm data from the data cache */
 int hmm_flush(ia_css_ptr virt, unsigned int bytes)
 {
return load_and_flush(virt, NULL, bytes);
 }
 
-/*Write function in ISP memory management*/
+/* Write function in ISP memory management */
 int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes)
 {
struct hmm_buffer_object *bo;
@@ -496,7 +498,7 @@ int hmm_store(ia_css_ptr virt, const void *data, unsigned 
int bytes)
return 0;
 }
 
-/*memset function in ISP memory management*/
+/* memset function in ISP memory management */
 int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
 {
struct hmm_buffer_object *bo;
@@ -556,7 +558,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
return 0;
 }
 
-/*Virtual address to physical address convert*/
+/* Virtual address to physical address convert */
 phys_addr_t hmm_virt_to_phys(ia_css_ptr virt)
 {
unsigned int idx, offset;
@@ -591,7 +593,7 @@ int hmm_mmap(struct vm_area_struct *vma, ia_css_ptr virt)
return hmm_bo_mmap(vma, bo);
 }
 
-/*Map ISP virtual address 

Re: [PATCH] staging: wlan-ng: Use little-endian type

2017-07-13 Thread Frans Klaver
On Wed, Jul 12, 2017 at 6:44 PM, Aviv Palivoda  wrote:
> On Wed, Jul 12, 2017 at 07:26:08AM +0200, Frans Klaver wrote:
>> On Tue, Jul 11, 2017 at 9:51 PM, Aviv Palivoda  wrote:
>> > Fix the following sparse warning:
>> > drivers/staging//wlan-ng/prism2sta.c:1691:20: warning: incorrect type in 
>> > assignment (different base types)
>> >
>> > (a) Change struct hfa384x_authenticate_station_data status member type to 
>> > __le16.
>> > (b) All assignment to status are converted to little-endian prior to 
>> > assignment.
>>
>> Why is this the right thing to do?
>>
>> Frans
>
> In line 1691 the status is converted to little endian:
> rec.status = cpu_to_le16(rec.status);
> Currently status is u16 but is being converted to __le16 by
> cpu_to_le16. This causes a sparse warning as specified in the commit message.
> Converting all P80211ENUM_status_* to little endian prior to assignment will
> happen by the preprocessor. While the current conversion happens at run time.

That's the rationale for the sparse warning, yes, but does not really
answer my question. Does your change improve readability? Why is
algorithm still u16?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel