All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Aaro Koskinen <aaro.koskinen@iki.fi>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	devel@driverdev.osuosl.org, linux-mips@linux-mips.org,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH 3/6] staging: octeon-usb: cvmx-usbcx-defs.h: avoid long lines in CVMX_USBCX macros
Date: Wed, 5 Jun 2013 11:36:46 +0300	[thread overview]
Message-ID: <20130605083646.GN28112@mwanda> (raw)
In-Reply-To: <1370381495-3358-4-git-send-email-aaro.koskinen@iki.fi>

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

  reply	other threads:[~2013-06-05  8:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04 21:31 [PATCH 0/6] staging: octeon-usb: cvmx-usbcx-defs.h cleanup Aaro Koskinen
2013-06-04 21:31 ` [PATCH 1/6] staging: octeon-usb: run cvmx-usbcx-defs.h through Lindent Aaro Koskinen
2013-06-04 21:31 ` [PATCH 2/6] staging: octeon-usb: cvmx-usbcx-defs.h: fix comment style Aaro Koskinen
2013-06-04 21:31 ` [PATCH 3/6] staging: octeon-usb: cvmx-usbcx-defs.h: avoid long lines in CVMX_USBCX macros Aaro Koskinen
2013-06-05  8:36   ` Dan Carpenter [this message]
2013-06-05 20:46     ` Aaro Koskinen
2013-06-04 21:31 ` [PATCH 4/6] staging: octeon-usb: cvmx-usbcx-defs.h: avoid long lines in comments Aaro Koskinen
2013-06-04 21:31 ` [PATCH 5/6] staging: octeon-usb: cvmx-usbcx-defs.h: delete CVS keyword marker Aaro Koskinen
2013-06-04 21:31 ` [PATCH 6/6] staging: octeon-usb: cvmx-usbcx-defs.h: reformat license text to fit 80 cols Aaro Koskinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130605083646.GN28112@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=aaro.koskinen@iki.fi \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-mips@linux-mips.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.