Skip to contentSkip to conversation

x86, olpc: add debugfs interface for EC commands

PATCH Superseded Daniel Drake 9 participants 16 messages Mar 26, 2012 – Mar 27, 2012 x86

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 x86, olpc: add debugfs interface for EC commands

Add a debugfs interface for sending commands to the OLPC Embedded Controller (EC) and reading the responses. The EC provides functionality for machine identification, battery and AC control, wakeup control, etc.

Having a debugfs interface available is useful for EC development and debugging.

Based on code by Paul Fox.

Originally-from: Paul Fox <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Andres Salomon <[email protected]>

---
 Documentation/ABI/testing/debugfs-olpc |   16 +++++
 arch/x86/platform/olpc/olpc.c          |   97 ++++++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/ABI/testing/debugfs-olpc

v2: incorporate feedback from Andrew Morton (thanks!): documentation in Documentation/, fixed input checking, more correct command bytes construction

v3: incorporate feedback from Ingo Molnar (thanks!): whitespace/cast fixes, fix potential overflow when nonsense resp_bytes is passed from userspace, add mutex to protect data and to protect against concurrent read/write, give node name 'cmd' which is better than 'generic'

v4: really fix sign-off tags

Documentation/ABI/testing/debugfs-olpc new file +16 -0
new file mode 100644
index 0000000..bd76cc6
@@ -0,0 +1,16 @@
+What:		/sys/kernel/debug/olpc-ec/cmd
+Date:		Dec 2011
+KernelVersion:	3.4
+Contact:	[email protected]
+Description:
+
+A generic interface for executing OLPC Embedded Controller commands and
+reading their responses.
+
+To execute a command, write data with the format: CC:N A A A A
+CC is the (hex) command, N is the count of expected reply bytes, and A A A A
+are optional (hex) arguments.
+
+To read the response (if any), read from the generic node after executing
+a command. Hex reply bytes will be returned, *whether or not* they came from
+the immediately previous command.
arch/x86/platform/olpc/olpc.c +97 -0

121 lines not on this page · raw message

Signature · 1 line
1.7.7.6
#1 lore raw
Quoted 16 lines · On Mon, 26 Mar 2012 19:07:07 +0100 (BST) Daniel Drake <[email protected]> wrote:

Add a debugfs interface for sending commands to the OLPC Embedded Controller (EC) and reading the responses. The EC provides functionality for machine identification, battery and AC control, wakeup control, etc.

Having a debugfs interface available is useful for EC development and debugging.

Based on code by Paul Fox.

Originally-from: Paul Fox <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Andres Salomon <[email protected]>

Quoted 3 lines

...

v4: really fix sign-off tags

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

What's going on here? What are you trying to communicate?

#2 lore raw
Quoted 8 lines · Andrew Morton
Quoted 2 lines

v4: really fix sign-off tags

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

What's going on here? What are you trying to communicate?

I have been using "Originally-by:" (not Originally-from:) to indicate content originally written by someone else which has then been dramatically redone. It seems to communicate, but probably should be written into a spec somewhere.

It doesn't make much sense to put that after a Signed-off-by: though (lines are supposed to be in chronological order.)

-hpa

#3 lore raw
Quoted 8 lines · On Mon, 26 Mar 2012 14:31:46 -0700 "H. Peter Anvin" <[email protected]> wrote:
Quoted 7 lines · Andrew Morton
Quoted 2 lines

v4: really fix sign-off tags

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

Quoted 7 lines
Quoted 1 line

What's going on here? What are you trying to communicate?

I have been using "Originally-by:" (not Originally-from:) to indicate content originally written by someone else which has then been dramatically redone. It seems to communicate, but probably should be written into a spec somewhere.

Well, if a person had any contribution at all, we should seek their Signed-off-by:. Otherwise they could say "hey, you admitted using my code but I did not authorise its use", or any other range of bad IANAL things?

If we want to provide additional details on the authorship trail then fine, that can be done in English in the changelog. And it can be done far more clearly than in an ad-hoc tag whose meaning is unclear.

It's pretty unusual to see a patch which was authored by person A to have "From: B". Usually this comes about because B made a mistake. I will always query the authorship on such patches. Sometimes it is deliberate, but there's no consistent pattern in the reasoning. For this reason it is always best to fully explain the authorship alteration in the changelog text.

If we want to add more tag types then OK, we can discuss that, clearly define them, raise a patch against Documentation/SubmittingPatches and start to use them. But let's not invent new ones without explaining to anyone else what they mean.

Generally if I see anything other than "Signed-off-by:", "Cc:", "Tested-by:" "Reported-by:", "Acked-by:" or "Reviewed-by:", I consider them to be undefined and will zap 'em, sometimes transferring the intent into the changelog body instead.

