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

Scott Bauer sbauer at eng.utah.edu
Sat Feb 18 07:52:19 PST 2017



On 02/18/2017 01:36 AM, Christoph Hellwig wrote:
> Hi Jon,
> 
> I think this is a great cleanup!
> 
> A few nitpicky comments below:
> 
>> -typedef int (*opal_step)(struct opal_dev *dev);
>> +typedef struct opal_step {
>> +	int (*fn)(struct opal_dev *dev, void *data);
>> +	void *data;
>> +} opal_step;
> 
> no typedefs for structure types, please.
> 
>> +	opal_step *funcs;
> 
> maybe calls this member steps?
> 
>> +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?



More information about the Linux-nvme mailing list