Re: [PATCH v2 1/3] lib/crc7: Shift crc7() output left 1 bit

From: George Spelvin
Date: Wed May 14 2014 - 21:16:00 EST


H. Peter Anvin wrote:
> If the whole point of this is to use it for MMC/SD cards, why not just
> also subsume the OR 1 and call it crc7_mmc() or something like that.
>
> (Which I'm all for doing... I don't know of any other crc7 users.)

You'll find all users in my patch series. 2/3 updates the MMC
card, while 3/3 hits drivers/net/wireless/ti/wl1251/spi.c and
drivers/net/wireless/ti/wlcore/spi.c (which I'm pretty sure aren't
MMC/SPI cards).

Now, it turns out that they *also* set the lsbit (calling it
WSPI_INIT_CMD_END). However, it's not possible to put that into the CRC
table (it would mess up all bytes but the last), so an explicitly coded
"| 1" is required at the end. Thic ends up being no saving at all to
execution path length, and only moves one instruction from three drivers
to shared code. While making it harder to read the drivers.

A microscopic space saving (if and only if you have more than one of these
drivers loaded) and no performance improvement didn't seem worth it to me.
--
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/