RE: [PATCH 02/38] staging: comedi: ni_6527: change driver name string

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

 



On Friday, September 14, 2012 9:34 AM, Ian Abbott wrote:
> Change the driver name string used in data structures, kernel messages,
> etc. from "ni6527" to "ni_6527" to match the module name.  Use a macro
> `DRIVER_NAME` that expands to this string literal.
>
> Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
> ---
>  drivers/staging/comedi/drivers/ni_6527.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c
> index 1f52f36..6f0659a 100644
> --- a/drivers/staging/comedi/drivers/ni_6527.c
> +++ b/drivers/staging/comedi/drivers/ni_6527.c
> @@ -46,6 +46,8 @@ Updated: Sat, 25 Jan 2003 13:24:40 -0800
>  
>  #include "mite.h"
>  
> +#define DRIVER_NAME "ni_6527"
> +
>  #define NI6527_DIO_SIZE 4096
>  #define NI6527_MITE_SIZE 4096
>  
> @@ -80,7 +82,7 @@ static int ni6527_attach(struct comedi_device *dev,
>  			 struct comedi_devconfig *it);
>  static void ni6527_detach(struct comedi_device *dev);
>  static struct comedi_driver driver_ni6527 = {
> -	.driver_name = "ni6527",
> +	.driver_name = DRIVER_NAME,

Just my opinion... I hate this macro... Whenever it's used I always end up
searching the source to see what the actual "name" is.

>  	.module = THIS_MODULE,
>  	.attach = ni6527_attach,
>  	.detach = ni6527_detach,
> @@ -430,7 +432,7 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it)
>  	writeb(0x00, devpriv->mite->daq_io_addr + Master_Interrupt_Control);
>  
>  	ret = request_irq(mite_irq(devpriv->mite), ni6527_interrupt,
> -			  IRQF_SHARED, "ni6527", dev);
> +			  IRQF_SHARED, DRIVER_NAME, dev);

For this case, I think using 'dev->board_name' is a better choice.

> 	if (ret < 0)
>  		dev_warn(dev->class_dev, "irq not available\n");
>  	else
> @@ -471,7 +473,7 @@ static int ni6527_find_device(struct comedi_device *dev, int bus, int slot)
>  			}
>  		}
>  	}
> -	dev_err(dev->class_dev, "ni6527: no device found\n");
> +	dev_err(dev->class_dev, DRIVER_NAME ": no device found\n");

Again, using 'dev->board_name' seems better.

>  	mite_list_devices();
>  	return -EIO;
>  }

Regards,
Hartley

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux