Thread (11 messages) flat view 11 messages, 3 authors, 2017-02-18

Re: [PATCHv2 4/5] block/sed: Embed function data into the function sequence

From: Christoph Hellwig <hch@lst.de>
Date: 2017-02-18 16:22:05
Also in: linux-nvme

On Sat, Feb 18, 2017 at 08:52:19AM -0700, Scott Bauer wrote:
quoted
quoted
+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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help