lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ADE657CA350FB648AAC2C43247A983F00207A6CBADD1@AUSP01VMBX24.collaborationhost.net>
Date:	Mon, 14 Jan 2013 10:44:29 -0600
From:	H Hartley Sweeten <hartleys@...ionengravers.com>
To:	Peter Huewe <peterhuewe@....de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>
CC:	Ian Abbott <abbotti@....co.uk>,
	Mori Hess <fmhess@...rs.sourceforge.net>,
	YAMANE Toshiaki <yamanetoshi@...il.com>,
	"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH 1/8] staging/comedi: Add macro for registering a comedi
 PCMCIA driver

On Saturday, January 12, 2013 7:11 PM, Peter Huewe wrote:
> This patch introduces a new macro 'module_comedi_pcmcia_driver'
> for comedi PCMCIA drivers which do not do anything special in module
> init/exit. This eliminates a lot of boilerplate.
>
> Adapted from 'module_comedi_pci_driver'
>
> Signed-off-by: Peter Huewe <peterhuewe@....de>
> ---
>  drivers/staging/comedi/comedidev.h |   22 ++++++++++++++++++++++
>  drivers/staging/comedi/drivers.c   |   34 ++++++++++++++++++++++++++++++++++
>  2 files changed, 56 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
> index 692e1e6..ccb22dd 100644
> --- a/drivers/staging/comedi/comedidev.h
> +++ b/drivers/staging/comedi/comedidev.h
> @@ -41,6 +41,9 @@
>  #include <linux/io.h>
>  #include <linux/timer.h>
>  #include <linux/pci.h>
> +#include <pcmcia/cistpl.h>
> +#include <pcmcia/cisreg.h>
> +#include <pcmcia/ds.h>

Are these includes actually needed here?

We need to work on getting rid of relying on comedidev.h to include everything,

>  #include <linux/usb.h>
>  
>  #include "comedi.h"
> @@ -342,6 +345,25 @@ void comedi_pci_driver_unregister(struct comedi_driver *, struct pci_driver *);
>  	module_driver(__comedi_driver, comedi_pci_driver_register, \
>  			comedi_pci_driver_unregister, &(__pci_driver))
>  
> +int comedi_pcmcia_driver_register(struct comedi_driver *,
> +					struct pcmcia_driver *);
> +void comedi_pcmcia_driver_unregister(struct comedi_driver *,
> +					struct pcmcia_driver *);
> +
> +/**
> + * module_comedi_pcmcia_driver() - Helper macro for registering a comedi PCMCIA driver
> + * @__comedi_driver: comedi_driver struct
> + * @__pcmcia_driver: pcmcia_driver struct
> + *
> + * Helper macro for comedi PCMCIA drivers which do not do anything special
> + * in module init/exit. This eliminates a lot of boilerplate. Each
> + * module may only use this macro once, and calling it replaces
> + * module_init() and module_exit()
> + */
> +#define module_comedi_pcmcia_driver(__comedi_driver, __pcmcia_driver) \
> +	module_driver(__comedi_driver, comedi_pcmcia_driver_register, \
> +			comedi_pcmcia_driver_unregister, &(__pcmcia_driver))
> +
>  struct usb_driver;
>  
>  int comedi_usb_driver_register(struct comedi_driver *, struct usb_driver *);
> diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
> index 50cf498..17a9e35 100644
> --- a/drivers/staging/comedi/drivers.c
> +++ b/drivers/staging/comedi/drivers.c
> @@ -24,6 +24,9 @@
>  #include <linux/device.h>
>  #include <linux/module.h>
>  #include <linux/pci.h>
> +#include <pcmcia/cistpl.h>
> +#include <pcmcia/cisreg.h>
> +#include <pcmcia/ds.h>
>  #include <linux/usb.h>
>  #include <linux/errno.h>
>  #include <linux/kconfig.h>
> @@ -958,6 +961,37 @@ void comedi_pci_driver_unregister(struct comedi_driver *comedi_driver,
>  }
>  EXPORT_SYMBOL_GPL(comedi_pci_driver_unregister);
>  
> +int comedi_pcmcia_driver_register(struct comedi_driver *comedi_driver,
> +		struct pcmcia_driver *pcmcia_driver)
> +{
> +	int ret;
> +
> +	ret = comedi_driver_register(comedi_driver);
> +	if (ret < 0)
> +		return ret;
> +
> +	/* FIXME: Remove this test after auditing all comedi pci drivers */
> +	if (!pcmcia_driver->name)
> +		pcmcia_driver->name = comedi_driver->driver_name;

This chunk should not be here. All the comedi pcmcia drivers have the 'name'
field properly initialized.

> +
> +	ret = pcmcia_register_driver(pcmcia_driver);
> +	if (ret < 0) {
> +		comedi_driver_unregister(comedi_driver);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(comedi_pcmcia_driver_register);
> +
> +void comedi_pcmcia_driver_unregister(struct comedi_driver *comedi_driver,
> +		struct pcmcia_driver *pcmcia_driver)
> +{
> +	pcmcia_unregister_driver(pcmcia_driver);
> +	comedi_driver_unregister(comedi_driver);
> +}
> +EXPORT_SYMBOL_GPL(comedi_pcmcia_driver_unregister);
> +
>  #if IS_ENABLED(CONFIG_USB)
>  
>  int comedi_usb_driver_register(struct comedi_driver *comedi_driver,

Regards,
Hartley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