#4 lore raw
Quoted 4 lines · Andrew Morton

Well, if a person had any contribution at all, we should seek their Signed-off-by:. Otherwise they could say "hey, you admitted using my code but I did not authorise its use", or any other range of bad IANAL things?

The Certificate of Origin says:

(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or

If a previous author has given a Signed-off-by then they've clearly indicated that their code is under an appropriate license and may be submitted to the kernel. If someone else then takes that code, modifies it and submits it then there's no obvious reason why we still need the original Signed-off-by. Giving credit to the original author is obviously appropriate, but I don't see why we need any more than that.

Signature · 1 line
Matthew Garrett | [email protected]
#5 lore raw
Quoted 6 lines · Matthew Garrett

If a previous author has given a Signed-off-by then they've clearly indicated that their code is under an appropriate license and may be submitted to the kernel. If someone else then takes that code, modifies it and submits it then there's no obvious reason why we still need the original Signed-off-by. Giving credit to the original author is obviously appropriate, but I don't see why we need any more than that.

Conversely, if a maintainer does fixups on a patch while commiting
it, we *don't* discard the original Signed-off-by. I'd say if somebody's
submitting somebody else's patch, the chain should be:

Signed-off-by original author
Signed-off-by the person who did the updates
Signed-off-by <chain of maintainers heading upstream>
#6 lore raw
In reply to Andrew Morton
Quoted 21 lines · andrew
Quoted 18 lines · On Mon, 26 Mar 2012 19:07:07 +0100 (BST) Daniel Drake <[email protected]> wrote:

Add a debugfs interface for sending commands to the OLPC Embedded Controller (EC) and reading the responses. The EC provides functionality for machine identification, battery and AC control, wakeup control, etc.

Having a debugfs interface available is useful for EC development and debugging.

Based on code by Paul Fox.

Originally-from: Paul Fox <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Andres Salomon <[email protected]>

...

Quoted 7 lines
Quoted 1 line

v4: really fix sign-off tags

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

What's going on here? What are you trying to communicate?

i think the way daniel had it before was likely correct.

i wrote the original code, but it looked pretty different back then. daniel has brought it to its current state. i _then_ added my Signed-off-by.

so the code is both "Based on code by Paul Fox", and my Signed-off-by should come after daniel's (assuming chronological order).

paul
=---------------------
paul fox, [email protected]

#7 lore raw
In reply to Andrew Morton
Quoted 5 lines · Andrew Morton

s/fix/break/?  "Originally-from" is not a recognised tag.  If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

What's going on here?  What are you trying to communicate?

I'm trying to take Ingo's suggestion, in the thread "[patch 1/8] x86,
olpc: add debugfs interface for EC commands" he wrote:

====
This is not a valid signoff sequence - the 'From: ' author of the patch must be the first SOB line.

The way to do this is either to have a:

From: Paul Fox <[email protected]>

or to covert Paul Fox's SOB to a credit line, such as:

Originally-from: Paul Fox <[email protected]>
====

The original code was from Paul Fox. I changed it somewhat significantly, and Paul approves of the end result.
Can someone suggest a way of expressing this, including tag ordering, that will be accepted by all parties? :)

Thanks
Daniel

#8 lore raw
Quoted 21 lines · Daniel Drake
Quoted 5 lines · Andrew Morton

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

What's going on here? What are you trying to communicate?

I'm trying to take Ingo's suggestion, in the thread "[patch 1/8] x86,
olpc: add debugfs interface for EC commands" he wrote:

====
This is not a valid signoff sequence - the 'From: ' author of the patch must be the first SOB line.

The way to do this is either to have a:

From: Paul Fox <[email protected]>

or to covert Paul Fox's SOB to a credit line, such as:

Quoted 8 lines

Originally-from: Paul Fox <[email protected]>
====

The original code was from Paul Fox. I changed it somewhat significantly, and Paul approves of the end result.
Can someone suggest a way of expressing this, including tag ordering, that will be accepted by all parties? :)

My recommendation is:

... followed by Signed-off-by: in the order of patch flow. Approving a patch, when not passing through, is indicated by Acked-by: or Reviewed-by:

-hpa

#9 lore raw
Quoted 31 lines · On Mon, 26 Mar 2012 15:47:08 -0700 "H. Peter Anvin" <[email protected]> wrote:
Quoted 21 lines · Daniel Drake
Quoted 5 lines · Andrew Morton

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

What's going on here? What are you trying to communicate?

I'm trying to take Ingo's suggestion, in the thread "[patch 1/8] x86,
olpc: add debugfs interface for EC commands" he wrote:

