Re: [PATCH 3/3] staging: comedi: drivers: set dev->board_name before (*attach)

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

 



On 2013-03-13 19:19, H Hartley Sweeten wrote:
Default the dev->board_name to the dev->driver->driver_name before
calling the comedi driver (*attach) or (*auto_attach). This way
drivers without additional boardinfo do not have to set the
dev->board_name pointer.

For the legacy comedi_device_attach(), if `dev->board_ptr` is non-NULL (as set by comedi_recognize()), `*(const char *)dev->board_ptr` will point to the board name string (see comment below for code details). This would also allow the setting of `dev->board_name` to be eliminated from a lot of the legacy drivers.

This could be done in a follow-up patch.

@@ -390,9 +390,12 @@ int comedi_device_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                 module_put(driv->module);
                 return -ENOSYS;
         }
-       /* initialize dev->driver here so
-        * comedi_error() can be called from attach */
+       /*
+        * initialize dev->driver and dev->board_name here so
+        * comedi_error() can be called from attach
+        */
         dev->driver = driv;
+       dev->board_name = dev->driver->driver_name;

	dev->board_name = dev->board_ptr ?
                          *(const char *)dev->board_ptr :
			  dev->driver->driver_name;

(That will probably fit in 2 lines for 80 columns.)

--
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti@xxxxxxxxx>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-
_______________________________________________
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