linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: cros_ec: Use proper protocol transfer function
@ 2016-08-10 20:45 Brian Norris
  2016-08-30 14:38 ` Lee Jones
  2016-11-22 22:19 ` Brian Norris
  0 siblings, 2 replies; 6+ messages in thread
From: Brian Norris @ 2016-08-10 20:45 UTC (permalink / raw)
  To: Olof Johansson
  Cc: Lee Jones, linux-kernel, Doug Anderson, Brian Norris,
	Javier Martinez Canillas, Shawn Nematbakhsh, Gwendal Grignou,
	Enric Balletbo, Tomeu Vizoso, Brian Norris

From: Shawn Nematbakhsh <shawnn@chromium.org>

pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had
one instance of these functions correct, but not the second, fall-back
case. We use the fall-back only when the first command returns an
IN_PROGRESS status, which is only used on some EC firmwares where we
don't want to constantly poll the bus, but instead back off and
sleep/retry for a little while.

Fixes: 2c7589af3c4d ("mfd: cros_ec: add proto v3 skeleton")
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
MAINTAINERS tells me this goes through Olof, but many things have gone through
Lee.

 drivers/platform/chrome/cros_ec_proto.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
index 6c084b266651..591f0b0becbd 100644
--- a/drivers/platform/chrome/cros_ec_proto.c
+++ b/drivers/platform/chrome/cros_ec_proto.c
@@ -59,12 +59,14 @@ static int send_command(struct cros_ec_device *ec_dev,
 			struct cros_ec_command *msg)
 {
 	int ret;
+	int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
 
 	if (ec_dev->proto_version > 2)
-		ret = ec_dev->pkt_xfer(ec_dev, msg);
+		xfer_fxn = ec_dev->pkt_xfer;
 	else
-		ret = ec_dev->cmd_xfer(ec_dev, msg);
+		xfer_fxn = ec_dev->cmd_xfer;
 
+	ret = (*xfer_fxn)(ec_dev, msg);
 	if (msg->result == EC_RES_IN_PROGRESS) {
 		int i;
 		struct cros_ec_command *status_msg;
@@ -87,7 +89,7 @@ static int send_command(struct cros_ec_device *ec_dev,
 		for (i = 0; i < EC_COMMAND_RETRIES; i++) {
 			usleep_range(10000, 11000);
 
-			ret = ec_dev->cmd_xfer(ec_dev, status_msg);
+			ret = (*xfer_fxn)(ec_dev, status_msg);
 			if (ret < 0)
 				break;
 
-- 
2.8.0.rc3.226.g39d4020

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

* Re: [PATCH] mfd: cros_ec: Use proper protocol transfer function
  2016-08-10 20:45 [PATCH] mfd: cros_ec: Use proper protocol transfer function Brian Norris
@ 2016-08-30 14:38 ` Lee Jones
  2016-11-22 22:19 ` Brian Norris
  1 sibling, 0 replies; 6+ messages in thread
From: Lee Jones @ 2016-08-30 14:38 UTC (permalink / raw)
  To: Brian Norris
  Cc: Olof Johansson, linux-kernel, Doug Anderson, Brian Norris,
	Javier Martinez Canillas, Shawn Nematbakhsh, Gwendal Grignou,
	Enric Balletbo, Tomeu Vizoso

On Wed, 10 Aug 2016, Brian Norris wrote:

> From: Shawn Nematbakhsh <shawnn@chromium.org>
> 
> pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had
> one instance of these functions correct, but not the second, fall-back
> case. We use the fall-back only when the first command returns an
> IN_PROGRESS status, which is only used on some EC firmwares where we
> don't want to constantly poll the bus, but instead back off and
> sleep/retry for a little while.
> 
> Fixes: 2c7589af3c4d ("mfd: cros_ec: add proto v3 skeleton")
> Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
> MAINTAINERS tells me this goes through Olof, but many things have gone through
> Lee.

Only if there are changes in the set pertaining to MFD.

This one is all Olof's.

>  drivers/platform/chrome/cros_ec_proto.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index 6c084b266651..591f0b0becbd 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -59,12 +59,14 @@ static int send_command(struct cros_ec_device *ec_dev,
>  			struct cros_ec_command *msg)
>  {
>  	int ret;
> +	int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
>  
>  	if (ec_dev->proto_version > 2)
> -		ret = ec_dev->pkt_xfer(ec_dev, msg);
> +		xfer_fxn = ec_dev->pkt_xfer;
>  	else
> -		ret = ec_dev->cmd_xfer(ec_dev, msg);
> +		xfer_fxn = ec_dev->cmd_xfer;
>  
> +	ret = (*xfer_fxn)(ec_dev, msg);
>  	if (msg->result == EC_RES_IN_PROGRESS) {
>  		int i;
>  		struct cros_ec_command *status_msg;
> @@ -87,7 +89,7 @@ static int send_command(struct cros_ec_device *ec_dev,
>  		for (i = 0; i < EC_COMMAND_RETRIES; i++) {
>  			usleep_range(10000, 11000);
>  
> -			ret = ec_dev->cmd_xfer(ec_dev, status_msg);
> +			ret = (*xfer_fxn)(ec_dev, status_msg);
>  			if (ret < 0)
>  				break;
>  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH] mfd: cros_ec: Use proper protocol transfer function
  2016-08-10 20:45 [PATCH] mfd: cros_ec: Use proper protocol transfer function Brian Norris
  2016-08-30 14:38 ` Lee Jones
@ 2016-11-22 22:19 ` Brian Norris
  2016-11-22 23:01   ` Benson Leung
  2016-11-23  8:37   ` Lee Jones
  1 sibling, 2 replies; 6+ messages in thread
From: Brian Norris @ 2016-11-22 22:19 UTC (permalink / raw)
  To: Olof Johansson, Benson Leung
  Cc: Lee Jones, linux-kernel, Doug Anderson, Brian Norris,
	Javier Martinez Canillas, Shawn Nematbakhsh, Gwendal Grignou,
	Enric Balletbo, Tomeu Vizoso

+ Benson

On Wed, Aug 10, 2016 at 01:45:12PM -0700, Brian Norris wrote:
> From: Shawn Nematbakhsh <shawnn@chromium.org>
> 
> pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had
> one instance of these functions correct, but not the second, fall-back
> case. We use the fall-back only when the first command returns an
> IN_PROGRESS status, which is only used on some EC firmwares where we
> don't want to constantly poll the bus, but instead back off and
> sleep/retry for a little while.
> 
> Fixes: 2c7589af3c4d ("mfd: cros_ec: add proto v3 skeleton")
> Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
> Signed-off-by: Brian Norris <briannorris@chromium.org>
> ---
> MAINTAINERS tells me this goes through Olof, but many things have gone through
> Lee.

I believe this was supposed to go through Olof. Olof, are you out there?

Or Benson? I see this:

http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1273587.html
[PATCH] platform/chrome : Add myself as Maintainer

but it's not merged anywhere AFAICT.

I can resend if that helps.

Brian

>  drivers/platform/chrome/cros_ec_proto.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> index 6c084b266651..591f0b0becbd 100644
> --- a/drivers/platform/chrome/cros_ec_proto.c
> +++ b/drivers/platform/chrome/cros_ec_proto.c
> @@ -59,12 +59,14 @@ static int send_command(struct cros_ec_device *ec_dev,
>  			struct cros_ec_command *msg)
>  {
>  	int ret;
> +	int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
>  
>  	if (ec_dev->proto_version > 2)
> -		ret = ec_dev->pkt_xfer(ec_dev, msg);
> +		xfer_fxn = ec_dev->pkt_xfer;
>  	else
> -		ret = ec_dev->cmd_xfer(ec_dev, msg);
> +		xfer_fxn = ec_dev->cmd_xfer;
>  
> +	ret = (*xfer_fxn)(ec_dev, msg);
>  	if (msg->result == EC_RES_IN_PROGRESS) {
>  		int i;
>  		struct cros_ec_command *status_msg;
> @@ -87,7 +89,7 @@ static int send_command(struct cros_ec_device *ec_dev,
>  		for (i = 0; i < EC_COMMAND_RETRIES; i++) {
>  			usleep_range(10000, 11000);
>  
> -			ret = ec_dev->cmd_xfer(ec_dev, status_msg);
> +			ret = (*xfer_fxn)(ec_dev, status_msg);
>  			if (ret < 0)
>  				break;
>  
> -- 
> 2.8.0.rc3.226.g39d4020
> 

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

* Re: [PATCH] mfd: cros_ec: Use proper protocol transfer function
  2016-11-22 22:19 ` Brian Norris
@ 2016-11-22 23:01   ` Benson Leung
  2016-11-23  8:37   ` Lee Jones
  1 sibling, 0 replies; 6+ messages in thread
From: Benson Leung @ 2016-11-22 23:01 UTC (permalink / raw)
  To: Brian Norris
  Cc: Olof Johansson, Lee Jones, linux-kernel, Doug Anderson,
	Brian Norris, Javier Martinez Canillas, Shawn Nematbakhsh,
	Gwendal Grignou, Enric Balletbo, Tomeu Vizoso

Hey Brian,

On Tue, Nov 22, 2016 at 2:19 PM, Brian Norris <briannorris@chromium.org> wrote:
> I believe this was supposed to go through Olof. Olof, are you out there?
>
> Or Benson? I see this:
>
> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1273587.html
> [PATCH] platform/chrome : Add myself as Maintainer
>
> but it's not merged anywhere AFAICT.
>
> I can resend if that helps.

I'll be happy to accept these once I get my chrome-platform maintainer
workflow going. I'm hoping to hear back from Olof as well.


-- 
Benson Leung
Senior Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

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

* Re: [PATCH] mfd: cros_ec: Use proper protocol transfer function
  2016-11-22 22:19 ` Brian Norris
  2016-11-22 23:01   ` Benson Leung
@ 2016-11-23  8:37   ` Lee Jones
  2016-11-28 22:13     ` Brian Norris
  1 sibling, 1 reply; 6+ messages in thread
From: Lee Jones @ 2016-11-23  8:37 UTC (permalink / raw)
  To: Brian Norris
  Cc: Olof Johansson, Benson Leung, linux-kernel, Doug Anderson,
	Brian Norris, Javier Martinez Canillas, Shawn Nematbakhsh,
	Gwendal Grignou, Enric Balletbo, Tomeu Vizoso

On Tue, 22 Nov 2016, Brian Norris wrote:

> + Benson
> 
> On Wed, Aug 10, 2016 at 01:45:12PM -0700, Brian Norris wrote:
> > From: Shawn Nematbakhsh <shawnn@chromium.org>
> > 
> > pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had
> > one instance of these functions correct, but not the second, fall-back
> > case. We use the fall-back only when the first command returns an
> > IN_PROGRESS status, which is only used on some EC firmwares where we
> > don't want to constantly poll the bus, but instead back off and
> > sleep/retry for a little while.
> > 
> > Fixes: 2c7589af3c4d ("mfd: cros_ec: add proto v3 skeleton")

You need to Cc stable with a note saying which kernel version it
fixes.  Grep the `git log`s for stable.*#.

> > Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
> > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > ---
> > MAINTAINERS tells me this goes through Olof, but many things have gone through
> > Lee.
> 
> I believe this was supposed to go through Olof. Olof, are you out there?

Yes, I concur.

There maybe some confusion since the $SUBJECT line is
misleading/incorrect.

> Or Benson? I see this:
> 
> http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1273587.html
> [PATCH] platform/chrome : Add myself as Maintainer
> 
> but it's not merged anywhere AFAICT.
> 
> I can resend if that helps.
> 
> Brian
> 
> >  drivers/platform/chrome/cros_ec_proto.c | 8 +++++---
> >  1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/platform/chrome/cros_ec_proto.c b/drivers/platform/chrome/cros_ec_proto.c
> > index 6c084b266651..591f0b0becbd 100644
> > --- a/drivers/platform/chrome/cros_ec_proto.c
> > +++ b/drivers/platform/chrome/cros_ec_proto.c
> > @@ -59,12 +59,14 @@ static int send_command(struct cros_ec_device *ec_dev,
> >  			struct cros_ec_command *msg)
> >  {
> >  	int ret;
> > +	int (*xfer_fxn)(struct cros_ec_device *ec, struct cros_ec_command *msg);
> >  
> >  	if (ec_dev->proto_version > 2)
> > -		ret = ec_dev->pkt_xfer(ec_dev, msg);
> > +		xfer_fxn = ec_dev->pkt_xfer;
> >  	else
> > -		ret = ec_dev->cmd_xfer(ec_dev, msg);
> > +		xfer_fxn = ec_dev->cmd_xfer;
> >  
> > +	ret = (*xfer_fxn)(ec_dev, msg);
> >  	if (msg->result == EC_RES_IN_PROGRESS) {
> >  		int i;
> >  		struct cros_ec_command *status_msg;
> > @@ -87,7 +89,7 @@ static int send_command(struct cros_ec_device *ec_dev,
> >  		for (i = 0; i < EC_COMMAND_RETRIES; i++) {
> >  			usleep_range(10000, 11000);
> >  
> > -			ret = ec_dev->cmd_xfer(ec_dev, status_msg);
> > +			ret = (*xfer_fxn)(ec_dev, status_msg);
> >  			if (ret < 0)
> >  				break;
> >  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH] mfd: cros_ec: Use proper protocol transfer function
  2016-11-23  8:37   ` Lee Jones
@ 2016-11-28 22:13     ` Brian Norris
  0 siblings, 0 replies; 6+ messages in thread
From: Brian Norris @ 2016-11-28 22:13 UTC (permalink / raw)
  To: Lee Jones
  Cc: Olof Johansson, Benson Leung, linux-kernel, Doug Anderson,
	Brian Norris, Javier Martinez Canillas, Shawn Nematbakhsh,
	Gwendal Grignou, Enric Balletbo, Tomeu Vizoso

Hi Lee,

On Wed, Nov 23, 2016 at 08:37:49AM +0000, Lee Jones wrote:
> On Tue, 22 Nov 2016, Brian Norris wrote:
> > On Wed, Aug 10, 2016 at 01:45:12PM -0700, Brian Norris wrote:
> > > From: Shawn Nematbakhsh <shawnn@chromium.org>
> > > 
> > > pkt_xfer should be used for protocol v3, and cmd_xfer otherwise. We had
> > > one instance of these functions correct, but not the second, fall-back
> > > case. We use the fall-back only when the first command returns an
> > > IN_PROGRESS status, which is only used on some EC firmwares where we
> > > don't want to constantly poll the bus, but instead back off and
> > > sleep/retry for a little while.
> > > 
> > > Fixes: 2c7589af3c4d ("mfd: cros_ec: add proto v3 skeleton")
> 
> You need to Cc stable with a note saying which kernel version it
> fixes.  Grep the `git log`s for stable.*#.

I understand how the stable process works. This was intentional. Fixes
!= stable. It's easy to tag what commit it's supposed to fix. It's less
easy to backport and verify that it's a useful for all affected kernels.

(If somebody else determines it should be backported -- e.g., Benson or
Olof -- then I won't stop them, of course.)

Side note: isn't 'Fixes' a more accurate way of describing which version
it applies to than just putting the kernel version with a '#' comment?
That helps anyone who might have backported the buggy commit -- e.g., as
part of the stable process.

> > > Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
> > > Signed-off-by: Brian Norris <briannorris@chromium.org>
> > > ---
> > > MAINTAINERS tells me this goes through Olof, but many things have gone through
> > > Lee.
> > 
> > I believe this was supposed to go through Olof. Olof, are you out there?
> 
> Yes, I concur.
> 
> There maybe some confusion since the $SUBJECT line is
> misleading/incorrect.

Thanks. I'll resend with a 'platform/chrome:' prefix, and make sure it
shows up in Benson's inbox too. I think I didn't look deeply enough into
history -- the last few commits touching drivers/platform/chrome/ had an
'mfd' tag, but they also happened to touch mfd-prefixed files too.

Brian

> > Or Benson? I see this:
> > 
> > http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1273587.html
> > [PATCH] platform/chrome : Add myself as Maintainer
> > 
> > but it's not merged anywhere AFAICT.
> > 
> > I can resend if that helps.
> > 
> > Brian
[...]

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

end of thread, other threads:[~2016-11-28 22:13 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:45 [PATCH] mfd: cros_ec: Use proper protocol transfer function Brian Norris
2016-08-30 14:38 ` Lee Jones
2016-11-22 22:19 ` Brian Norris
2016-11-22 23:01   ` Benson Leung
2016-11-23  8:37   ` Lee Jones
2016-11-28 22:13     ` Brian Norris

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).