Change checkpatch.pl options for EC projects

The EC codebase may legitimately use volatile, since it accesses
hardware registers:

  volatile int16_t *hword = (uint16_t *)(STM32_OPTB_BASE + byte);

It also has its own implementation of msleep().

  msleep(1);

With the current presubmit checks, these generate checkpatch.pl
warnings.  We've been getting around that with --no-verify, but that
means a number of other problems have crept in.  So, only disable
those two checks.

BUG=chromium:322144
BRANCH=none
TEST=Create a dummy change which adds the two lines of code above.  Add
     trailing whitespace to another line.  Then 'repo upload .' and see
     that volatile and msleep don't generate warnings, but the trailing
     whitespace still does.  This confirms that checkpatch is still being
     called, but the keywords above no longer cause it to fail.

Change-Id: Ib6999adddbccfe513536f867d567a1a01256b4f2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177584
Reviewed-by: Doug Anderson <dianders@chromium.org>
diff --git a/pre-upload.py b/pre-upload.py
index 66849e5..07ca533 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -502,6 +502,11 @@
 def _run_checkpatch_no_tree(project, commit):
   return _run_checkpatch(project, commit, ['--no-tree'])
 
+def _run_checkpatch_ec(project, commit):
+  """Runs checkpatch with options for Chromium EC projects."""
+  return _run_checkpatch(project, commit, ['--no-tree',
+                                           '--ignore=MSLEEP,VOLATILE'])
+
 def _kernel_configcheck(project, commit):
   """Makes sure kernel config changes are not mixed with code changes"""
   files = _get_affected_files(commit)
@@ -604,7 +609,7 @@
     "chromeos/autotest-tools": [_run_json_check],
     "chromeos/overlays/chromeos-overlay": [_check_manifests],
     "chromeos/overlays/chromeos-partner-overlay": [_check_manifests],
-    "chromeos/platform/ec-private": [_run_checkpatch_no_tree,
+    "chromeos/platform/ec-private": [_run_checkpatch_ec,
                                      _check_change_has_branch_field],
     "chromeos/third_party/coreboot": [_check_change_has_branch_field,
                                       _check_google_copyright],
@@ -615,7 +620,7 @@
     "chromiumos/overlays/board-overlays": [_check_manifests],
     "chromiumos/overlays/chromiumos-overlay": [_check_manifests],
     "chromiumos/overlays/portage-stable": [_check_manifests],
-    "chromiumos/platform/ec": [_run_checkpatch_no_tree,
+    "chromiumos/platform/ec": [_run_checkpatch_ec,
                                _check_change_has_branch_field],
     "chromiumos/platform/mosys": [_check_change_has_branch_field],
     "chromiumos/platform/vboot_reference": [_check_change_has_branch_field],