====
This is not a valid signoff sequence - the 'From: ' author of the patch must be the first SOB line.

The way to do this is either to have a:

From: Paul Fox <[email protected]>

or to covert Paul Fox's SOB to a credit line, such as:

Quoted 8 lines

Originally-from: Paul Fox <[email protected]>
====

The original code was from Paul Fox. I changed it somewhat significantly, and Paul approves of the end result.
Can someone suggest a way of expressing this, including tag ordering, that will be accepted by all parties? :)

Quoted 6 lines

My recommendation is:

... followed by Signed-off-by: in the order of patch flow. Approving a patch, when not passing through, is indicated by Acked-by: or Reviewed-by:

I'd be OK with that, but first we should define what "Originally-by:" means! I'd want it to mean that a) Paul was the original author and b) Paul approves the recording of Daniel as the primary author.

#10 lore raw
In reply to Daniel Drake
Quoted 21 lines · On Mon, 26 Mar 2012 16:45:10 -0600 Daniel Drake <[email protected]> wrote:
Quoted 5 lines · Andrew Morton

s/fix/break/? __"Originally-from" is not a recognised tag. __If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

What's going on here? __What are you trying to communicate?

I'm trying to take Ingo's suggestion, in the thread "[patch 1/8] x86,
olpc: add debugfs interface for EC commands" he wrote:

====
This is not a valid signoff sequence - the 'From: ' author of the patch must be the first SOB line.

The way to do this is either to have a:

From: Paul Fox <[email protected]>

or to covert Paul Fox's SOB to a credit line, such as:

Quoted 7 lines

Originally-from: Paul Fox <[email protected]>
====

The original code was from Paul Fox. I changed it somewhat significantly, and Paul approves of the end result.
Can someone suggest a way of expressing this, including tag ordering, that will be accepted by all parties? :)

From: Daniel Drake <[email protected]>

....

The original code was from Paul Fox. I changed it somewhat significantly, and Paul approves of the end result.

If I see a changelog like that, I will assume that Paul is OK with you having the primary authorship (although some suspicion remains ;)). Especially when both individuals are from the same organization.

You could swap the order of the Signed-off-by: lines, but the ordering of those lines isn't at all a reliable indication of anything. So nobody should actually *use* the ordering for any purpose. It is best to explicitly clarify these things in the changelog text.

#11 lore raw
Quoted 34 lines · On Mon, 26 Mar 2012 15:53:59 -0700 Andrew Morton <[email protected]>…
Quoted 21 lines · On Mon, 26 Mar 2012 16:45:10 -0600 Daniel Drake <[email protected]> wrote:
Quoted 5 lines · Andrew Morton

s/fix/break/? __"Originally-from" is not a recognised tag. __If this code is based upon an earlier version from Paul then
Signed-off-by: is correct.

What's going on here? __What are you trying to communicate?

I'm trying to take Ingo's suggestion, in the thread "[patch 1/8] x86, olpc: add debugfs interface for EC commands" he wrote:

====
This is not a valid signoff sequence - the 'From: ' author of the patch must be the first SOB line.

The way to do this is either to have a:

From: Paul Fox <[email protected]>

or to covert Paul Fox's SOB to a credit line, such as:

Quoted 7 lines

Originally-from: Paul Fox <[email protected]>
====

The original code was from Paul Fox. I changed it somewhat significantly, and Paul approves of the end result. Can someone suggest a way of expressing this, including tag ordering, that will be accepted by all parties? :)

From: Daniel Drake <[email protected]>

Quoted 7 lines

....

The original code was from Paul Fox. I changed it somewhat significantly, and Paul approves of the end result.

This makes a lot more sense to me (and has been used in the past by both myself and dsd for OLPC submissions) rather than having a plethora of machine-parsable tags that no one cares about. Minus the "approves of the end result" bit, though, as that's implicit in the SOB line. There are innumerable possible variants of this (Originally-by, Co-authored-with, Based-on-code-in-another-project-by, Written-while-being-whipped-by, and so on).

#12 lore raw
In reply to Andrew Morton
Quoted 7 lines · Andrew Morton
Quoted 7 lines

Originally-from: Paul Fox <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Andres Salomon <[email protected]>

Quoted 7 lines
Quoted 3 lines

...

v4: really fix sign-off tags

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

No, the original ordering was *not* correct:

From: Daniel Drake <[email protected]>

[...]

In the previous discussion we had I explained what the rules for signoffs are. Let me quote Linus as well:

" The sign-off chain should be very simple: the first person
to sign off should be the author, and the last person to sign off should be the committer. "

https://lkml.org/lkml/2012/3/22/489

This is not true for this patch, because the first signoff does not match the 'From:' line (author).

Nor is the last signoff the committer - i.e. the person sending me this patch to apply. Every maintainer along the route adds a signoff to the tail if it's propagated via email, or does a merge commit if it's a pull.

If Daniel sends me a patch he should be the last signoff. If he authored the patch then he should also be the first (and, by implication, only) signoff. Signed-off-by does not recognize multiple authorship - that has to be written into the changelog, added via another type of tag - either approach is fine to me.

What I cannot do is to apply patches that have visibly broken signoff chains.

Thanks,

Ingo

#13 lore raw
Quoted 44 lines · On Tue, 27 Mar 2012 01:14:08 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 7 lines · Andrew Morton
Quoted 7 lines

Originally-from: Paul Fox <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Andres Salomon <[email protected]>

Quoted 7 lines
Quoted 3 lines

...

v4: really fix sign-off tags

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

No, the original ordering was *not* correct:

From: Daniel Drake <[email protected]>

[...]

In the previous discussion we had I explained what the rules for signoffs are. Let me quote Linus as well:

" The sign-off chain should be very simple: the first person
to sign off should be the author, and the last person to sign off should be the committer. "

https://lkml.org/lkml/2012/3/22/489

This is not true for this patch, because the first signoff does not match the 'From:' line (author).

Nor is the last signoff the committer - i.e. the person sending me this patch to apply. Every maintainer along the route adds a signoff to the tail if it's propagated via email, or does a merge commit if it's a pull.

Quoted 5 lines

If Daniel sends me a patch he should be the last signoff. If he authored the patch then he should also be the first (and, by implication, only) signoff. Signed-off-by does not recognize multiple authorship - that has to be written into the changelog, added via another type of tag - either approach is fine to me.

That's a bunch of stuff which you and Linus apparently cooked up and didn't tell anyone about and didn't document anywhere. I'd never heard about it before and I doubt if many other people knew about it. And if anyone should have known about it, I should have!

So we have an unknown but probably large number of patches in the tree now which do not follow this rule. So nobody can depend on
Signed-off-by: ordering in the tree as it stands.

So if we want to implement this (new!) rule then let's write the damn thing down (in Documentation/SubmittingPatches) and tell people about it! And, if poss, add a checkpatch rule to detect possible violations.

#14 lore raw
Quoted 53 lines · Andrew Morton
Quoted 44 lines · On Tue, 27 Mar 2012 01:14:08 +0200 Ingo Molnar <[email protected]> wrote:
Quoted 7 lines · Andrew Morton
Quoted 7 lines

Originally-from: Paul Fox <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: Andres Salomon <[email protected]>

Quoted 7 lines
Quoted 3 lines

...

v4: really fix sign-off tags

s/fix/break/? "Originally-from" is not a recognised tag. If this code is based upon an earlier version from Paul then Signed-off-by: is correct.

No, the original ordering was *not* correct:

From: Daniel Drake <[email protected]>

[...]

In the previous discussion we had I explained what the rules for signoffs are. Let me quote Linus as well:

" The sign-off chain should be very simple: the first person
to sign off should be the author, and the last person to sign off should be the committer. "

https://lkml.org/lkml/2012/3/22/489

This is not true for this patch, because the first signoff does not match the 'From:' line (author).

Nor is the last signoff the committer - i.e. the person sending me this patch to apply. Every maintainer along the route adds a signoff to the tail if it's propagated via email, or does a merge commit if it's a pull.

Quoted 5 lines

If Daniel sends me a patch he should be the last signoff. If he authored the patch then he should also be the first (and, by implication, only) signoff. Signed-off-by does not recognize multiple authorship - that has to be written into the changelog, added via another type of tag - either approach is fine to me.

Quoted 3 lines

That's a bunch of stuff which you and Linus apparently cooked up and didn't tell anyone about and didn't document anywhere. [...]

I certainly didn't cook it up with Linus, and I think it's pretty clearly written down in SubmittingPatches:

[[email protected]: struct foo moved from foo.c to foo.h]

It even describes how maintainers append themselves to after the existing Signed-off-by chain - and describes how the author of the patch adds the first Signed-off-by.

So I think it's pretty clearly defined.

Quoted 6 lines

[...] I'd never heard about it before and I doubt if many other people knew about it. And if anyone should have known about it, I should have!

So we have an unknown but probably large number of patches in the tree now which do not follow this rule. [...]

I think all the major Git trees are doing it the way described in SubmittingPatches: first signoff is author and maintainers append a Signed-off-by to the end.

In practice there's a large number of noise in the tree through, as with any information created by humans, to be read by humans and not checked by computers. But this does not justify the intentional creation of noise I think.

Thanks,

Ingo