Re: [PATCH 11/12] can: kvaser_pciefd: Refactor code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-05-23 13:27, Vincent MAILHOL wrote:
Hi Jimmy,

I have one single comment for this series.

Hi Vincent,

Thanks for the feedback!

On Tue. 23 May 2023 at 18:55, Jimmy Assarsson <extja@xxxxxxxxxx> wrote:
Refactor code;
  - Format code
  - Replace constants with macros
  - Rename variables and macros
  - Remove intermediate variable
  - Add/remove blank lines
  - Add function to fetch channel id from Rx packets
  - Reduce scope of variables

Signed-off-by: Jimmy Assarsson <extja@xxxxxxxxxx>
---

...

+static inline u8 kvaser_pciefd_rx_packet_get_ch_id(struct kvaser_pciefd_rx_packet *p)
+{
+       return (p->header[1] >> KVASER_PCIEFD_PACKET_CHID_SHIFT) & KVASER_PCIEFD_PACKET_CHID_MASK;

Instead of shifting and appliying the mask, define a mask which is
already shifted with GEN_MASK.

   Then use the FIELD_GET and FIELD_PREP from linux/bitfield.h.

The same comment applies to the other shift and mask operations.

This GEN_MASK, FIELD_GET and FIELD_PREP can be a separate patch.

Good point, will fix this in v2.

Best regards,
jimmy



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux