-
Notifications
You must be signed in to change notification settings - Fork 165
fs/sysfs: MIPS: Don't translate all IOCTLs #402
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
1 similar comment
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here (e.g. What to do if you already signed the CLAIndividual signers
Corporate signers
|
I signed it! |
CLAs look good, thanks! |
1 similar comment
CLAs look good, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for verifying and working on a fix. That's really appreciated.
Exporting these function was something I discussed with @NeuralSpaz but wasn't sure about it up to now.
Please try to make the travis check pass.
d6a0b04
to
7079ed8
Compare
Codecov Report
@@ Coverage Diff @@
## master #402 +/- ##
==========================================
+ Coverage 64.39% 64.71% +0.31%
==========================================
Files 118 116 -2
Lines 11806 11726 -80
==========================================
- Hits 7603 7588 -15
+ Misses 4001 3937 -64
+ Partials 202 201 -1
Continue to review full report at Codecov.
|
host/sysfs/spi_test.go
Outdated
} | ||
} | ||
|
||
func TestSPIIOCTx(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That test should fail on mips, right? We should delete this then, because anyway we have gohci workers that ensure that SPI works for real.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, they do fail. I verified this by cross-compiling the test and then running it on the target. I wasn't sure how to test this. Should we include arch-specific unit tests or just rely on the gohci tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to test for the constants, integration testing will suffice here. Maybe the only thing that would be cool is to add a test to spismoketest: read the values back via an ioctl on the file handle to confirm that the values were setup properly; that's the reason why the "read value back to confirm" code was written, as a long time ago the code was trying to write value and was silently failing (oops).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR, I don't ask you to do the spismoketest check here, what you did is already great.
I still think the dead code and const checks should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a check to read back the mode flag since that's the only flag we set during initialization. SPI_IOC_MESSAGE
doesn't have a corresponding _IOR ioctl, so we can't verify the message ioctl.
I'm unsure if the GetFlag
approach is the right one here, what do you think?
gohci |
host/sysfs/spi_test.go
Outdated
} | ||
} | ||
|
||
func TestSPIIOCTx(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FTR, I don't ask you to do the spismoketest check here, what you did is already great.
I still think the dead code and const checks should be removed.
Some IOCTLs are fixed, e.g. i2c-dev. There, we must not translate the IOCTLs. Instead, the IOCTLs are generated arch-dependent in the fs package.
Beside being clearer, the comment in the code was incorrect. The message box magic is in fact 'd' = 100 = 0x64, not 0x100.
4c3cccd
to
d6aa45c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's great, will merge a bit later I have to go
Sorry for the delay, but can you fix https://github.com/google/periph/blob/master/host/sysfs/i2c.go#L205 too? Otherwise I²C will be broken. |
gohci |
Are you sure? The whole point of this PR was to not translate the IOCTLs for I2C on MIPS because they're fixed and not dependent on the _IO{R,W,} macros. See https://github.com/torvalds/linux/blob/master/include/uapi/linux/i2c-dev.h#L36 Perhaps I am misunderstanding you here? |
Duh, sorry. |
\o/ |
Some IOCTLs are fixed, e.g. i2c-dev. There, we must not translate the
IOCTLs. Instead, the IOCTLs are generated arch-dependent in the fs
package.
Fixes #361