Re: [PATCH v6 09/14] platform/x86: dell-smbios: Introduce dispatcher for SMM calls

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 10, 2017 at 07:14:53PM +0000, Mario.Limonciello@xxxxxxxx wrote:
> > -----Original Message-----
> > From: Pali Rohár [mailto:pali.rohar@xxxxxxxxx]
> > Sent: Tuesday, October 10, 2017 11:01 AM
> > To: Limonciello, Mario <Mario_Limonciello@xxxxxxxx>
> > Cc: dvhart@xxxxxxxxxxxxx; Andy Shevchenko <andy.shevchenko@xxxxxxxxx>;
> > LKML <linux-kernel@xxxxxxxxxxxxxxx>; platform-driver-x86@xxxxxxxxxxxxxxx;
> > Andy Lutomirski <luto@xxxxxxxxxx>; quasisec@xxxxxxxxxx; rjw@xxxxxxxxxxxxx;
> > mjg59@xxxxxxxxxx; hch@xxxxxx; Greg KH <greg@xxxxxxxxx>
> > Subject: Re: [PATCH v6 09/14] platform/x86: dell-smbios: Introduce dispatcher for
> > SMM calls
> > 
> > On Monday 09 October 2017 17:51:47 Mario Limonciello wrote:
> > >  static void dell_rfkill_query(struct rfkill *rfkill, void *data)
> > >  {
> > > -	struct calling_interface_buffer *buffer;
> > >  	int radio = ((unsigned long)data & 0xF);
> > >  	int hwswitch;
> > >  	int status;
> > >  	int ret;
> > >
> > > -	buffer = dell_smbios_get_buffer();
> > > -
> > > -	dell_smbios_send_request(17, 11);
> > > -	ret = buffer->output[0];
> > > +	ret = dell_send_request(17, 11, 0, 0, 0, 0);
> > 
> > Basically I do not like function which takes ten numeric parameters.
> > Before in this code there was just function with 2 parameters, now there
> > are lot of zero parameters, without information what which parameter
> > means...
> > 
> 
> In an earlier patch Darren wanted to keep dell_send_request around and
> remove code that was duplicated multiple times to clear buffer, set arguments etc,
> can you please comment on what exactly you would prefer?

There was a lot of boilerplate, and I think I suggested keeping the same
interface of dell_send_request(class, select) (with 2 arguments) rather than
replacing it with 3 or 4 lines of allocating and populating the buffer with the
same values.

I see you've updated this in v7 with two calls. I'd call that a reasonable
compromise.

> 
> It's very obvious if you look at the dell_send_request function what is happening.

There have been numerous analysis indicating that the more arguments a function
has, the more likely bugs are to be found in those functions. 6 is a lot.

-- 
Darren Hart
VMware Open Source Technology Center



[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux