Re: [PATCH 3/6] staging: octeon-usb: cvmx-usbcx-defs.h: avoid long lines in CVMX_USBCX macros

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

 



On Wed, Jun 05, 2013 at 12:31:32AM +0300, Aaro Koskinen wrote:
> -#define CVMX_USBCX_DAINT(block_id) (CVMX_ADD_IO_SEG(0x00016F0010000818ull) + ((block_id) & 1) * 0x100000000000ull)

There should be a few helper macros.  I don't know the names for
these:
#define bid_to_xxx1(block_id) ((block_id) & 1) ? 0x100000000000ull : 0)
#define bid_to_xxx4(block_id) ((block_id) & 1) ? 0x40000000000ull : 0)
#define bid_to_xxx8(block_id) ((block_id) & 1) ? 0x8000000000ull : 0)

#define SEG_PREFIX 0x00016F001000ull << 15
#define CVMX_ADD(addr) CVMX_ADD_IO_SEG(SEG_PREFIX | (addr))

Then CVMX_USBCX_DAINTMSK() becomes:

#define CVMX_USBCX_DAINT(block_id) (CVMX_ADD(0x0818) + bid_to_xxx1(block_id))

It fits on one line and it uses words instead of magic numbers.

regards,
dan carpenter




[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux