#!/bin/bash #checkpatch --no-tree -f checkpatch="/usr/lib/modules/$(uname -r)/build/scripts/checkpatch.pl" if [ -z "$1" ]; then project_dir="$PWD" elif [ -d "$1" ]; then project_dir="$1" else source_file="$1" fi if [ -z "$project_dir" ]; then "${checkpatch}" --no-tree -f "${source_file}" else find "${project_dir}" -regex '.*\.\(c\|h\)' -exec "${checkpatch}" --no-tree -f '{}' + fi