Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: update checkpatch.pl from Linux kernel #1209

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion tests/ci/checkpatch/checkpatch.pl
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ sub hash_show_words {
__ro_after_init|
__kprobes|
$InitAttribute|
__aligned\s*\(.*\)|
____cacheline_aligned|
____cacheline_aligned_in_smp|
____cacheline_internodealigned_in_smp|
Expand Down Expand Up @@ -4054,7 +4055,7 @@ sub process {
if ($prevline =~ /^[\+ ]};?\s*$/ &&
$line =~ /^\+/ &&
!($line =~ /^\+\s*$/ ||
$line =~ /^\+\s*(?:EXPORT_SYMBOL|early_param)/ ||
$line =~ /^\+\s*(?:EXPORT_SYMBOL|early_param|ALLOW_ERROR_INJECTION)/ ||
$line =~ /^\+\s*MODULE_/i ||
$line =~ /^\+\s*\#\s*(?:end|elif|else)/ ||
$line =~ /^\+[a-z_]*init/ ||
Expand Down Expand Up @@ -7011,6 +7012,25 @@ sub process {
"Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see: https://github.com/KSPP/linux/issues/90\n" . $herecurr);
}

# ethtool_sprintf uses that should likely be ethtool_puts
if ($line =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*$FuncArg\s*\)/) {
if (WARN("PREFER_ETHTOOL_PUTS",
"Prefer ethtool_puts over ethtool_sprintf with only two arguments\n" . $herecurr) &&
$fix) {
$fixed[$fixlinenr] =~ s/\bethtool_sprintf\s*\(\s*($FuncArg)\s*,\s*($FuncArg)/ethtool_puts($1, $7)/;
}
}

# use $rawline because $line loses %s via sanitization and thus we can't match against it.
if ($rawline =~ /\bethtool_sprintf\s*\(\s*$FuncArg\s*,\s*\"\%s\"\s*,\s*$FuncArg\s*\)/) {
if (WARN("PREFER_ETHTOOL_PUTS",
"Prefer ethtool_puts over ethtool_sprintf with standalone \"%s\" specifier\n" . $herecurr) &&
$fix) {
$fixed[$fixlinenr] =~ s/\bethtool_sprintf\s*\(\s*($FuncArg)\s*,\s*"\%s"\s*,\s*($FuncArg)/ethtool_puts($1, $7)/;
}
}


# typecasts on min/max could be min_t/max_t
if ($perl_version_ok &&
defined $stat &&
Expand Down
2 changes: 2 additions & 0 deletions tests/ci/checkpatch/const_structs.checkpatch
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ acpi_dock_ops
address_space_operations
backlight_ops
block_device_operations
bus_type
clk_ops
comedi_lrange
component_ops
dentry_operations
dev_pm_ops
device_type
dma_map_ops
driver_info
drm_connector_funcs
Expand Down
14 changes: 14 additions & 0 deletions tests/ci/checkpatch/spelling.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ accelaration||acceleration
accelearion||acceleration
acceleratoin||acceleration
accelleration||acceleration
accelrometer||accelerometer
accesing||accessing
accesnt||accent
accessable||accessible
Expand Down Expand Up @@ -137,6 +138,7 @@ anniversery||anniversary
annoucement||announcement
anomolies||anomalies
anomoly||anomaly
anonynous||anonymous
anway||anyway
aplication||application
appearence||appearance
Expand Down Expand Up @@ -267,6 +269,7 @@ cadidate||candidate
cahces||caches
calender||calendar
calescing||coalescing
calibraiton||calibration
calle||called
callibration||calibration
callled||called
Expand All @@ -288,6 +291,7 @@ capabitilies||capabilities
capablity||capability
capatibilities||capabilities
capapbilities||capabilities
captuer||capture
caputure||capture
carefuly||carefully
cariage||carriage
Expand Down Expand Up @@ -340,6 +344,7 @@ comminucation||communication
commited||committed
commiting||committing
committ||commit
commmand||command
commnunication||communication
commoditiy||commodity
comsume||consume
Expand Down Expand Up @@ -406,6 +411,7 @@ continious||continuous
continous||continuous
continously||continuously
continueing||continuing
contiuous||continuous
contraints||constraints
contruct||construct
contol||control
Expand Down Expand Up @@ -757,6 +763,7 @@ hardward||hardware
havind||having
heirarchically||hierarchically
heirarchy||hierarchy
heirachy||hierarchy
helpfull||helpful
hearbeat||heartbeat
heterogenous||heterogeneous
Expand Down Expand Up @@ -1199,6 +1206,7 @@ priting||printing
privilaged||privileged
privilage||privilege
priviledge||privilege
priviledged||privileged
priviledges||privileges
privleges||privileges
probaly||probably
Expand Down Expand Up @@ -1251,6 +1259,7 @@ purgable||purgeable
pwoer||power
queing||queuing
quering||querying
querrying||querying
queus||queues
randomally||randomly
raoming||roaming
Expand Down Expand Up @@ -1324,6 +1333,7 @@ reseting||resetting
reseved||reserved
reseverd||reserved
resizeable||resizable
resonable||reasonable
resotre||restore
resouce||resource
resouces||resources
Expand Down Expand Up @@ -1427,6 +1437,7 @@ sliped||slipped
softwade||software
softwares||software
soley||solely
soluation||solution
souce||source
speach||speech
specfic||specific
Expand Down Expand Up @@ -1458,6 +1469,7 @@ standart||standard
standy||standby
stardard||standard
staticly||statically
statisitcs||statistics
statuss||status
stoped||stopped
stoping||stopping
Expand Down Expand Up @@ -1548,6 +1560,7 @@ threds||threads
threee||three
threshhold||threshold
thresold||threshold
throtting||throttling
throught||through
tansition||transition
trackling||tracking
Expand All @@ -1571,6 +1584,7 @@ tranasction||transaction
tranceiver||transceiver
tranfer||transfer
tranmission||transmission
tranport||transport
transcevier||transceiver
transciever||transceiver
transferd||transferred
Expand Down