2016-12-14 13:44:14

by Piotr Gregor

[permalink] [raw]
Subject: [PATCH] drivers: staging: comedi: fix function prototypes

Add names of parameters to function prototypes in comedi PCI.
Checkpatch reports now no errors.

Signed-off-by: Piotr Gregor <[email protected]>
---
drivers/staging/comedi/comedi_pci.h | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/comedi/comedi_pci.h b/drivers/staging/comedi/comedi_pci.h
index 4005cc9..7dfd892 100644
--- a/drivers/staging/comedi/comedi_pci.h
+++ b/drivers/staging/comedi/comedi_pci.h
@@ -34,18 +34,20 @@
#define PCI_VENDOR_ID_RTD 0x1435
#define PCI_VENDOR_ID_HUMUSOFT 0x186c

-struct pci_dev *comedi_to_pci_dev(struct comedi_device *);
+struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev);

-int comedi_pci_enable(struct comedi_device *);
-void comedi_pci_disable(struct comedi_device *);
-void comedi_pci_detach(struct comedi_device *);
+int comedi_pci_enable(struct comedi_device *dev);
+void comedi_pci_disable(struct comedi_device *dev);
+void comedi_pci_detach(struct comedi_device *dev);

-int comedi_pci_auto_config(struct pci_dev *, struct comedi_driver *,
+int comedi_pci_auto_config(struct pci_dev *pcidev, struct comedi_driver *driver,
unsigned long context);
-void comedi_pci_auto_unconfig(struct pci_dev *);
+void comedi_pci_auto_unconfig(struct pci_dev *pcidev);

-int comedi_pci_driver_register(struct comedi_driver *, struct pci_driver *);
-void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *);
+int comedi_pci_driver_register(struct comedi_driver *comedi_driver,
+ struct pci_driver *pci_driver);
+void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver,
+ struct pci_driver *pci_driver);

