Re: [PATCH] checkpatch.pl: Add warning for new __packed additions

From: Joe Perches
Date: Mon Feb 24 2014 - 16:00:21 EST


On Mon, 2014-02-24 at 15:38 -0500, Tom Rini wrote:
> While there are valid reasons to use __packed, often the answer is that
> you should be doing something else here instead.
[]
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -4010,6 +4010,11 @@ sub process {
> WARN("PREFER_PACKED",
> "__packed is preferred over __attribute__((packed))\n" . $herecurr);
> }
> +# Check for new packed usage, warn to use care
> + if ($line =~ /\b(__attribute__\s*\(\s*\(.*\bpacked|__packed)\b/) {
> + WARN("NEW_PACKED",
> + "Adding new packed members is to be done with care\n" . $herecurr);
> + }

Hi Tom.

This might be too noisy as it will warn on any use of __packed,
including existing ones if checking using -f/--file.

(there are some odd, probably broken ones in drivers/char/tpm/tpm_acpi.c)

How often is this actually a problem?

It'll warn on any use of packed not just packed members.

This may be better as
"Using 'packed' can impact performance\n"
and only tested when not in --file mode.



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/