Page MenuHomeFreeBSD

apuled(4): add support for LEDs on PC Engines APU boards
Needs ReviewPublic

Authored by olivier on Mar 3 2017, 12:41 PM.
Tags
None
Referenced Files
F104101326: D9876.id75938.diff
Tue, Dec 3, 2:00 PM
F104080619: D9876.diff
Tue, Dec 3, 7:08 AM
Unknown Object (File)
Sun, Dec 1, 1:52 PM
Unknown Object (File)
Sun, Dec 1, 6:58 AM
Unknown Object (File)
Fri, Nov 29, 2:59 AM
Unknown Object (File)
Fri, Nov 29, 2:59 AM
Unknown Object (File)
Fri, Nov 29, 2:59 AM
Unknown Object (File)
Fri, Nov 29, 2:59 AM

Details

Reviewers
avg
Summary

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.

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

olivier retitled this revision from to apuled(4): add support for LEDs on PC Engines APU boards.
olivier updated this object.
olivier edited the test plan for this revision. (Show Details)

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.
See intpm.c for an example.

127

What purpose does this character device serve?
I thought that hooking into led(4) infrastructure would be sufficient.

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.
There are a few more instances of this elsewhere.

433

Redundant spaces within "[]".
There are several more cases like this.

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.

lab_gta.com added inline comments.
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.
Please remove the extra spaces here and in other function signatures.

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.
E.g.

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.

In D9876#280057, @avg wrote:

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 ?

In D9876#280057, @avg wrote:

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.

We're using this code in production., it would be helpful to have it committed.

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.

Updating the patch to latest -head.