Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: jonathan.derrick@intel.com (Jon Derrick)
Subject: [PATCH 3/7 v2] nvme-fabrics: Add FC transport FC-NVME definitions
Date: Tue, 18 Oct 2016 13:49:40 -0600	[thread overview]
Message-ID: <20161018194939.GA2048@localhost.localdomain> (raw)
In-Reply-To: <1f0b3b42-241a-65db-f842-08a1c378b559@broadcom.com>

Hi James,

Fair warning, I don't really deal with the fabrics part of our driver,
and I don't see where your macro is actually used.

On Tue, Oct 18, 2016@10:59:43AM -0700, James Smart wrote:
> 
> 
> On 10/12/2016 1:58 AM, Christoph Hellwig wrote:
> >
> >>+/* fills in length of a descriptor. Struture minus descriptor header */
> >>+#define FCNVME_LSDESC_LEN(lsdesc) \
> >>+		cpu_to_be32(sizeof(lsdesc) - (2*(sizeof(u32))))
> >Make this an inline function and use spaces between the operators,
> >please.
> >
> 
> Christoph,
> 
> This can't be an inline - the "lsdesc" field is a type declaration ("struct
> x") and varies. That's the purpose of the define: so it can be applied to
> different structures- e.g. FCNVME_LSDESC_LEN(struct foo) and
> FCNVME_LSDESC_LEN(struct bar)

How about:
static inline __be32 fcnvme_lsdesc_len(size_t lsdesc_sz)
{
	return cpu_to_be32(lsdesc_sz - 2 * sizeof(u32));
}

foo = fcnvme_lsdesc_len(sizeof(struct bar));

  reply	other threads:[~2016-10-18 19:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 23:09 [PATCH 3/7 v2] nvme-fabrics: Add FC transport FC-NVME definitions James Smart
2016-10-12  8:58 ` Christoph Hellwig
2016-10-12 18:53   ` James Smart
2016-10-13  9:15     ` Christoph Hellwig
2016-10-18 17:59   ` James Smart
2016-10-18 19:49     ` Jon Derrick [this message]
2016-10-18 22:20       ` James Smart
2016-10-18 23:32         ` Jon Derrick
2016-10-19 12:52           ` Christoph Hellwig

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=20161018194939.GA2048@localhost.localdomain \
    --to=jonathan.derrick@intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox