PR 189772 includes a cool drivers for PC Engines APU 1 and 2.
Here is a phab review for adding more reviewer to this PR.
Details
- Reviewers
avg
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Passed - Unit
No Test Coverage - Build Status
Buildable 7871 Build 8011: arc lint + arc unit
Event Timeline
Besides the style issues I have another concern.
Now we would have at least two drivers that can concurrently access AMD PMIO registers. Given that the access is through in an index-data pair of registers, there is a possibility of a conflict. We need to think how to protect those registers from conflicting accesses.
sys/modules/apuled/apuled.c | ||
---|---|---|
58 | You can include that header file here if that helps to avoid duplicate definitions. | |
127 | What purpose does this character device serve? | |
154 | General suggestion: if you move these module and driver definitions to the end of file, then everything wouldcome in its natural order and you wouldn't have to declare prototypes for the methods. | |
156 | It's possible to use bool here if that would make the code clearer. | |
165 | The return value of a function call can not be assigned to, so the usual argument of using this weird order of comparison operands does not apply here :-) | |
253 | New line after break feels redundant. | |
433 | Redundant spaces within "[]". | |
517 | redundant blank line | |
528 | redundant blank line | |
533 | redundant blank line | |
539 | redundant blank line |
Author update his patch and addressed most of the phabricator comments and update it for supporting APU1,2 and 3 boards.
The updated code should answer to all remarks.
About the sys/modules/Makefile diff: I've synced my FreeBSD src tree to the last revision which updated this file, and when I've updated this review it had included by mistake the change.
sys/modules/apuled/apuled.c | ||
---|---|---|
58 | It was not an header file, but a .c : typo fixed on the comment. |
sys/modules/apuled/apuled.c | ||
---|---|---|
58 | Header file no longer exists. It was combined with associated c module. | |
127 | The APU boards also support a mode switch on the front of the case. This device can be used to get current status of switch. | |
156 | This needs to be an int. Return value is used to determine what type of APU board was found. | |
253 | Removed extra line breaks. | |
433 | Removed redundant spaces around all "[]". | |
517 | Removed redundant blank line. | |
528 | Removed redundant blank line. | |
539 | Removed redundant blank line. |
Please address a few minor style comments. Please consider using amd_chipset.h.
I am still somewhat concerned about possible clashes on concurrent accesses to the PMIO space.
sys/modules/apuled/apuled.c | ||
---|---|---|
58 | What I meant was sys/dev/amdsbwd/amd_chipset.h which is alive and well. | |
154 | In the FreeBSD style we do not place a space after an opening parenthesis or before a closing one. | |
156 | okay | |
185 | Too many empty lines in this function's body and in those of the next few functions. I do not see any code that really has to be emphasized by new lines. x = f(); if (x) { ... } is easier to read and takes less visual space than x = f(); if (x) { ... } |
Is there still an interest in getting this moving forward?
I think that it should be relatively easy to address my comments and get this into a committable shape.
As APU2 user, I'm very interested by getting this moving forward… but I'm not a C developer then I can't address your comments: Peraphs original author (@lab_gta.com) can do it ?
Tested this on an APU3 Board. Works great;
but i wonder if it would be smarte to write a gpiobus(4) driver instead and support the other remaining GPIO pins as well.
Addition: the APU2/3 GPIOs are on an other IO controller, and would probably require a different driver, independent of this one.