linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH 0/2] cros_ec: utilize cros_ec_cmd_xfer_status()
@ 2016-08-10 20:37 Brian Norris
  2016-08-10 20:37 ` [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer() Brian Norris
  2016-08-10 20:37 ` [RESEND PATCH 2/2] Input: cros_ec_keyb - " Brian Norris
  0 siblings, 2 replies; 6+ messages in thread
From: Brian Norris @ 2016-08-10 20:37 UTC (permalink / raw)
  To: Dmitry Torokhov, Wolfram Sang
  Cc: Lee Jones, Thierry Reding, Olof Johansson, Brian Norris,
	Javier Martinez Canillas, Enric Balletbo, Shawn Nematbakhsh,
	Gwendal Grignou, Tomeu Vizoso, linux-i2c, linux-kernel,
	linux-input, Guenter Roeck, Brian Norris

Hi all,

This is a resend of some patches I sent previously:

https://lkml.org/lkml/2016/7/25/488

There are no changes to the patch content. Only some additional commit
description and tagging.

The cros_ec_cmd_xfer_status() helper (which helps us better handle some error
scenarios) is now present in v4.8-rc1.

These can be taken independently by their subsystem maintainers. (Wolfram and
Dmitry, who already acked them.)

Regards,
Brian

Brian Norris (2):
  i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer()
  Input: cros_ec_keyb - Fix usage of cros_ec_cmd_xfer()

 drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +-
 drivers/input/keyboard/cros_ec_keyb.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer()
  2016-08-10 20:37 [RESEND PATCH 0/2] cros_ec: utilize cros_ec_cmd_xfer_status() Brian Norris
@ 2016-08-10 20:37 ` Brian Norris
  2016-08-10 21:15   ` Guenter Roeck
  2016-08-14 22:24   ` Wolfram Sang
  2016-08-10 20:37 ` [RESEND PATCH 2/2] Input: cros_ec_keyb - " Brian Norris
  1 sibling, 2 replies; 6+ messages in thread
From: Brian Norris @ 2016-08-10 20:37 UTC (permalink / raw)
  To: Dmitry Torokhov, Wolfram Sang
  Cc: Lee Jones, Thierry Reding, Olof Johansson, Brian Norris,
	Javier Martinez Canillas, Enric Balletbo, Shawn Nematbakhsh,
	Gwendal Grignou, Tomeu Vizoso, linux-i2c, linux-kernel,
	linux-input, Guenter Roeck, Brian Norris,
	# 9798ac6d32c1 mfd : cros_ec : Add cros_ec_cmd_xfer_status
	helper

cros_ec_cmd_xfer returns success status if the command transport
completes successfully, but the execution result is incorrectly ignored.
In many cases, the execution result is assumed to be successful, leading
to ignored errors and operating on uninitialized data.

We've recently introduced the cros_ec_cmd_xfer_status() helper to avoid these
problems. Let's use it.

[Regarding the 'Fixes' tag; there is significant refactoring since the driver's
introduction, but the underlying logical error exists throughout I believe]

Fixes: 9d230c9e4f4e ("i2c: ChromeOS EC tunnel driver")
Cc: <stable@vger.kernel.org> # 9798ac6d32c1 mfd: cros_ec: Add cros_ec_cmd_xfer_status() helper
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Wolfram Sang <wsa@the-dreams.de>
---
 drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
index a0d95ff682ae..2d5ff86398d0 100644
--- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c
+++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
@@ -215,7 +215,7 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[],
 	msg->outsize = request_len;
 	msg->insize = response_len;
 
