[PATCH] staging: comedi: refactor ni_pcimio driver and use module_comedi_pci_driver

H Hartley Sweeten hartleys at visionengravers.com
Tue May 15 16:11:17 UTC 2012


On Tuesday, May 15, 2012 8:55 AM, Ian Abbott wrote:
> On 2012-05-15 16:41, H Hartley Sweeten wrote:
>> On Tuesday, May 15, 2012 4:29 AM, Ian Abbott wrote:
>>> On 2012-05-12 00:51, H Hartley Sweeten wrote:
>>>> +static struct comedi_driver ni_pcimio_driver = {
>>>> +	.driver_name	= "ni_pcimio",
>>>
>>> The original used the DRV_NAME macro expanding to "ni_pcimio" here...
>>>
>>>> +static struct pci_driver ni_pcimio_pci_driver = {
>>>> +	.name		= "ni_pcimio",
>>>
>>> ... which could also be used here.
>>>
>>>   (I realize this is a bit late as the patch is already committed!)
>>
>> I noticed that. A couple of the comedi drivers do this but it's not consistent.
>>
>> Personally I don't care for the use of the DRV_NAME (or DRIVER_NAME
>> or whatever someone wants to call it) usage. It doesn't same any code
>> space and always makes me have to do a second search to see what the
>> "name" actually is.
>>
>> Regardsless, if you prefer this in the drivers please let me know. It
>> would be nice to have them somewhat consistent before the comedi
>> support leaves staging.
>
> It doesn't really matter as long as it's consistent within the driver. 
> I tend to use macros for literals used several times as it often allows 
> mistakes to be caught at compile-time.
>
> I think DRV_NAME is still used in the request_irq() call though.

Yah, I missed that one.

I was going to clean up all the request_irq()'s so that dev->driver->driver_name
is used for all "name" parameters. This fixes a number of drivers that directly
reference the static comedi_driver variable. And it removes all the static "names".

When I do this I will also drop all the DRV_NAME macros that are no longer used.

Regards,
Hartley




More information about the devel mailing list