/**
* module_comedi_pci_driver() - Helper macro for registering a comedi PCI driver
--
2.1.4


2016-12-14 16:48:05

by Hartley Sweeten

[permalink] [raw]
Subject: RE: [PATCH] drivers: staging: comedi: fix function prototypes

On December 14, 2016 6:42 AM, Piotr Gregor wrote:
> Add names of parameters to function prototypes in comedi PCI.
> Checkpatch reports now no errors.
>
> Signed-off-by: Piotr Gregor <[email protected]>
> ---
> drivers/staging/comedi/comedi_pci.h | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedi_pci.h b/drivers/staging/comedi/comedi_pci.h
> index 4005cc9..7dfd892 100644
> --- a/drivers/staging/comedi/comedi_pci.h
> +++ b/drivers/staging/comedi/comedi_pci.h
> @@ -34,18 +34,20 @@
> #define PCI_VENDOR_ID_RTD 0x1435
> #define PCI_VENDOR_ID_HUMUSOFT 0x186c
>
> -struct pci_dev *comedi_to_pci_dev(struct comedi_device *);
> +struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev);

For the function prototypes I prefer no names for the "pointer" parameters.

The "struct foo *" declaration is just as clear as "struct foo *bar".

Thanks,
Hartley

2016-12-15 12:01:44

by Ian Abbott

[permalink] [raw]
Subject: Re: [PATCH] drivers: staging: comedi: fix function prototypes

On 14/12/16 16:14, Hartley Sweeten wrote:
> On December 14, 2016 6:42 AM, Piotr Gregor wrote:
>> Add names of parameters to function prototypes in comedi PCI.
>> Checkpatch reports now no errors.
>>
>> Signed-off-by: Piotr Gregor <[email protected]>
>> ---
>> drivers/staging/comedi/comedi_pci.h | 18 ++++++++++--------
>> 1 file changed, 10 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/comedi_pci.h b/drivers/staging/comedi/comedi_pci.h
>> index 4005cc9..7dfd892 100644
>> --- a/drivers/staging/comedi/comedi_pci.h
>> +++ b/drivers/staging/comedi/comedi_pci.h
>> @@ -34,18 +34,20 @@
>> #define PCI_VENDOR_ID_RTD 0x1435
>> #define PCI_VENDOR_ID_HUMUSOFT 0x186c
>>
>> -struct pci_dev *comedi_to_pci_dev(struct comedi_device *);
>> +struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev);
>
> For the function prototypes I prefer no names for the "pointer" parameters.
>
> The "struct foo *" declaration is just as clear as "struct foo *bar".

Maybe, but checkpatch.pl doesn't agree (not since commit
ca0d8929e75ab1f860f61208d46955f280a1b05e anyway)!

--
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=-
-=( Web: http://www.mev.co.uk/ )=-

2016-12-15 12:01:43

by Ian Abbott

[permalink] [raw]
Subject: Re: [PATCH] drivers: staging: comedi: fix function prototypes

On 14/12/16 13:42, Piotr Gregor wrote:
> Add names of parameters to function prototypes in comedi PCI.
> Checkpatch reports now no errors.
>
> Signed-off-by: Piotr Gregor <[email protected]>
> ---
> drivers/staging/comedi/comedi_pci.h | 18 ++++++++++--------
> 1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedi_pci.h b/drivers/staging/comedi/comedi_pci.h
> index 4005cc9..7dfd892 100644
> --- a/drivers/staging/comedi/comedi_pci.h
> +++ b/drivers/staging/comedi/comedi_pci.h
> @@ -34,18 +34,20 @@
> #define PCI_VENDOR_ID_RTD 0x1435
> #define PCI_VENDOR_ID_HUMUSOFT 0x186c
>
> -struct pci_dev *comedi_to_pci_dev(struct comedi_device *);
> +struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev);
>
> -int comedi_pci_enable(struct comedi_device *);
> -void comedi_pci_disable(struct comedi_device *);
> -void comedi_pci_detach(struct comedi_device *);
> +int comedi_pci_enable(struct comedi_device *dev);
> +void comedi_pci_disable(struct comedi_device *dev);
> +void comedi_pci_detach(struct comedi_device *dev);
>
> -int comedi_pci_auto_config(struct pci_dev *, struct comedi_driver *,
> +int comedi_pci_auto_config(struct pci_dev *pcidev, struct comedi_driver *driver,
> unsigned long context);
> -void comedi_pci_auto_unconfig(struct pci_dev *);
> +void comedi_pci_auto_unconfig(struct pci_dev *pcidev);
>
> -int comedi_pci_driver_register(struct comedi_driver *, struct pci_driver *);
> -void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *);
> +int comedi_pci_driver_register(struct comedi_driver *comedi_driver,
> + struct pci_driver *pci_driver);
> +void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver,
> + struct pci_driver *pci_driver);
>
> /**
> * module_comedi_pci_driver() - Helper macro for registering a comedi PCI driver
>

Looks good, thanks!

Reviewed-by: Ian Abbott <[email protected]>

--
-=( Ian Abbott @ MEV Ltd. E-mail: <[email protected]> )=-
-=( Web: http://www.mev.co.uk/ )=-

2016-12-15 16:27:18

by Hartley Sweeten

[permalink] [raw]
Subject: RE: [PATCH] drivers: staging: comedi: fix function prototypes

On Thursday, December 15, 2016 4:47 AM, Ian Abbott wrote:
> On 14/12/16 16:14, Hartley Sweeten wrote:
>> On December 14, 2016 6:42 AM, Piotr Gregor wrote:
>>> -struct pci_dev *comedi_to_pci_dev(struct comedi_device *);
>>> +struct pci_dev *comedi_to_pci_dev(struct comedi_device *dev);
>>
>> For the function prototypes I prefer no names for the "pointer" parameters.
>>
>> The "struct foo *" declaration is just as clear as "struct foo *bar".
>
> Maybe, but checkpatch.pl doesn't agree (not since commit
> ca0d8929e75ab1f860f61208d46955f280a1b05e anyway)!

Hmm.. Missed seeing that one go in.

I still think it's silly to name struct pointers in function arguments.
Especially since that normally leads to stuff like 'struct foo *foo' where
the parameter name is the same as the struct name.

Void pointers and generic types are a different matter. Naming those
makes sense for clarity.

Oh well... Just my 2 cents...

Hartley

2016-12-15 17:36:50

by Hartley Sweeten

[permalink] [raw]
Subject: RE: [PATCH] drivers: staging: comedi: fix function prototypes

On Thursday, December 15, 2016 4:45 AM, Ian Abbott wrote:
> On 14/12/16 13:42, Piotr Gregor wrote:
>> Add names of parameters to function prototypes in comedi PCI.
>> Checkpatch reports now no errors.
>>
>> Signed-off-by: Piotr Gregor <[email protected]>
>
> Looks good, thanks!
>
> Reviewed-by: Ian Abbott <[email protected]>

Reviewed-by: H Hartley Sweeten <[email protected]>