-	result = cros_ec_cmd_xfer(bus->ec, msg);
+	result = cros_ec_cmd_xfer_status(bus->ec, msg);
 	if (result < 0) {
 		dev_err(dev, "Error transferring EC i2c message %d\n", result);
 		goto exit;
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RESEND PATCH 2/2] Input: cros_ec_keyb - Fix usage of cros_ec_cmd_xfer()
  2016-08-10 20:37 [RESEND PATCH 0/2] cros_ec: utilize cros_ec_cmd_xfer_status() Brian Norris
  2016-08-10 20:37 ` [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer() Brian Norris
@ 2016-08-10 20:37 ` Brian Norris
  2016-08-10 21:16   ` Guenter Roeck
  1 sibling, 1 reply; 6+ messages in thread
From: Brian Norris @ 2016-08-10 20:37 UTC (permalink / raw)
  To: Dmitry Torokhov, Wolfram Sang
  Cc: Lee Jones, Thierry Reding, Olof Johansson, Brian Norris,
	Javier Martinez Canillas, Enric Balletbo, Shawn Nematbakhsh,
	Gwendal Grignou, Tomeu Vizoso, linux-i2c, linux-kernel,
	linux-input, Guenter Roeck, Brian Norris,
	# 9798ac6d32c1 mfd : cros_ec : Add cros_ec_cmd_xfer_status
	helper

cros_ec_cmd_xfer returns success status if the command transport
completes successfully, but the execution result is incorrectly ignored.
In many cases, the execution result is assumed to be successful, leading
to ignored errors and operating on uninitialized data.

We've recently introduced the cros_ec_cmd_xfer_status() helper to avoid these
problems. Let's use it.

[Regarding the 'Fixes' tag; there is significant refactoring since the driver's
introduction, but the underlying logical error exists throughout I believe]

Fixes: 6af6dc2d2aa6 ("input: Add ChromeOS EC keyboard driver")
Cc: <stable@vger.kernel.org> # 9798ac6d32c1 mfd: cros_ec: Add cros_ec_cmd_xfer_status() helper
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/keyboard/cros_ec_keyb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
index b01966dc7eb3..6e48616a3a88 100644
--- a/drivers/input/keyboard/cros_ec_keyb.c
+++ b/drivers/input/keyboard/cros_ec_keyb.c
@@ -160,7 +160,7 @@ static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state)
 	msg->insize = ckdev->cols;
 	msg->outsize = 0;
 
-	ret = cros_ec_cmd_xfer(ckdev->ec, msg);
+	ret = cros_ec_cmd_xfer_status(ckdev->ec, msg);
 	if (ret < 0) {
 		dev_err(ckdev->dev, "Error transferring EC message %d\n", ret);
 		goto exit;
-- 
2.8.0.rc3.226.g39d4020

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer()
  2016-08-10 20:37 ` [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer() Brian Norris
@ 2016-08-10 21:15   ` Guenter Roeck
  2016-08-14 22:24   ` Wolfram Sang
  1 sibling, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2016-08-10 21:15 UTC (permalink / raw)
  To: Brian Norris
  Cc: Dmitry Torokhov, Wolfram Sang, Lee Jones, Thierry Reding,
	Olof Johansson, Brian Norris, Javier Martinez Canillas,
	Enric Balletbo, Shawn Nematbakhsh, Gwendal Grignou, Tomeu Vizoso,
	linux-i2c, linux-kernel, linux-input,
	# 9798ac6d32c1 mfd : cros_ec : Add cros_ec_cmd_xfer_status
	helper

On Wed, Aug 10, 2016 at 01:37:18PM -0700, Brian Norris wrote:
> cros_ec_cmd_xfer returns success status if the command transport
> completes successfully, but the execution result is incorrectly ignored.
> In many cases, the execution result is assumed to be successful, leading
> to ignored errors and operating on uninitialized data.
> 
> We've recently introduced the cros_ec_cmd_xfer_status() helper to avoid these
> problems. Let's use it.
> 
> [Regarding the 'Fixes' tag; there is significant refactoring since the driver's
> introduction, but the underlying logical error exists throughout I believe]
> 
> Fixes: 9d230c9e4f4e ("i2c: ChromeOS EC tunnel driver")
> Cc: <stable@vger.kernel.org> # 9798ac6d32c1 mfd: cros_ec: Add cros_ec_cmd_xfer_status() helper
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
> Acked-by: Wolfram Sang <wsa@the-dreams.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/i2c/busses/i2c-cros-ec-tunnel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
> index a0d95ff682ae..2d5ff86398d0 100644
> --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c
> +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
> @@ -215,7 +215,7 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg i2c_msgs[],
>  	msg->outsize = request_len;
>  	msg->insize = response_len;
>  
> -	result = cros_ec_cmd_xfer(bus->ec, msg);
> +	result = cros_ec_cmd_xfer_status(bus->ec, msg);
>  	if (result < 0) {
>  		dev_err(dev, "Error transferring EC i2c message %d\n", result);
>  		goto exit;
> -- 
> 2.8.0.rc3.226.g39d4020
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RESEND PATCH 2/2] Input: cros_ec_keyb - Fix usage of cros_ec_cmd_xfer()
  2016-08-10 20:37 ` [RESEND PATCH 2/2] Input: cros_ec_keyb - " Brian Norris
@ 2016-08-10 21:16   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2016-08-10 21:16 UTC (permalink / raw)
  To: Brian Norris
  Cc: Dmitry Torokhov, Wolfram Sang, Lee Jones, Thierry Reding,
	Olof Johansson, Brian Norris, Javier Martinez Canillas,
	Enric Balletbo, Shawn Nematbakhsh, Gwendal Grignou, Tomeu Vizoso,
	linux-i2c, linux-kernel, linux-input,
	# 9798ac6d32c1 mfd : cros_ec : Add cros_ec_cmd_xfer_status
	helper

On Wed, Aug 10, 2016 at 01:37:19PM -0700, Brian Norris wrote:
> cros_ec_cmd_xfer returns success status if the command transport
> completes successfully, but the execution result is incorrectly ignored.
> In many cases, the execution result is assumed to be successful, leading
> to ignored errors and operating on uninitialized data.
> 
> We've recently introduced the cros_ec_cmd_xfer_status() helper to avoid these
> problems. Let's use it.
> 
> [Regarding the 'Fixes' tag; there is significant refactoring since the driver's
> introduction, but the underlying logical error exists throughout I believe]
> 
> Fixes: 6af6dc2d2aa6 ("input: Add ChromeOS EC keyboard driver")
> Cc: <stable@vger.kernel.org> # 9798ac6d32c1 mfd: cros_ec: Add cros_ec_cmd_xfer_status() helper
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/input/keyboard/cros_ec_keyb.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c
> index b01966dc7eb3..6e48616a3a88 100644
> --- a/drivers/input/keyboard/cros_ec_keyb.c
> +++ b/drivers/input/keyboard/cros_ec_keyb.c
> @@ -160,7 +160,7 @@ static int cros_ec_keyb_get_state(struct cros_ec_keyb *ckdev, uint8_t *kb_state)
>  	msg->insize = ckdev->cols;
>  	msg->outsize = 0;
>  
> -	ret = cros_ec_cmd_xfer(ckdev->ec, msg);
> +	ret = cros_ec_cmd_xfer_status(ckdev->ec, msg);
>  	if (ret < 0) {
>  		dev_err(ckdev->dev, "Error transferring EC message %d\n", ret);
>  		goto exit;
> -- 
> 2.8.0.rc3.226.g39d4020
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer()
  2016-08-10 20:37 ` [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer() Brian Norris
  2016-08-10 21:15   ` Guenter Roeck
@ 2016-08-14 22:24   ` Wolfram Sang
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2016-08-14 22:24 UTC (permalink / raw)
  To: Brian Norris
  Cc: Dmitry Torokhov, Lee Jones, Thierry Reding, Olof Johansson,
	Brian Norris, Javier Martinez Canillas, Enric Balletbo,
	Shawn Nematbakhsh, Gwendal Grignou, Tomeu Vizoso, linux-i2c,
	linux-kernel, linux-input, Guenter Roeck,
	# 9798ac6d32c1 mfd : cros_ec : Add cros_ec_cmd_xfer_status
	helper

[-- Attachment #1: Type: text/plain, Size: 986 bytes --]

On Wed, Aug 10, 2016 at 01:37:18PM -0700, Brian Norris wrote:
> cros_ec_cmd_xfer returns success status if the command transport
> completes successfully, but the execution result is incorrectly ignored.
> In many cases, the execution result is assumed to be successful, leading
> to ignored errors and operating on uninitialized data.
> 
> We've recently introduced the cros_ec_cmd_xfer_status() helper to avoid these
> problems. Let's use it.
> 
> [Regarding the 'Fixes' tag; there is significant refactoring since the driver's
> introduction, but the underlying logical error exists throughout I believe]
> 
> Fixes: 9d230c9e4f4e ("i2c: ChromeOS EC tunnel driver")
> Cc: <stable@vger.kernel.org> # 9798ac6d32c1 mfd: cros_ec: Add cros_ec_cmd_xfer_status() helper
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> Reviewed-by: Javier Martinez Canillas <javier@osg.samsung.com>
> Acked-by: Wolfram Sang <wsa@the-dreams.de>

Applied to for-current, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-08-14 22:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-10 20:37 [RESEND PATCH 0/2] cros_ec: utilize cros_ec_cmd_xfer_status() Brian Norris
2016-08-10 20:37 ` [RESEND PATCH 1/2] i2c: cros-ec-tunnel: Fix usage of cros_ec_cmd_xfer() Brian Norris
2016-08-10 21:15   ` Guenter Roeck
2016-08-14 22:24   ` Wolfram Sang
2016-08-10 20:37 ` [RESEND PATCH 2/2] Input: cros_ec_keyb - " Brian Norris
2016-08-10 21:16   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).