All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Scott Bauer <sbauer@eng.utah.edu>
Cc: Christoph Hellwig <hch@lst.de>,
	Jon Derrick <jonathan.derrick@intel.com>,
	Jens Axboe <axboe@fb.com>,
	Rafael Antognolli <rafael.antognolli@intel.com>,
	linux-nvme@lists.infradead.org, linux-block@vger.kernel.org,
	Scott Bauer <scott.bauer@intel.com>
Subject: Re: [PATCHv2 4/5] block/sed: Embed function data into the function sequence
Date: Sat, 18 Feb 2017 17:22:03 +0100	[thread overview]
Message-ID: <20170218162203.GC17922@lst.de> (raw)
In-Reply-To: <d6d1c65a-4422-97d7-8ee8-fef46159b143@eng.utah.edu>

On Sat, Feb 18, 2017 at 08:52:19AM -0700, Scott Bauer wrote:
> >> +static int set_mbr_done(struct opal_dev *dev, void *data)
> >>  {
> >> -	u8 mbr_done_tf = *(u8 *)dev->func_data[dev->state];
> >> +	u8 mbr_done_tf = *(u8 *)data;
> > 
> > No need for casts when going from void * to any pointer type.  There are
> > a couple more instance below where the cast should be removed as well.
> 
> In this case he's actually casting & dereferencing the pointer, so it should be fine in this scenario?

Oh, right.  As-is we'll obviously need the casts.  But what we could
do instead is the following:

	u8 *mbr_done_tf = data;

	..

	add_token_u8(&err, dev, *mbr_done_tf); /* Done T or F */

or alternatively just pass the whole struct opal_mbr_data pointer
as the private data.

WARNING: multiple messages have this Message-ID (diff)
From: hch@lst.de (Christoph Hellwig)
Subject: [PATCHv2 4/5] block/sed: Embed function data into the function sequence
Date: Sat, 18 Feb 2017 17:22:03 +0100	[thread overview]
Message-ID: <20170218162203.GC17922@lst.de> (raw)
In-Reply-To: <d6d1c65a-4422-97d7-8ee8-fef46159b143@eng.utah.edu>

On Sat, Feb 18, 2017@08:52:19AM -0700, Scott Bauer wrote:
> >> +static int set_mbr_done(struct opal_dev *dev, void *data)
> >>  {
> >> -	u8 mbr_done_tf = *(u8 *)dev->func_data[dev->state];
> >> +	u8 mbr_done_tf = *(u8 *)data;
> > 
> > No need for casts when going from void * to any pointer type.  There are
> > a couple more instance below where the cast should be removed as well.
> 
> In this case he's actually casting & dereferencing the pointer, so it should be fine in this scenario?

Oh, right.  As-is we'll obviously need the casts.  But what we could
do instead is the following:

	u8 *mbr_done_tf = data;

	..

	add_token_u8(&err, dev, *mbr_done_tf); /* Done T or F */

or alternatively just pass the whole struct opal_mbr_data pointer
as the private data.

  reply	other threads:[~2017-02-18 16:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-18  0:00 [PATCHv2 0/5] OPAL patche'd cont'd Jon Derrick
2017-02-18  0:00 ` Jon Derrick
2017-02-18  0:00 ` [PATCHv2 1/5] block/sed: Use ssize_t on atom parsers to return errors Jon Derrick
2017-02-18  0:00   ` Jon Derrick
2017-02-18  0:00 ` [PATCHv2 2/5] block/sed: Add helper to qualify response tokens Jon Derrick
2017-02-18  0:00   ` Jon Derrick
2017-02-18  0:00 ` [PATCHv2 3/5] block/sed: Check received header lengths Jon Derrick
2017-02-18  0:00   ` Jon Derrick
2017-02-18  0:00 ` [PATCHv2 4/5] block/sed: Embed function data into the function sequence Jon Derrick
2017-02-18  0:00   ` Jon Derrick
2017-02-18  8:36   ` Christoph Hellwig
2017-02-18  8:36     ` Christoph Hellwig
2017-02-18 15:52     ` Scott Bauer
2017-02-18 15:52       ` Scott Bauer
2017-02-18 16:22       ` Christoph Hellwig [this message]
2017-02-18 16:22         ` Christoph Hellwig
2017-02-18  0:00 ` [PATCHv2 5/5] block/sed: Eliminate state variable Jon Derrick
2017-02-18  0:00   ` Jon Derrick
2017-02-18  8:36   ` Christoph Hellwig
2017-02-18  8:36     ` Christoph Hellwig
2017-02-18  8:24 ` [PATCHv2 0/5] OPAL patche'd cont'd Christoph Hellwig
2017-02-18  8:24   ` 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=20170218162203.GC17922@lst.de \
    --to=hch@lst.de \
    --cc=axboe@fb.com \
    --cc=jonathan.derrick@intel.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=rafael.antognolli@intel.com \
    --cc=sbauer@eng.utah.edu \
    --cc=scott.bauer@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 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.