can: bittiming: add CAN_KBPS, CAN_MBPS and CAN_MHZ macros
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Sat, 6 Mar 2021 05:40:40 +0000 (14:40 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Tue, 30 Mar 2021 09:14:45 +0000 (11:14 +0200)
commit1d7750760b70ba8b0e641146eee1b3a343d1b292
tree18a32fdd433f6d66cdfbb486426fc652777426ed
parentc25cc7993243fdc00ab7e608e3764819538015ab
can: bittiming: add CAN_KBPS, CAN_MBPS and CAN_MHZ macros

Add three macro to simplify the readability of big bit timing numbers:
  - CAN_KBPS: kilobits per second (one thousand)
  - CAN_MBPS: megabits per second (one million)
  - CAN_MHZ: megahertz per second (one million)

Example:
u32 bitrate_max = 8 * CAN_MBPS;
struct can_clock clock = {.freq = 80 * CAN_MHZ};
instead of:
u32 bitrate_max = 8000000;
struct can_clock clock = {.freq = 80000000};

Apply the new macro to driver/net/can/dev/bittiming.c.

Link: https://lore.kernel.org/r/20210306054040.76483-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/dev/bittiming.c
include/linux/can/bittiming.h