Re: [PATCH 3/3 v2] drivers/bus: Device driver for FSL-MC DPRC devices

From: Timur Tabi
Date: Thu Oct 02 2014 - 13:19:10 EST


German Rivera wrote:

I know that this is not necessary from the point of view of C boolean
semantics, but doing explicit comparison improves readability IMHO.

I guess we'll have to agree to disagree. I think it makes the code less readable.

Anyway, this is subjective and largely a matter of preference.
Besides, "Documentation/CodingStyle" does not seem to advocate one way
or the other.

CodingStyle is a starting point, not the final word. If I had a dime whenever someone insisted a code snippet is okay because it's not covered by CodingStyle, I could retire.

Also, I there is evidence that explicit comparisons are allowed in
the kernel source tree:

Allowed != preferred. Besides, there are tons of examples of almost every style mistake in the kernel today. Some code is really old, or it was accepted by lazy maintainers and never fixed. You can't really use that as a basis for a decision.


+int __must_check dprc_scan_container(struct fsl_mc_device *mc_bus_dev);
+
+int __must_check dprc_scan_objects(struct fsl_mc_device *mc_bus_dev);

__must_check? Really?

Yes, to ensure that callers that are not checking the return code from
dprc_scan_objects() are caught at compile-time (CHECK time).

I know what __must_check is for. I'm just saying that you kinda need to justify using it. It's like using likely() on non-time-critical code. Overuse is worse than not using it at all, and I don't see what's so special about these functions that they need __must_check.

(on a side note, you're supposed to bcc: linuxppc-release@xxxxxxxxxxxxxxxxxxx, not cc: it.)
--
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/